-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Modify the behavior of physics.wigner.wigner_3j to make it more intuitive #26654
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
Wigner3j should return zero when J minus M is not a integer, to make it more intuitive.
✅ 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. |
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 [a36a8b23] <sympy-1.12.1^0> | After [06dbac02] | Ratio | Benchmark (Parameter) |
|----------|--------------------------------------|---------------------|---------|----------------------------------------------------------------------|
| - | 69.4±0.7ms | 44.9±0.4ms | 0.65 | integrate.TimeIntegrationRisch02.time_doit(10) |
| - | 69.2±0.6ms | 43.6±0.2ms | 0.63 | integrate.TimeIntegrationRisch02.time_doit_risch(10) |
| + | 18.7±0.1μs | 30.0±0.6μs | 1.61 | integrate.TimeIntegrationRisch03.time_doit(1) |
| - | 5.44±0.04ms | 2.94±0.05ms | 0.54 | logic.LogicSuite.time_load_file |
| - | 73.9±1ms | 28.8±0.2ms | 0.39 | polys.TimeGCD_GaussInt.time_op(1, 'dense') |
| - | 26.1±0.2ms | 17.3±0.1ms | 0.66 | polys.TimeGCD_GaussInt.time_op(1, 'expr') |
| - | 74.0±0.7ms | 29.0±0.1ms | 0.39 | polys.TimeGCD_GaussInt.time_op(1, 'sparse') |
| - | 257±2ms | 126±0.6ms | 0.49 | polys.TimeGCD_GaussInt.time_op(2, 'dense') |
| - | 256±1ms | 128±1ms | 0.5 | polys.TimeGCD_GaussInt.time_op(2, 'sparse') |
| - | 661±4ms | 379±2ms | 0.57 | polys.TimeGCD_GaussInt.time_op(3, 'dense') |
| - | 661±2ms | 381±3ms | 0.58 | polys.TimeGCD_GaussInt.time_op(3, 'sparse') |
| - | 500±3μs | 286±2μs | 0.57 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(1, 'dense') |
| - | 1.77±0.01ms | 1.05±0.01ms | 0.59 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(2, 'dense') |
| - | 5.88±0.05ms | 3.12±0.02ms | 0.53 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 449±5μs | 229±2μs | 0.51 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(1, 'dense') |
| - | 1.46±0.01ms | 687±7μs | 0.47 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(2, 'dense') |
| - | 4.91±0.01ms | 1.65±0.02ms | 0.34 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 376±4μs | 206±0.8μs | 0.55 | polys.TimeGCD_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 2.44±0.01ms | 1.23±0.01ms | 0.5 | polys.TimeGCD_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 10.0±0.1ms | 4.40±0.02ms | 0.44 | polys.TimeGCD_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 355±5μs | 171±2μs | 0.48 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(1, 'dense') |
| - | 2.50±0.02ms | 900±4μs | 0.36 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 9.97±0.1ms | 2.67±0.01ms | 0.27 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 1.02±0.01ms | 432±1μs | 0.42 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 1.74±0.01ms | 505±4μs | 0.29 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.94±0.04ms | 1.82±0.01ms | 0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'dense') |
| - | 8.66±0.06ms | 1.49±0.01ms | 0.17 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse') |
| - | 286±0.6μs | 65.0±0.6μs | 0.23 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 3.44±0.04ms | 395±4μs | 0.11 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 3.98±0.02ms | 278±0.4μs | 0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 7.09±0.06ms | 1.28±0.01ms | 0.18 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'dense') |
| - | 8.73±0.05ms | 843±5μs | 0.1 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse') |
| - | 5.07±0.06ms | 2.99±0.02ms | 0.59 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| - | 12.3±0.09ms | 6.64±0.04ms | 0.54 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'dense') |
| - | 22.3±0.2ms | 9.03±0.07ms | 0.4 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 5.21±0.03ms | 867±6μs | 0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 12.7±0.1ms | 7.04±0.03ms | 0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse') |
| - | 103±0.7ms | 26.0±0.1ms | 0.25 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'dense') |
| - | 168±0.6ms | 54.3±0.3ms | 0.32 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 173±1μs | 112±0.5μs | 0.65 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'dense') |
| - | 354±0.9μs | 216±0.7μs | 0.61 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'sparse') |
| - | 4.30±0.01ms | 851±9μs | 0.2 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'dense') |
| - | 5.29±0.01ms | 382±0.7μs | 0.07 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse') |
| - | 19.8±0.2ms | 2.80±0.03ms | 0.14 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'dense') |
| - | 22.7±0.3ms | 626±3μs | 0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse') |
| - | 478±3μs | 135±1μs | 0.28 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| - | 4.64±0.04ms | 608±2μs | 0.13 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'dense') |
| - | 5.35±0.02ms | 140±0.9μs | 0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| - | 13.1±0.08ms | 1.30±0ms | 0.1 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'dense') |
| - | 14.1±0.1ms | 143±0.6μs | 0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| - | 132±0.7μs | 75.3±0.5μs | 0.57 | solve.TimeMatrixOperations.time_rref(3, 0) |
| - | 249±1μs | 88.2±0.3μs | 0.35 | solve.TimeMatrixOperations.time_rref(4, 0) |
| - | 24.2±0.1ms | 10.0±0.04ms | 0.41 | solve.TimeSolveLinSys189x49.time_solve_lin_sys |
| - | 28.7±0.1ms | 15.5±0.05ms | 0.54 | solve.TimeSparseSystem.time_linsolve_Aaug(20) |
| - | 55.2±0.2ms | 24.8±0.1ms | 0.45 | solve.TimeSparseSystem.time_linsolve_Aaug(30) |
| - | 28.6±0.1ms | 15.2±0.1ms | 0.53 | solve.TimeSparseSystem.time_linsolve_Ab(20) |
| - | 55.0±0.2ms | 24.8±0.1ms | 0.45 | solve.TimeSparseSystem.time_linsolve_Ab(30) |
Full benchmark results can be found as artifacts in GitHub Actions |
sympy/physics/wigner.py
Outdated
if int(j_1 - m_1) != (j_1 - m_1) or \ | ||
int(j_2 - m_2) != (j_2 - m_2) or \ | ||
int(j_3 - m_3) != (j_3 - m_3): | ||
return S.Zero |
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 is an int_valued
function in sympy.core.numbers
that could be used 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.
OK, it's updated.
Looks good. Thanks! |
References to other Issues or PRs
Fixes #26166
Brief description of what is fixed or changed
The wigner_3j return 0 when j minus m is not a integer.
Before
Now
Refrence
Wigner3j-wolfram
Release Notes
physics.wigner.wigner_3j