-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
Easy to FixThis is a good issue for new contributors. Feel free to work on this if no one else has already.This is a good issue for new contributors. Feel free to work on this if no one else has already.limits
Description
A particular set of limits
- Where exponent of the function has the variable
x
and would enter the following block inpow._eval_as_leading_term()
elif e.has(x):
lt = exp(e * log(b))
return lt.as_leading_term(x, logx=logx, cdir=cdir)
- Then would go on in
exp_eval_as_leading_term()
and have itsarg0
being computed anAccumBounds
term
def _eval_as_leading_term(self, x, logx=None, cdir=0):
from sympy.calculus.util import AccumBounds
arg = self.args[0].cancel().as_leading_term(x, logx=logx)
arg0 = arg.subs(x, 0)
were fixed at S.Infinity
in #23127
The same functions don't work at S.NegativeInfinity
because the direction of approach (cdir) for S.NegativeInfinity
( -1 which is different from 1 for S.Infinity) is being neglected here .
For eg
>>> limit((sin(x)**2)**(1/x), x, oo)
AccumBounds(0, 1)
>>> limit((sin(x)**2)**(1/x), x, -oo)
AccumBounds(0, 1)
But the expected answer is AccumBounds(1, oo)
This is from
return exp(arg0) |
The answer needs to be inverted when we approach from a negative direction (i.e.
cdir = -1
)
Hence a diff like this needs to be applied
- return exp(arg0)
+ if re(cdir) < S.Zero:
+ return 1/exp(arg0)
+ return exp(arg0)
Once the result is inverted as follows, we have the correct answer
>>> 1/AccumBounds(0, 1)
AccumBounds(1, oo)
Few tests which should be checked/added for S.NegativeInfinity
case are
>>> limit((cos(x) + 1)**(1/x), x, -oo)
>>> limit((cos(x))**(1/x), x, -oo)
>>> limit((tan(x)**2)**(2/x) , x, -oo)
>>> limit((sin(x)**2)**(1/x), x, -oo)
Metadata
Metadata
Assignees
Labels
Easy to FixThis is a good issue for new contributors. Feel free to work on this if no one else has already.This is a good issue for new contributors. Feel free to work on this if no one else has already.limits