-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
minor changes in mod(a, b) #26031
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
minor changes in mod(a, b) #26031
Conversation
✅ Hi, I am the SymPy bot. 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.13. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Tests should be added for what is fixed. |
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) | Change | Before [a00718ba] | After [92f94179] | Ratio | Benchmark (Parameter) |
|----------|----------------------|---------------------|---------|----------------------------------------------------------------------|
| - | 69.7±1ms | 44.5±0.5ms | 0.64 | integrate.TimeIntegrationRisch02.time_doit(10) |
| - | 67.4±0.5ms | 43.2±0.3ms | 0.64 | integrate.TimeIntegrationRisch02.time_doit_risch(10) |
| + | 18.6±0.1μs | 29.9±0.3μs | 1.6 | integrate.TimeIntegrationRisch03.time_doit(1) |
| - | 5.53±0.09ms | 2.92±0.03ms | 0.53 | logic.LogicSuite.time_load_file |
| - | 72.9±0.4ms | 28.5±0.1ms | 0.39 | polys.TimeGCD_GaussInt.time_op(1, 'dense') |
| - | 73.0±0.5ms | 29.1±0.05ms | 0.4 | polys.TimeGCD_GaussInt.time_op(1, 'sparse') |
| - | 255±2ms | 125±0.9ms | 0.49 | polys.TimeGCD_GaussInt.time_op(2, 'dense') |
| - | 258±2ms | 124±0.5ms | 0.48 | polys.TimeGCD_GaussInt.time_op(2, 'sparse') |
| - | 662±4ms | 374±0.8ms | 0.57 | polys.TimeGCD_GaussInt.time_op(3, 'dense') |
| - | 653±3ms | 374±2ms | 0.57 | polys.TimeGCD_GaussInt.time_op(3, 'sparse') |
| - | 495±3μs | 287±1μs | 0.58 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(1, 'dense') |
| - | 1.75±0.01ms | 1.05±0.01ms | 0.6 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(2, 'dense') |
| - | 5.85±0.04ms | 3.10±0.04ms | 0.53 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 451±2μs | 230±3μs | 0.51 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(1, 'dense') |
| - | 1.47±0.01ms | 691±6μs | 0.47 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(2, 'dense') |
| - | 4.89±0.01ms | 1.66±0.01ms | 0.34 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 375±2μs | 205±1μs | 0.55 | polys.TimeGCD_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 2.43±0.03ms | 1.23±0ms | 0.51 | polys.TimeGCD_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 9.97±0.03ms | 4.30±0.02ms | 0.43 | polys.TimeGCD_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 354±1μs | 168±0.5μs | 0.47 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(1, 'dense') |
| - | 2.46±0.02ms | 891±10μs | 0.36 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 9.62±0.04ms | 2.62±0.02ms | 0.27 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 1.03±0.01ms | 433±7μs | 0.42 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 1.74±0.02ms | 504±2μs | 0.29 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.85±0.07ms | 1.82±0.01ms | 0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'dense') |
| - | 8.51±0.1ms | 1.49±0.01ms | 0.18 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse') |
| - | 286±4μs | 64.1±0.5μs | 0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 3.43±0.01ms | 405±2μs | 0.12 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 4.01±0.03ms | 281±3μs | 0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 7.00±0.1ms | 1.26±0ms | 0.18 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'dense') |
| - | 8.59±0.03ms | 832±3μs | 0.1 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse') |
| - | 5.06±0.02ms | 2.97±0.01ms | 0.59 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| - | 12.1±0.1ms | 6.65±0.06ms | 0.55 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 22.2±0.1ms | 9.04±0.02ms | 0.41 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.21±0.01ms | 871±4μs | 0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 12.6±0.06ms | 7.07±0.02ms | 0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse') |
| - | 103±0.9ms | 26.5±0.07ms | 0.26 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 165±0.7ms | 54.1±0.3ms | 0.33 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 173±0.5μs | 114±1μs | 0.66 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 357±0.7μs | 216±1μs | 0.61 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'sparse') |
| - | 4.27±0.06ms | 839±3μs | 0.2 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 5.17±0.04ms | 377±0.7μs | 0.07 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse') |
| - | 19.9±0.2ms | 2.82±0.01ms | 0.14 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 22.7±0.2ms | 629±6μs | 0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse') |
| - | 478±2μs | 133±0.7μs | 0.28 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| - | 4.69±0.03ms | 627±4μs | 0.13 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 5.22±0.03ms | 139±2μs | 0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| - | 13.0±0.1ms | 1.32±0ms | 0.1 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 13.9±0.2ms | 140±0.8μs | 0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| - | 134±2μs | 75.5±0.3μs | 0.56 | solve.TimeMatrixOperations.time_rref(3, 0) |
| - | 249±1μs | 88.3±0.9μs | 0.35 | solve.TimeMatrixOperations.time_rref(4, 0) |
| - | 24.1±0.2ms | 10.3±0.05ms | 0.43 | solve.TimeSolveLinSys189x49.time_solve_lin_sys |
Full benchmark results can be found as artifacts in GitHub Actions |
sympy/core/tests/test_args.py
Outdated
@@ -682,6 +682,7 @@ def test_sympy__core__function__WildFunction(): | |||
def test_sympy__core__mod__Mod(): | |||
from sympy.core.mod import Mod | |||
assert _test_args(Mod(x, 2)) | |||
assert _test_args(Mod(3*x, 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.
This test would pass without the changes here. This does not really test anything useful and should be removed.
Tests should be added in sympy/core/tests/test_arit.py
.
sympy/core/tests/test_arit.py
Outdated
@@ -1996,6 +1996,8 @@ def test_Mod(): | |||
from sympy.abc import phi | |||
assert Mod(4.0*Mod(phi, 1) , 2) == 2.0*(Mod(2*(Mod(phi, 1)), 1)) | |||
|
|||
assert Mod(3*x, 2) == Mod(3*x, 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.
This test does not do anything: it would already pass without the changes here.
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.
The test should be
assert unchanged(Mod, 3*x, 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.
There should also be a test for what happens with a symbol that has integer=True
set (if there is not one already).
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.
x = symbols('x', integer=True)
unchanged(Mod, 3*x, 2)
@oscarbenjamin Hey there! Give output False, as mentioned here
This simplification assumes that x is an integer which is not necessarily the case if no assumptions are set on x:
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.
The test should be:
xi = symbols('x', integer=True)
assert unchanged(Mod, xi, 2)
assert Mod(3*xi, 2) == Mod(xi, 2)
References to other Issues or PRs
Fixes #26016
Brief description of what is fixed or changed
Other comments
Release Notes