Skip to content
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 produces bad results with Floats #296

Closed
skirpichev opened this issue Jun 23, 2016 · 0 comments
Closed

limit produces bad results with Floats #296

skirpichev opened this issue Jun 23, 2016 · 0 comments
Labels
bug an unexpected problem or unintended behavior series
Milestone

Comments

@skirpichev
Copy link
Member

An example is sympy/sympy#11270. More simple test:

In [1]: e = log(exp(1/x)/Float(2) + exp(-1/x)/2)*x**2

In [2]: e.limit(x, oo)  # Float(0.5) would be better
Out[2]: ∞

In [3]: e = log(exp(1/x)/2 + exp(-1/x)/2)*x**2

In [4]: e.limit(x, oo)
Out[4]: 1/2

In some sense Out[2] is not wrong:

In [3]: e2 = log(exp(1/x)/(2 + y) + exp(-1/x)/2)*x**2

In [4]: e2.limit(x, oo)
Out[4]: 
      ⎛   ⎛y + 4⎞         ⎞
∞⋅sign⎜log⎜─────⎟ - log(2)⎟
      ⎝   ⎝y + 2⎠         ⎠
@skirpichev skirpichev added bug an unexpected problem or unintended behavior series labels Jun 23, 2016
skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 23, 2016
Limit algorithms (i.e. Gruntz) doesn't work well with
non-exact numbers.

TODO: Perhaps, it's a user task to convert them to
Rationals/whatever and it's better to raise an exception
instead of this conversion.

Fixes diofant#296
Fixes sympy/sympy#11270

Few outdated comments in test_compute_leading_term are removed.

This also closes sympy/sympy#5383 (regression test added).
@skirpichev skirpichev modified the milestone: 0.8.0 Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior series
Projects
None yet
Development

No branches or pull requests

1 participant