Skip to content

Limit of rational expression with hypergeometric function #11465

@hombit

Description

@hombit

I've got an error when trying to calculate a limit of rational expression with hypergeometric function. It reproduces with this simple example (expression equivalents to exp(-x)):

import sympy
from sympy.abc import x
sympy.limit( 1 / sympy.hyper( (1,), (1,), x ), x, 0 ).doit()

I use sympy 1.0 and python 3.5.

Traceback:

AttributeError                            Traceback (most recent call last)
<ipython-input-2-e68e19221d68> in <module>()
      1 import sympy
      2 from sympy.abc import x
----> 3 sympy.limit( 1 / sympy.hyper( (1,), (1,), x ), x, 0 ).doit()

/usr/local/lib/python3.5/site-packages/sympy/series/limits.py in limit(e, z, z0, dir)
     43     """
     44 
---> 45     return Limit(e, z, z0, dir).doit(deep=False)
     46 
     47 

/usr/local/lib/python3.5/site-packages/sympy/series/limits.py in doit(self, **hints)
    170 
    171         try:
--> 172             r = gruntz(e, z, z0, dir)
    173             if r is S.NaN:
    174                 raise PoleError()

/usr/local/lib/python3.5/site-packages/sympy/series/gruntz.py in gruntz(e, z, z0, dir)
    649         else:
    650             raise NotImplementedError("dir must be '+' or '-'")
--> 651         r = limitinf(e0, z)
    652 
    653     # This is a bit of a heuristic for nice results... we always rewrite

/usr/local/lib/python3.5/site-packages/sympy/core/cache.py in wrapper(*args, **kwargs)
     91             def wrapper(*args, **kwargs):
     92                 try:
---> 93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:
     95                     retval = func(*args, **kwargs)

/usr/local/lib/python3.5/site-packages/sympy/series/gruntz.py in limitinf(e, x)
    422         e = e.subs(x, p)
    423         x = p
--> 424     c0, e0 = mrv_leadterm(e, x)
    425     sig = sign(e0, x)
    426     if sig == 1:

/usr/local/lib/python3.5/site-packages/sympy/core/cache.py in wrapper(*args, **kwargs)
     91             def wrapper(*args, **kwargs):
     92                 try:
---> 93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:
     95                     retval = func(*args, **kwargs)

/usr/local/lib/python3.5/site-packages/sympy/series/gruntz.py in mrv_leadterm(e, x)
    504     w = Dummy("w", real=True, positive=True, finite=True)
    505     f, logw = rewrite(exps, Omega, x, w)
--> 506     series = calculate_series(f, w, logx=logw)
    507     return series.leadterm(w)
    508 

/usr/local/lib/python3.5/site-packages/sympy/series/gruntz.py in calculate_series(e, x, logx)
    460     from sympy.polys import cancel
    461 
--> 462     for t in e.lseries(x, logx=logx):
    463         t = cancel(t)
    464 

/usr/local/lib/python3.5/site-packages/sympy/core/expr.py in yield_lseries(s)
   2552             def yield_lseries(s):
   2553                 """Return terms of lseries one at a time."""
-> 2554                 for si in s:
   2555                     if not si.is_Add:
   2556                         yield si

/usr/local/lib/python3.5/site-packages/sympy/core/expr.py in _eval_lseries(self, x, logx)
   2617         # terms.
   2618         n = 0
-> 2619         series = self._eval_nseries(x, n=n, logx=logx)
   2620         if not series.is_Order:
   2621             if series.is_Add:

/usr/local/lib/python3.5/site-packages/sympy/core/power.py in _eval_nseries(self, x, n, logx)
   1147 
   1148                 try:
-> 1149                     ord = b.as_leading_term(x)
   1150                     cf = Order(ord, x).getn()
   1151                     if cf and cf.is_Number:

/usr/local/lib/python3.5/site-packages/sympy/core/cache.py in wrapper(*args, **kwargs)
     91             def wrapper(*args, **kwargs):
     92                 try:
---> 93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:
     95                     retval = func(*args, **kwargs)

/usr/local/lib/python3.5/site-packages/sympy/core/expr.py in as_leading_term(self, *symbols)
   2779         if x not in self.free_symbols:
   2780             return self
-> 2781         obj = self._eval_as_leading_term(x)
   2782         if obj is not None:
   2783             return powsimp(obj, deep=True, combine='exp')

/usr/local/lib/python3.5/site-packages/sympy/core/function.py in _eval_as_leading_term(self, x)
    681         """
    682         from sympy import Order
--> 683         args = [a.as_leading_term(x) for a in self.args]
    684         o = Order(1, x)
    685         if any(x in a.free_symbols and o.contains(a) for a in args):

/usr/local/lib/python3.5/site-packages/sympy/core/function.py in <listcomp>(.0)
    681         """
    682         from sympy import Order
--> 683         args = [a.as_leading_term(x) for a in self.args]
    684         o = Order(1, x)
    685         if any(x in a.free_symbols and o.contains(a) for a in args):

AttributeError: 'TupleArg' object has no attribute 'as_leading_term'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions