Result depends on the sign of I

141 views
Skip to first unread message

Paul Royik

unread,
Sep 7, 2015, 2:37:58 AM9/7/15
to sympy
I see this error when try to calculate limit of (-1)^x /sqrt(x) as x approaches infinity.
Can somebody explain me what is the problem here?

Kalevi Suominen

unread,
Sep 7, 2015, 3:52:12 AM9/7/15
to sympy


On Monday, September 7, 2015 at 9:37:58 AM UTC+3, Paul Royik wrote:
I see this error when try to calculate limit of (-1)^x /sqrt(x) as x approaches infinity.
Can somebody explain me what is the problem here?

``(-1)^x`` is equal to ``exp(pi*I*x)``. As the function has no serial expansion at infinity, SymPy attempts to use Gruntz' algorithm. It is intended tor real functions, and SymPy assumes that everything is real. It knows that ``pi`` is real and positive and the same is assumed of ``x``. That leaves just one problem: what is the sign of I.

Actually, there is currently no algorithm in SymPy capable of computing the limit (which is 0 as ``x`` tends to ``oo`` on the real line),

Paul Royik

unread,
Sep 7, 2015, 1:37:55 PM9/7/15
to sympy
Thank you.

Aaron Meurer

unread,
Sep 8, 2015, 4:21:04 PM9/8/15
to sy...@googlegroups.com
You can compute the limit by expanding the real and imaginary parts:

In [19]: x = Symbol('x', real=True, positive=True)

In [20]: expand(exp(pi*I*x)/sqrt(x), complex=True)
Out[20]:
ⅈ⋅sin(π⋅x) cos(π⋅x)
────────── + ────────
√x √x

In [21]: limit(expand(exp(pi*I*x)/sqrt(x), complex=True), x, oo)
Out[21]: 0

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/a3a3c6f0-2fcd-4324-af79-dc4dfa925247%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages