-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
perfect_power
handles all Rationals
#22672
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
Conversation
✅ Hi, I am the SymPy bot (v162). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like: This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.10. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
perfect_power(1)
perfect_power
handles all Rationals
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) before after ratio
[907895ac] [7c0fa071]
- 5.06±0.01s 376±3ms 0.07 polygon.PolygonArbitraryPoint.time_bench01
+ 3.95±0.05ms 6.78±0.07ms 1.72 solve.TimeMatrixOperations.time_det(4, 2)
+ 3.97±0.03ms 6.76±0.04ms 1.70 solve.TimeMatrixOperations.time_det_bareiss(4, 2)
+ 45.2±0.8ms 83.5±3ms 1.85 solve.TimeMatrixSolvePyDySlow.time_linsolve(1)
+ 45.6±0.8ms 84.2±1ms 1.85 solve.TimeMatrixSolvePyDySlow.time_solve(1)
Full benchmark results can be found as artifacts in GitHub Actions |
sympy/ntheory/factor_.py
Outdated
|
||
>>> perfect_power(Rational(1/2)**3) | ||
(1/2, 3) | ||
>>> perfect_power(Rational(-3/2)**3) |
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.
Should this be e.g. Rational(-3, 2)
?
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.
denominators that are powers of 2 are exactly converted...but it is better practice to do as you show
>>> Rational(1/4)
1/4
References to other Issues or PRs
Brief description of what is fixed or changed
The following used to raise a ValueError:
Other comments
Release Notes
perfect_power
now only raises a ValueError for non-Rational input