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

limit(3**n*3**(-n - 1)*(n + 1)**2/n**2, n, oo) is wrong #10610

Closed
asmeurer opened this Issue Feb 16, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@asmeurer
Copy link
Member

asmeurer commented Feb 16, 2016

In [41]: limit(3**n*3**(-n - 1)*(n + 1)**2/n**2, n, oo)
Out[41]: 1

From https://stackoverflow.com/questions/35428617/sympy-fails-limit-test. If you expand the expression first the terms cancel and it gets the answer right. The answer should be 1/3.

skirpichev added a commit to diofant/diofant that referenced this issue Feb 17, 2016

@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Feb 17, 2016

It seems that the test ok referred to in this comment is too liberal. It accepts all expressions that contain a polynomial both in the numerator and the denominator. In this case there are also dominating exponentials that essentially determine the limit, but they are ignored by the test.

@govindlahoti

This comment has been minimized.

Copy link

govindlahoti commented Feb 18, 2016

I am looking into this

govindlahoti added a commit to govindlahoti/sympy that referenced this issue Feb 18, 2016

govindlahoti added a commit to govindlahoti/sympy that referenced this issue Feb 18, 2016

skirpichev added a commit to diofant/diofant that referenced this issue Feb 20, 2016

Removed is_Mul heuristics in Limit.doit()
This patch introduces a performance regression (very
non-trivial to fix), but given the number of bugs fixed and
that old heuristics was completely wrong - I believe this
is a fair trade.

Closes sympy/sympy#10610
Closes sympy/sympy#9075
(I don't think this is all, but who cares.)

govindlahoti added a commit to govindlahoti/sympy that referenced this issue Feb 24, 2016

govindlahoti added a commit to govindlahoti/sympy that referenced this issue Feb 24, 2016

@wrat

This comment has been minimized.

Copy link
Contributor

wrat commented Mar 13, 2016

if Everything all right(all test cases has been passed ) then why this pull request is not merged yet???

@govindlahoti

This comment has been minimized.

Copy link

govindlahoti commented Mar 13, 2016

@wrat There are still test cases that can fail

@vassbu

This comment has been minimized.

Copy link

vassbu commented Apr 15, 2016

Yes,
here is one:

>>> x = symbols('x')
>>> n = symbols('n', integer=True)
>>> a = (x-1)**n/(2**n*(n+1))
>>> a1 = a.subs(n, n+1)
>>> L = limit(a1/a, n, oo)
>>> L
1                                      # Bug i SymPy!!
>>> L = limit(apart(a1/a), n, oo)      # workaround
>>> L
x/2 - 1/2

skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 20, 2016

@viditjain1

This comment has been minimized.

Copy link

viditjain1 commented Oct 6, 2016

is this issue solved?

@govindlahoti

This comment has been minimized.

Copy link

govindlahoti commented Oct 7, 2016

@viditjain1 No.
I am not working on this bug anymore. Sorry

jksuom added a commit that referenced this issue Feb 9, 2017

Merge pull request #12121 from Shikhar1998/limits
Fixing #10610: Made correction in evaluation of limit(3**n*3**(-n - 1)*(n + 1)**2/n**2, n, oo)
@jksuom

This comment has been minimized.

Copy link
Member

jksuom commented Feb 9, 2017

Fixed by #12121.

@jksuom jksuom closed this Feb 9, 2017

Upabjojr added a commit to Upabjojr/sympy that referenced this issue Oct 3, 2017

Removed is_Mul heuristics in Limit.doit()
This patch introduces a performance regression (very
non-trivial to fix), but given the number of bugs fixed and
that old heuristics was completely wrong - I believe this
is a fair trade.

Closes sympy#10610
Closes sympy#9075
(I don't think this is all, but who cares.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment