# Wrong assumption/result in a parametric limit #8241

Open
opened this Issue Oct 14, 2014 · 0 comments

Projects
None yet
2 participants
Contributor

### pelegm commented Oct 14, 2014

 Consider the following: ```n = Symbol('n', integer=True, positive=True) ## We assume a is a real positive, but nothing more a = Symbol('a', real=True, positive=True) ## And L is some function of n, with a as a parameter L = ln(n) / (a*ln(ln(n))) ## The following limit returns oo limit(n / ln(n)**L, n, oo) ## But this is a wrong result, as it assumes a > 1. ## Indeed, the following returns oo: limit(n / ln(n)**L.subs(a, Rational(3, 2)), n, oo) ## But the following returns 1: limit(n / ln(n)**L.subs(a, Rational(2, 2)), n, oo) ## And the following returns 0: limit(n / ln(n)**L.subs(a, Rational(1, 2)), n, oo)``` The expected output should be some Error which says that the result depands on the sign of `log(a)`. The interesting thing is that if one simplifies the expression before putting it into the limit (the expression is hiding the much simpler expression `n**(1 - 1/a)`), then the limit does not fail, and indeed raises an error: `limit(simplify(n / ln(n)**L), n, oo)` ```Traceback (most recent call last): File "", line 1, in limit(simplify(n / ln(n)**L), n, oo) File "sympy/series/limits.py", line 79, in limit r = gruntz(e, z, z0, dir) File "sympy/series/gruntz.py", line 637, in gruntz r = limitinf(e, z) File "sympy/core/cache.py", line 91, in wrapper retval = cfunc(*args, **kwargs) File "sympy/core/compatibility.py", line 872, in wrapper result = user_function(*args, **kwds) File "sympy/series/gruntz.py", line 433, in limitinf return limitinf(c0, x) # e0=0: lim f = lim c0 File "sympy/core/cache.py", line 91, in wrapper retval = cfunc(*args, **kwargs) File "sympy/core/compatibility.py", line 872, in wrapper result = user_function(*args, **kwds) File "sympy/series/gruntz.py", line 420, in limitinf c0, e0 = mrv_leadterm(e, x) File "sympy/core/cache.py", line 91, in wrapper retval = cfunc(*args, **kwargs) File "sympy/core/compatibility.py", line 872, in wrapper result = user_function(*args, **kwds) File "sympy/series/gruntz.py", line 501, in mrv_leadterm f, logw = rewrite(exps, Omega, x, w) File "sympy/series/gruntz.py", line 573, in rewrite raise NotImplementedError('Result depends on the sign of %s' % sig) NotImplementedError: Result depends on the sign of sign(a - 1)```

### skirpichev added a commit to diofant/diofant that referenced this issue Jan 26, 2016

``` Add test for sympy/sympy#8241 ```
`Closes sympy/sympy#8241`
``` cd95d48 ```