def _lie_group_remove(coords):
 if isinstance(coords, AppliedUndef):
  return coords.args[0]
 elif coords.is_Add:
  subfunc = coords.atoms(AppliedUndef)
  if subfunc:
   for func in subfunc:
    coords = coords.subs(func, 0)
  return coords
 elif coords.is_Pow:
  (base, expr) = coords.as_base_exp()
  base = _lie_group_remove(base)
  expr = _lie_group_remove(expr)
  return (base ** expr)
 elif coords.is_Mul:
  mulargs = []
  coordargs = coords.args
  for arg in coordargs:
   if (not isinstance(coords, AppliedUndef)):
    mulargs.append(_lie_group_remove(arg))
  return Mul(*mulargs)
 return coords

def _lie_group_remove ( coords ) : if isinstance ( coords , AppliedUndef ) : return coords . args [ 0 ] elif coords . is_Add : subfunc = coords . atoms ( AppliedUndef ) if subfunc : for func in subfunc : coords = coords . subs ( func , 0 ) return coords elif coords . is_Pow : ( base , expr ) = coords . as_base_exp ( ) base = _lie_group_remove ( base ) expr = _lie_group_remove ( expr ) return ( base ** expr ) elif coords . is_Mul : mulargs = [ ] coordargs = coords . args for arg in coordargs : if ( not isinstance ( coords , AppliedUndef ) ) : mulargs . append ( _lie_group_remove ( arg ) ) return Mul ( * mulargs ) return coords
this function is strictly meant for internal use by the lie group ode solving method .