Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
0

Bug in series evaluated at 0

asked 3 years ago

Roland765 gravatar image

updated 2 years ago

tmonteil gravatar image

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 00=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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

Emmanuel Charpentier gravatar image

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.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 205 times

Last updated: Mar 05 '22