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 assumption/result in a parametric limit #8241

Open
pelegm opened this Issue Oct 14, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@pelegm
Copy link
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 "<ipython-input-107-15f35fe7d38d>", line 1, in <module>
    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 skirpichev added the series label Oct 18, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment