Problem with an infinite series

84 views
Skip to first unread message

Aaron Tresham

unread,
Nov 17, 2025, 10:23:53 PM11/17/25
to sage-support
I have used SageMath within CoCalc for teaching Calculus 2 for several years.

In past semesters, the following code produced the output "ind":

     var('n')
     sum(n*(-1)^n,n,1,oo)

This is expected, since the series diverges.

However, this semester I changed the kernel from SageMath 10.4 to the current SageMath 10.7. Now this same code produces the output "-1/4" [I believe 10.5 and 10.6 behave the same way as 10.7.]

I have my students compute the value of several similar series (replacing the -1 in the code above with -2, -1/2, 1/2, 1, and 2), and all the others are behaving the same way they always have. It is only this series which is giving me an unexpected output.

Has anyone else encountered this issue?

Thanks,
Aaron

Nils Bruin

unread,
Nov 17, 2025, 10:38:54 PM11/17/25
to sage-support
I can confirm the behaviour you're observing ... It's really unfortunate!. This would be a result produced by maxima, so most likely it's a change due to a change in maxima version. I would call it a bug. One should probably try to reproduce it in maxima proper and then report it to maxima. Hopefully they can fix it.

In maxima 5.47.0 I get:

(%i1) load(simplify_sum)$
(%i2) simplify_sum( sum(n*(-1)^n,n,1,inf));
-1/4

This happens both on sage's ECL based one and on the system maxima (running on SBCL). So I think this behaviour tracks decisively to maxima.

kcrisman

unread,
Nov 18, 2025, 7:59:27 AM11/18/25
to sage-support
I've opened https://sourceforge.net/p/maxima/bugs/4634/ for this, and hopefully we'll hear back.  Can someone open a corresponding Sage ticket which will eventually get a doctest for the same?  Thanks! 

Antonio Rojas

unread,
Nov 18, 2025, 8:14:01 AM11/18/25
to sage-support
This is fixed in maxima 5.48. The upgrade ticket is https://github.com/sagemath/sage/pull/40679

kcrisman

unread,
Nov 18, 2025, 9:42:01 AM11/18/25
to sage-support
Thanks for pointing that one out, that's great.  

(Though note that apparently the "correct" answer is "und" not "ind", according to the latest comment on the Sourceforge ticket!)

Aaron Tresham

unread,
Nov 18, 2025, 12:55:27 PM11/18/25
to sage-support
Thank you all for looking into this. I'm happy to hear that the bug has been fixed in Maxima. I'm sure the fix will work it's way into Sage soon enough.

By the way, this sum did return "und" a few years ago, and later the answer changed to "ind" (before changing to -1/4). I agree that und is better than ind (as far as I understand the difference between these).

Aaron

kcrisman

unread,
Jan 13, 2026, 11:12:50 AMJan 13
to sage-support
Just FYI this has been fixed upstream: https://sourceforge.net/p/maxima/bugs/4634/ so hopefully in a future version of Maxima soon.

Question to Nils or others: In the past we used to also open a ticket for Sage to make our own doctest - is that still the practice?  I'm just making a note at #40679 for now.

Dima Pasechnik

unread,
Jan 13, 2026, 12:39:49 PMJan 13
to sage-s...@googlegroups.com
On Tue, Jan 13, 2026 at 10:12 AM kcrisman <kcri...@gmail.com> wrote:
>
> Just FYI this has been fixed upstream: https://sourceforge.net/p/maxima/bugs/4634/ so hopefully in a future version of Maxima soon.
>
> Question to Nils or others: In the past we used to also open a ticket for Sage to make our own doctest - is that still the practice? I'm just making a note at #40679 for now.
>
the practice is to open a PR with a fix.
For a trivial PR, all is needed is a GitHub account and a browser, by
the way. No need for a local Sage install, even.
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/0beb1c12-5d31-4dd4-a9ac-b92b56b09a65n%40googlegroups.com.

kcrisman

unread,
Jan 14, 2026, 6:23:20 AMJan 14
to sage-support
> Question to Nils or others: In the past we used to also open a ticket for Sage to make our own doctest - is that still the practice? I'm just making a note at #40679 for now.
>
the practice is to open a PR with a fix.

I.e. a doctest, in this case.  However, upstream doesn't have it yet in stable so a PR for that would be premature (and the Maxima upgrade ticket is still open anyway). Thanks for the current status.
 
For a trivial PR, all is needed is a GitHub account and a browser, by
the way. No need for a local Sage install, even.
 
Yes, I've done that in the past for sure.
Reply all
Reply to author
Forward
0 new messages