Comment #9 on issue 1562 by asmeurer: Have trigsimp apply factor and
Poly.cancel() to sin's and cos's
http://code.google.com/p/sympy/issues/detail?id=1562
OK, here is an example of where polynomial manipulation is not enough to
trigsimplify. We need to replace
sin**2 with 1 - cos**2 or visa-versa to simplify these kinds of expressions:
This is in Mateusz's new ploys branch:
# There is nothing wrong with factor, it's just that algebraically (i.e.,
not taking trig identities into account), this
expression is not factorable.
In [14]: factor(-2*cos(x)**2 + cos(x)**4 - sin(x)**4)
Out[14]:
2 4 4
- 2⋅cos (x) + cos (x) - sin (x)
# But this works fine
In [15]: (-2*cos(x)**2 + cos(x)**4 - sin(x)**4).subs(cos(x)**2, 1 -
sin(x)**2)
Out[15]:
2
⎛ 2 ⎞ 2 4
-2 + ⎝1 - sin (x)⎠ + 2⋅sin (x) - sin (x)
# for more complex expressions, we should probably somehow only expand that
parts that have been changed
In [16]: expand((-2*cos(x)**2 + cos(x)**4 - sin(x)**4).subs(cos(x)**2, 1 -
sin(x)**2))
Out[16]: -1
# Oh, and by the way, trigsimp cannot do it.
In [17]: trigsimp(-2*cos(x)**2 + cos(x)**4 - sin(x)**4)
Out[17]:
2 4 4
- 2⋅cos (x) + cos (x) - sin (x)
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.