Comment #12 on issue 1015 by [email protected]: limit((1+x/(n+sin(n)))**n,n,oo) doesn't work
http://code.google.com/p/sympy/issues/detail?id=1015

I see IEEE 754 has been envoked as justification for 1**nan == 1. IEEE 754 is a floating-point standard. 1**nan seems reasonable for floats to me, but does not seem robust enough for symbolic use. When we define 1**oo == nan, we get the correct behavior out of limit().

In [1]: Limit((1+x/(n+sin(n)))**n,n,oo)
Out[1]:
                    n
    ⎛    x         ⎞
lim ⎜────────── + 1⎟
n->∞⎝n + sin(n)    ⎠

In [2]: _.doit()
---------------------------------------------------------------------------

In [1]: Limit((1+x/(n+sin(n)))**n,n,oo)
Out[1]:
                    n
    ⎛    x         ⎞
lim ⎜────────── + 1⎟
n->∞⎝n + sin(n)    ⎠

In [2]: _.doit()
---------------------------------------------------------------------------
PoleError                                 Traceback (most recent call last)
<ipython-input-2-882323f1bef6> in <module>()
----> 1 _.doit()

sympy/series/limits.pyc in doit(self, **hints)
    162             z = z.doit(**hints)
    163             z0 = z0.doit(**hints)
--> 164         return limit(e, z, z0, str(dir))

sympy/series/limits.pyc in limit(e, z, z0, dir)
     89             raise PoleError()
     90     except (PoleError, ValueError):
---> 91         r = heuristics(e, z, z0, dir)
     92         #print("\t*h*",r)
     93     return r

sympy/series/limits.pyc in heuristics(e, z, z0, dir)
     96 def heuristics(e, z, z0, dir):
     97     if abs(z0) is S.Infinity:
---> 98 return limit(e.subs(z, 1/z), z, S.Zero, "+" if z0 is S.Infinity else "-")
     99
    100     rv = None

sympy/series/limits.pyc in limit(e, z, z0, dir)
     89             raise PoleError()
     90     except (PoleError, ValueError):
---> 91         r = heuristics(e, z, z0, dir)
     92         #print("\t*h*",r)
     93     return r

sympy/series/limits.pyc in heuristics(e, z, z0, dir)
    120     if rv in bad:
121 msg = "Don't know how to calculate the limit(%s, %s, %s, dir=%s), sorry."
--> 122         raise PoleError(msg % (e, z, z0, dir))
    123
    124     return rv

PoleError: Don't know how to calculate the limit((x/(sin(1/n) + 1/n) + 1)**(1/n), n, 0, dir=+), sorry.
-----------------------------------


The switch from 1**oo == 1 to 1**oo == nan results in only two test fails:

    assert 1**nan == 1  # as per IEEE 754

and

    assert S(1) ** S.Infinity == 1

If the IEEE 754 standard was actually useful, I'd expect more test failures.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to