# sympy/sympy

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.

# Different result of limit after simplify #11526

Open
opened this Issue Aug 17, 2016 · 1 comment

Projects
None yet
2 participants

### jbrea commented Aug 17, 2016

 Hi I just stumbled over the surprising result that the limit function returns a different result if I apply simplify to the argument. The full example is here: \$ python Python 3.5.2 (default, Jun 28 2016, 08:46:01) [GCC 6.1.1 20160602] on linux Type "help", "copyright", "credits" or "license" for more information. import sympy print(sympy.version) 1.0 from sympy import * tau, J, v0, theta = symbols('tau J v0 theta') df = diff(1/(tau_log((J-v0)/(J-theta))), J) limit(df, J, oo) -1/(tau_v0) limit(simplify(df), J, oo) -1/(-tau_theta + tau_v0) The second result (after applying the simplification) is correct. The first one isn't.

Member

### jksuom commented Aug 18, 2016

 The same phenomenon is visible in this part of the computation (where `1/J` is written for `J` in order to have the limit `J -> 0` instead of `J -> oo`): ``````>>> e = log((1/J - v0)/(1/J - theta)) >>> e.as_leading_term(J) -J*v0 >>> e.series(J, n=2) J*(theta - v0) + O(J**2) `````` The reason for the difference in the leading terms is this line `````` expr = expr.func(*[t.as_leading_term(x) for t in expr.args]).removeO() `````` If some of the leading terms in a sum cancel each other, it is necessary to consider higher order terms.

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

``` Add regression test for sympy/sympy#11526 ```
```This also partially fix issues with
Anyway, this expand_mul() call looks like a hack,
so I'll remove one.

Closes sympy/sympy#11526```
``` d29a170 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Aug 21, 2016

``` Add regression test for sympy/sympy#11526 ```
```This also partially fix issues with
``` cc21522 ```
``` Merge pull request #330 from skirpichev/fix-11526 ```
`Add regression test for sympy/sympy#11526`
``` 1629543 ```