1

I would like to have [cos(a)*cos(b)]**k to be expanded to Acos(na +/- m*b) where m, n, and k are integers, similar to this post, but I have found that higher order terms are not being expanded by sympy.simplify.fu:

import sympy as sp

sp.init_printing()

wlo,wrf,wif = sp.symbols('omega_LO omega_RF omega_IF',real=True,positive=True)
t,Vrf,Vlo = sp.symbols('t V_RF V_LO',real=True)

vrf = Vrf*sp.cos(wrf*t)
vlo = Vlo*sp.cos(wlo*t)

# Taylor Series expansion of exp(x)-1
x = sp.Symbol('x')
ts = (sp.exp(x)-1).series(n=5)
ts = ts.subs(x,vrf*vlo)

expanded_ts = sp.fu(ts, measure=lambda x: -x.count_ops())

print expanded_ts.args[-21]

produces the following result

V_LO**4*V_RF**4*(-cos(2*omega_LO*t) + 1)**2/1536

which has a squared term rather than a sum of angles term. Any idea on how to force higher order terms into sum of angles?

Community
  • 1
  • 1
justin
  • 171
  • 8
  • This might be considered as a bug in TR8. You may be able to get what you want by applying other functions in the fu module. – asmeurer Nov 03 '16 at 17:36

0 Answers0