# Bug in series evaluated at 0

Hello!

Here is a simple example of the problem I have found in sagemath:

var('x n')
print(sum(x^n/factorial(n), n, 0, Infinity))
x = 0
print(sum(x^n/factorial(n), n, 0, Infinity))


The first output is e^x (as expected), and the second output is 0, which I think should be 1, because $0^0=1$. Since the general formula works for every nonzero x, and it also gives a result for x=0, I feel like this could be quite misleading in more complicated examples, where the result is not so obvious. Or try this:

x = 0
print(sum(x^n, n, 0, Infinity))
print(sum(x^n, n, -1, Infinity))


Both outputs are 0, even though the first should be 1, and the second should be infinity/undefined. The issue seems to be about powers of 0 in the sum. Note that in the case of finite sums, both sum(0^n, n, 0, 5) and sum(0^n, n, -1, 5) produce errors, however sum([0^n for n in range(0,5)]) outputs 1. This is probably related to trac.sagemath.org/ticket/22027.

edit retag close merge delete

Sort by » oldest newest most voted

FWIW :

sage: sum(x^j/factorial(j),j,0,oo)
e^x
sage: sum(x^j/factorial(j),j,0,oo).subs(x==0)
1
sage: sum(x^j/factorial(j),j,0,oo).limit(x=0)
1


but :

sage: sum(0^j/factorial(j),j,0,oo)
0


is indeed a bug, bound to Trac#22027, as you pointed out, which I have updated.

more