-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add test case for subs #21097
base: master
Are you sure you want to change the base?
Add test case for subs #21097
Conversation
✅ Hi, I am the SymPy bot (v167). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.
Click here to see the pull request description that was parsed.
|
08ec070
to
4c89244
Compare
4c89244
to
6257286
Compare
22b1bca
to
835db6b
Compare
@@ -862,3 +862,13 @@ def test_issue_19558(): | |||
|
|||
assert e.subs(x, oo) == AccumBounds(-oo, oo) | |||
assert (sin(x) + cos(x)).subs(x, oo) == AccumBounds(-2, 2) | |||
|
|||
def test_subs_undefined_result(): |
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.
Can you use two blank lines between test functions (also fix this for the function above)?
What exactly is this improving the coverage of? |
sympy/core/tests/test_subs.py
Outdated
x, y = symbols("x, y") | ||
expr = x/y | ||
assert expr.subs([(x, 0), (y, 0)]) == 0 | ||
assert expr.subs([(x, 0), (y, 0)], simultaneous=True) == nan |
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.
@oscarbenjamin , I found simultaneous
a good option for evaluating some of the undefined expression and there is not any specific test case which exactly shows its purpose.
99547da
to
0669d1c
Compare
I'm not sure why the first result should be 0. That is, why |
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
[77f1d79c] [a6e74d2b]
<sympy-1.10.1^0>
+ 112±2ms 198±6ms 1.77 sum.TimeSum.time_doit
Full benchmark results can be found as artifacts in GitHub Actions |
I came across this issue too at some point. Clearly, strictly speaking this can't be resolved of course. However, not doing this seems to just blow up the complexity of many algorithms. Currently this already happens during canonicalisation in >>> import sympy
>>> import sympy.abc
>>> sympy.S.Zero/sympy.abc.y is sympy.S.Zero
True Changing it breaks a lot of things and it is not clear how to resolve this. Perhaps Expr needs to store all discontinuities, or perhaps a But as far as I understand, this is currently the expected behaviour in SymPy |
See #17224 |
References to other Issues or PRs
refer: #16318
Brief description of what is fixed or changed
Other comments
Release Notes
NO ENTRY