ALSO -- Fu, et al., have already thought a lot about trig simplification and if you just run fu(expr) you may get what you are looking for:
>>> ok = fu(P.expand()); print filldedent(ok) D**2 + 2*D*F*sin(x) + 2*D*G*cos(x) + 2*D*H*sin(2*x) + 2*D*J*cos(2*x) + F**2*(-cos(2*x)/2 + 1/2) + F*G*sin(2*x) + F*H*(cos(x) - cos(3*x)) + F*J*(-sin(x) + sin(3*x)) + G**2*(cos(2*x)/2 + 1/2) + G*H*(sin(x) + sin(3*x)) + G*J*sin(4*x)/(2*sin(x)) + H**2*(-cos(4*x)/2 + 1/2) + H*J*sin(4*x) + J**2*(cos(4*x)/2 + 1/2) >>> print filldedent(ok.atoms(Pow)) set([D**2, J**2, F**2, 1/sin(x), G**2, H**2]) There are no powers of trig functions except for the sin(x) in the denominator. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
