Error: Don't know how to calculate the mrv of Integral #27139
Open
Description
Running the following code produces the errors below:
import sympy as sp
x, t = sp.symbols('x t')
integrand = t / (1 + t**2 * sp.sin(t)**2)
integral_expr = sp.integrate(integrand, (t, 0, x))
limit_expr = sp.limit(integral_expr / x, x, sp.oo)
limit_expr
The errors are:
{
"name": "NotImplementedError",
"message": "Don't know how to calculate the mrv of 'Integral(t/(t**2*sin(t)**2 + 1), (t, 0, _p))'",
"stack": "---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[3], line 9
5 integrand = t / (1 + t**2 * sp.sin(t)**2)
7 integral_expr = sp.integrate(integrand, (t, 0, x))
----> 9 limit_expr = sp.limit(integral_expr / x, x, sp.oo)
11 limit_expr
File ~/myenv/lib64/python3.12/site-packages/sympy/series/limits.py:64, in limit(e, z, z0, dir)
13 def limit(e, z, z0, dir=\"+\"):
14 \"\"\"Computes the limit of ``e(z)`` at the point ``z0``.
15
16 Parameters
(...)
61 limit_seq : returns the limit of a sequence.
62 \"\"\"
---> 64 return Limit(e, z, z0, dir).doit(deep=False)
File ~/myenv/lib64/python3.12/site-packages/sympy/series/limits.py:375, in Limit.doit(self, **hints)
372 l = None
374 try:
--> 375 r = gruntz(e, z, z0, dir)
376 if r is S.NaN or l is S.NaN:
377 raise PoleError()
File ~/myenv/lib64/python3.12/site-packages/sympy/series/gruntz.py:733, in gruntz(e, z, z0, dir)
730 else:
731 raise NotImplementedError(\"dir must be '+' or '-'\")
--> 733 r = limitinf(e0, z)
735 # This is a bit of a heuristic for nice results... we always rewrite
736 # tractable functions in terms of familiar intractable ones.
737 # It might be nicer to rewrite the exactly to what they were initially,
738 # but that would take some work to implement.
739 return r.rewrite('intractable', deep=True)
File ~/myenv/lib64/python3.12/site-packages/sympy/core/cache.py:72, in __cacheit.<locals>.func_wrapper.<locals>.wrapper(*args, **kwargs)
69 @wraps(func)
70 def wrapper(*args, **kwargs):
71 try:
---> 72 retval = cfunc(*args, **kwargs)
73 except TypeError as e:
74 if not e.args or not e.args[0].startswith('unhashable type:'):
File ~/myenv/lib64/python3.12/site-packages/sympy/series/gruntz.py:453, in limitinf(e, x)
451 c0, e0 = mrv_leadterm(e.min, x)
452 else:
--> 453 c0, e0 = mrv_leadterm(e, x)
454 sig = sign(e0, x)
455 if sig == 1:
File ~/myenv/lib64/python3.12/site-packages/sympy/core/cache.py:72, in __cacheit.<locals>.func_wrapper.<locals>.wrapper(*args, **kwargs)
69 @wraps(func)
70 def wrapper(*args, **kwargs):
71 try:
---> 72 retval = cfunc(*args, **kwargs)
73 except TypeError as e:
74 if not e.args or not e.args[0].startswith('unhashable type:'):
File ~/myenv/lib64/python3.12/site-packages/sympy/series/gruntz.py:536, in mrv_leadterm(e, x)
534 return (e, S.Zero)
535 if Omega == SubsSet():
--> 536 Omega, exps = mrv(e, x)
537 if not Omega:
538 # e really does not depend on x after simplification
539 return exps, S.Zero
File ~/myenv/lib64/python3.12/site-packages/sympy/series/gruntz.py:267, in mrv(e, x)
265 a, b = d.as_two_terms()
266 s1, e1 = mrv(a, x)
--> 267 s2, e2 = mrv(b, x)
268 return mrv_max1(s1, s2, e.func(i, e1, e2), x)
269 elif e.is_Pow and e.base != S.Exp1:
File ~/myenv/lib64/python3.12/site-packages/sympy/series/gruntz.py:320, in mrv(e, x)
317 elif e.is_Derivative:
318 raise NotImplementedError(\"MRV set computation for derivatives\"
319 \" not implemented yet.\")
--> 320 raise NotImplementedError(
321 \"Don't know how to calculate the mrv of '%s'\" % e)
NotImplementedError: Don't know how to calculate the mrv of 'Integral(t/(t**2*sin(t)**2 + 1), (t, 0, _p))'"
}