-
-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Expression.simplify optionally use sympy #35236
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #35236 +/- ##
===========================================
+ Coverage 88.57% 88.60% +0.02%
===========================================
Files 2140 2140
Lines 397273 397415 +142
===========================================
+ Hits 351891 352117 +226
+ Misses 45382 45298 -84
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Documentation does not build |
The documentation should build now. |
Documentation preview for this PR is ready! 🎉 |
The test failures are unrelated sporadic errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for this contribution!
📚 Description
Expression.simplify
currently uses maxima to simplify an expression. Sympy also has a methodsimplify
that often works better. For this reason I propose to add an 'algorithm' parameter to the Expression.simplify method, to make it easy to use sympy's simplification method.To illustrate why this is beneficial, consider the expression
x = (-1/5*(2*sqrt(6)*(sqrt(5) - 5) + 11*sqrt(5) - 11)/(2*sqrt(6)*sqrt(5) - 11))
. Bothx.simplify_full()
andx.simplify()
are not able to simplify this expression. However,x.simplify(algorithm='sympy')
would return1/5*sqrt(5) - 1/5
.📝 Checklist
⌛ Dependencies