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

Closed
opened this Issue Feb 16, 2016 · 8 comments

Projects
None yet
6 participants
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

``` Add test for sympy/sympy#10610 ```
``` 227fca0 ```
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 commented Feb 18, 2016

 I am looking into this

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

``` Fixes bug in limits sympy#10610 ```
``` f4c1c72 ```

Closed

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

``` Added test for sympy#10610 ```
``` 7a8910b ```

### 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

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

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

``` Fixes bug in limits sympy#10610 ```
``` 7b17ea9 ```

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

``` Added test for sympy#10610 ```
``` d1ba8bf ```
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 commented Mar 13, 2016

 @wrat There are still test cases that can fail

### vassbu commented Apr 15, 2016 • edited

 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 ``````

Open

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

``` Add another regression test for sympy/sympy#10610 (see 7e233e2) ```
``` a9c43db ```

### viditjain1 commented Oct 6, 2016

 is this issue solved?

### govindlahoti commented Oct 7, 2016

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

Closed

Merged

### 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)`
``` 3a574bd ```
Member

### jksuom commented Feb 9, 2017

 Fixed by #12121.

### 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
``` e64e3f0 ```