Skip to content
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

Merged
merged 2 commits into from
Apr 1, 2023

Conversation

mathcals
Copy link

@mathcals mathcals commented Mar 5, 2023

πŸ“š Description

Expression.simplify currently uses maxima to simplify an expression. Sympy also has a method simplify 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)). Both x.simplify_full() and x.simplify() are not able to simplify this expression. However, x.simplify(algorithm='sympy') would return 1/5*sqrt(5) - 1/5.

πŸ“ Checklist

  • I have made sure that the title is self-explanatory and the description concisely explains the PR.
  • I have linked an issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

βŒ› Dependencies

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2023

Codecov Report

Patch coverage: 97.95% and project coverage change: +0.02 πŸŽ‰

Comparison is base (52a81cb) 88.57% compared to head (cd39e30) 88.60%.

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     
Impacted Files Coverage Ξ”
src/sage/schemes/elliptic_curves/ell_generic.py 93.11% <66.66%> (-0.12%) ⬇️
src/sage/interfaces/tachyon.py 87.93% <90.00%> (+0.43%) ⬆️
src/sage/schemes/elliptic_curves/gal_reps.py 82.23% <90.00%> (+0.04%) ⬆️
src/sage/quadratic_forms/quadratic_form.py 90.26% <95.65%> (+0.16%) ⬆️
src/sage/modular/quasimodform/element.py 99.20% <100.00%> (+0.06%) ⬆️
src/sage/rings/qqbar.py 95.30% <100.00%> (+<0.01%) ⬆️
src/sage/schemes/affine/affine_morphism.py 90.33% <100.00%> (ΓΈ)
src/sage/schemes/elliptic_curves/BSD.py 43.75% <100.00%> (+0.21%) ⬆️
src/sage/schemes/elliptic_curves/cardinality.py 87.54% <100.00%> (+0.93%) ⬆️
src/sage/schemes/elliptic_curves/cm.py 89.52% <100.00%> (+0.39%) ⬆️
... and 70 more

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.
πŸ“’ Do you have feedback about the report comment? Let us know in this issue.

@mkoeppe
Copy link
Member

mkoeppe commented Mar 6, 2023

Documentation does not build

@mathcals
Copy link
Author

mathcals commented Mar 7, 2023

The documentation should build now.

@github-actions
Copy link

github-actions bot commented Mar 8, 2023

Documentation preview for this PR is ready! πŸŽ‰
Built with commit: cd39e30

@mkoeppe
Copy link
Member

mkoeppe commented Mar 8, 2023

The test failures are unrelated sporadic errors.

Copy link
Member

@mkoeppe mkoeppe left a 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!

@vbraun vbraun merged commit 0e2dc21 into sagemath:develop Apr 1, 2023
@mkoeppe mkoeppe added this to the sage-10.0 milestone Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants