Skip to content

What's the best practice for using simplify? #26217

Closed Answered by asmeurer
neozhaoliang asked this question in Q&A
Discussion options

You must be logged in to vote

simplify() tries various simplification functions, but not all of them. To get better trig simplification you should use trigsimp directly, and try the different options documented in the method argument https://docs.sympy.org/latest/modules/simplify/simplify.html#module-sympy.simplify.trigsimp. You can also use the exact simplification functions from the fu module if you know which ones you want. https://docs.sympy.org/latest/modules/simplify/fu.html

In this case, the fu function does a pretty bad job at simplifying this function:

>>> pprint(fu(result[X]))
                                         2
 2sin(2t) + sin(4t)     (cos(2t) + 1) ⋅sin(2t)          5sin(2t)                  sin(

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@neozhaoliang
Comment options

Answer selected by neozhaoliang
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@neozhaoliang
Comment options

@asmeurer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #26215 on February 11, 2024 13:44.