我想将[cos(a)* cos(b)] ** k扩展为A cos(n a +/- m * b)其中m,n,和k是整数,类似于this post,但我发现syy.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]
产生以下结果
V_LO**4*V_RF**4*(-cos(2*omega_LO*t) + 1)**2/1536
具有平方项而不是角度项之和。关于如何将高阶项加入角度之和的任何想法?