Exception in sum((4*n+1)/factorial(n),n,1,oo)

50 views
Skip to first unread message

Georgi Guninski

unread,
Feb 9, 2024, 5:57:08 AM2/9/24
to sage-...@googlegroups.com
hi,

var('n')
sum((4*n+1)/factorial(n),n,1,oo)

TypeError: 'NoneType' object is not callable

Eric Gourgoulhon

unread,
Feb 9, 2024, 9:42:30 AM2/9/24
to sage-devel
I confirm the bug with Sage 10.3.beta7. It seems to be linked with the Maxima interface. 
Meanwhile, a workaround is to use the SymPy interface: 

sage: sum((4*n+1)/factorial(n), n, 1, oo, algorithm='sympy')
5*e - 1

Eric. 

Oscar Benjamin

unread,
Feb 9, 2024, 10:41:05 AM2/9/24
to sage-...@googlegroups.com
The NoneType error is presumably a bug in the sage wrapper code.
Possibly related is that Maxima cannot compute the sum with its
default algorithm. It does have a simplify_sum function that can do it
though:

(%i19) load (simplify_sum);
(%o19) "/usr/share/maxima/5.45.1/share/solve_rec/simplify_sum.mac"
(%i20) sum((4*n + 1)/factorial(n), n, 1, inf), simpsum;
(%o20) 'sum((4*n+1)/n!,n,1,inf)
(%i21) simplify_sum(%);
(%o21) 4*gamma_incomplete_lower(2,-1)+10*sqrt(%e)*sinh(1/2)

This is an indirect representation of 5*e - 1 as returned by SymPy.
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/824cbae6-d30d-4d27-8e08-38f787978bc4n%40googlegroups.com.

Emmanuel Charpentier

unread,
Feb 9, 2024, 4:12:50 PM2/9/24
to sage-devel
Le vendredi 9 février 2024 à 15:42:30 UTC+1, Eric Gourgoulhon a écrit :
I confirm the bug with Sage 10.3.beta7. It seems to be linked with the Maxima interface. 
Meanwhile, a workaround is to use the SymPy interface: 

sage: sum((4*n+1)/factorial(n), n, 1, oo, algorithm='sympy')
5*e - 1

FWIW, algorithms giac (and even mathematica) also work.

Reply all
Reply to author
Forward
0 new messages