def polarify(eq, subs=True, lift=False):
 if lift:
  subs = False
 eq = _polarify(sympify(eq), lift)
 if (not subs):
  return eq
 reps = {s: Dummy(s.name, polar=True) for s in eq.free_symbols}
 eq = eq.subs(reps)
 return (eq, {r: s for (s, r) in reps.items()})

def polarify ( eq , subs = True , lift = False ) : if lift : subs = False eq = _polarify ( sympify ( eq ) , lift ) if ( not subs ) : return eq reps = { s : Dummy ( s . name , polar = True ) for s in eq . free_symbols } eq = eq . subs ( reps ) return ( eq , { r : s for ( s , r ) in reps . items ( ) } )
turn all numbers in eq into their polar equivalents .