Sympy can't computer limit of alternating sequence

38 views
Skip to first unread message

Frunobulax

unread,
Nov 4, 2016, 10:46:35 PM11/4/16
to sympy
Hello everyone,

I would have expected that the following code returns zero, but instead it gives me None.  Is there something I am missing?

from sympy import *
n
= symbols("n")
limit_seq
(((-1) ** n) / n, n)

Thanks,
Edi.

Aaron Meurer

unread,
Nov 4, 2016, 10:50:19 PM11/4/16
to sy...@googlegroups.com, Sartaj Singh
limit_seq looks like it is an internal function for the series module.
I'm not sure why it's exposed to the public API. Maybe Sartaj can
comment. The function you want is limit((-1)**n/n, n, oo).
Unfortunately, that doesn't seem to work (it gives
NotImplementedError).

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 https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/c765082c-d309-4e24-9a77-6cce6b9fe754%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sartaj Singh

unread,
Nov 5, 2016, 6:50:14 AM11/5/16
to Aaron Meurer, sy...@googlegroups.com

limit_seq implements a special algorithm for computing limits of sequences. In this case I guess it wasn't able to compute the limit so it returned None. I agree this probably should not be public as it can be confusing like in this case. We should offer only limit as the public function. I will send in a PR.


On Nov 4, 2016 7:50 PM, "Aaron Meurer" <asme...@gmail.com> wrote:
limit_seq looks like it is an internal function for the series module.
I'm not sure why it's exposed to the public API. Maybe Sartaj can
comment.  The function you want is limit((-1)**n/n, n, oo).
Unfortunately, that doesn't seem to work (it gives
NotImplementedError).

Aaron Meurer

On Fri, Nov 4, 2016 at 2:10 AM, Frunobulax <nha...@gmail.com> wrote:
> Hello everyone,
>
> I would have expected that the following code returns zero, but instead it
> gives me None.  Is there something I am missing?
>
> from sympy import *
> n = symbols("n")
> limit_seq(((-1) ** n) / n, n)
>
> Thanks,
> Edi.
>
> --
> 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
Reply all
Reply to author
Forward
0 new messages