-
-
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
Wrong limit result for Abs((-n/(n+1))**n) #26513
Comments
Thanks for raising this. We do perform poorly when it comes to limits (bi-directional, or at infinities too ... you can easily find similar errors for |
It seems that the result for the third limit (the one with abs) is being returned correctly by gruntz but not for the second one
though for the second one(negative one) we get value 0 though the expression (-n/(n+1))**n is not well defined at infinity, it seems the problem stems from the following lines: Lines 266 to 286 in 2565eb3
since gruntz returns wrong value for (-n/(n+1))**n i.e 0 the computation for Abs one also gets messed up. |
Ok these are my thoughts here
So the code flow tries to solve Now as we can see, we don't solve
|
Yes exactly! |
It seems that the following lines are the cause of the problem Lines 417 to 418 in 3377fbd
the function sign(e,x) computes the sign of e as x tends to infinity. In master sign(log(-n/(n+1), n) computes to -1 which is wrong and should have been I. It seems the above lines were added with the context that taylor series expansion of log(x+1) around 0 is ` x -x**2/2+ ...' but since here we are trying to find the sign of expression as x tends to oo so maybe this conditional isn't the right thing to do here.Removing the conditional altogether solves the issue as sign of log expressions are calculated correctly using coefficient obtained from mrv_leadterm, here Lines 421 to 422 in 3377fbd
|
Is this It gets this wrong: In [12]: from sympy.series.gruntz import sign
In [13]: sign(exp(I*x), x)
Out[13]: 1 Is it that somewhere higher up such non-real expressions should be rejected? |
Yeah, since scenarios which will require computation of Lines 646 to 648 in da2d561
even in case of nested exponentiation or power tower scenarios, routines in mrv ensure that we dont end up getting exp or logs in exponents. Nevertheless we will never come to the point of having to use this sign function on exponents of any symbolic expression directly I believe.
|
The result:
The text was updated successfully, but these errors were encountered: