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
Limit Bug #20365
Comments
I'm interested in working on this but I'm new. If I say I'd like to work on this, is it a binding contract? |
No it's not a binding contract. You can try to work on it and if it turns out to be more difficult than you hoped then you are not committed in any way. |
I'll work on this issue! |
Also looking into this. Let's see if we can bounce ideas @dakshisdaksh! |
I'll try working on this too! |
Just to add, Sympy 1.6.1 gives |
This seems to be the result of a bug in |
On current master it gives |
I tried to figure out where the bug was introduced, but I'm afraid I haven't progressed much. I ran On the current master:
On version 1.6.1:
|
@oscarbenjamin What do you think? |
The following diff computes the correct limit and passes all tests with negligible increase in time (about 1 second more to run This change is not desirable (I believe) in those cases as this increases the number of recursive calls and hence the time taken to calculate the limit. However, I am not able to come up with a better method. Is this diff fine or will the change in recursive calls in a few specific cases cause some serious time issues and a better method should be thought of? Any help would be appreciated. diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py
index a3e27db2b5..5c2cc63d00 100644
--- a/sympy/series/gruntz.py
+++ b/sympy/series/gruntz.py
@@ -272,8 +272,9 @@ def mrv(e, x):
return SubsSet(), b1
if e1.has(x):
base_lim = limitinf(b1, x)
- if base_lim is S.One:
- return mrv(exp(e1 * (b1 - 1)), x)
+ mrv0 = exp(e1 * (b1 - 1))
+ if base_lim is S.One and mrv0 is not exp(1):
+ return mrv(mrv0, x)
return mrv(exp(e1 * log(b1)), x)
else:
s, expr = mrv(b1, x) |
@jksuom any comments on the above-mentioned method? |
I think that |
I was thinking can't we use differentiation method for limits of form |
I'd prefer series expansions. |
@jksuom To me it seems to be more of a corner-case not being handled in the optimization introduced after 1.6.1 (specifically in 14a7d00 which caused the limit being output to change from |
I think that this should be handled by |
Limit gives the wrong answer.
This is the expr if anyone wants to dig deeper
The text was updated successfully, but these errors were encountered: