Having to call trigsimp() twice?

16 views
Skip to first unread message

Matthias Geier

unread,
Dec 4, 2019, 4:59:11 AM12/4/19
to sy...@googlegroups.com
Dear list.

I stumbled upon a case where one invocation of trigsimp() doesn't
completely simplify an expression, but calling trigsimp() a second
time on the result leads to further simplification.

Is this normal?

I know that for simplify() there are arguments like "ratio" and
"measure" for specifying how far the simplification should go. But
those don't seem to exist for trigsimp()?

Here's an example where this is happening:
https://audioscenedescriptionformat.readthedocs.io/en/latest/quaternions.html#Quaternion-to-Rotation-Matrix

Here's a Binder link to try it out:
https://mybinder.org/v2/gh/AudioSceneDescriptionFormat/asdf/master?filepath=doc/quaternions.ipynb

For example, the expression

-2*(-sin(alpha/2)*sin(gamma/2)*cos(beta/2) +
sin(beta/2)*cos(alpha/2)*cos(gamma/2))**2 -
2*(sin(alpha/2)*cos(beta/2)*cos(gamma/2) +
sin(beta/2)*sin(gamma/2)*cos(alpha/2))**2 + 1

... is in the first run of `trigsimp()` simplified to:

cos(alpha - beta)/2 + cos(alpha + beta)/2

... which can be simplified by a second run of `trigsimp()` to:

cos(alpha)*cos(beta)

Am I supposed to just call trigsimp() twice or is there a better way?

cheers,
Matthias
Reply all
Reply to author
Forward
0 new messages