Ask Your Question
4

Bug in computing sum (of binomials)

asked 2019-01-22 18:38:13 +0100

Thrash gravatar image

updated 2023-01-09 23:59:49 +0100

tmonteil gravatar image

One gets a wrong output when running the following command:

sage: sum(binomial(1,n),n,0,oo)
3

The output should be $2$ instead of $3$. Compare:

sage: sum(binomial(1,n),n,0,oo,algorithm="sympy")
2
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2019-01-22 19:31:45 +0100

rburing gravatar image

updated 2019-01-22 20:16:46 +0100

This bug originates from Maxima: if you evaluate

sum(binomial(1,n),n,0,oo)

then it returns

from sage.calculus.calculus import symbolic_sum
symbolic_sum(binomial(1,n),n,0,oo)

which calls

maxima_calculus.sr_sum(binomial(1,n),n,0,oo)

which returns

from sage.interfaces.maxima_lib import max_to_sr, maxima_eval, max_ratsimp, max_simplify_sum, max_sum, sr_to_max
args = [binomial(1,n), n, 0, oo]
max_to_sr(maxima_eval([[max_ratsimp],[[max_simplify_sum],([max_sum],[sr_to_max(SR(a)) for a in args])]]))

Indeed we can see the bug in Maxima's simplify_sum:

(%i1) load("simplify_sum");
(%i2) simplify_sum(sum(binomial(1,n),n,0,inf));
(%o2)                                  3

I reported it upstream at Maxima, simplify_sum(sum(binomial(1,n),n,0,inf)) gives 3 instead of 2, and it is now tracked as trac ticket #27092.

edit flag offensive delete link more

Comments

1

Thanks for the fast answer and the fast ticket report!

Thrash gravatar imageThrash ( 2019-01-22 20:51:07 +0100 )edit

If an answer solves your question, please accept it by clicking the "accept" button (the one with a check mark, at the top left of the answer).

This will mark the question as solved in the Ask Sage's list of questions, as well as in lists of questions related to a particular query or keyword.

slelievre gravatar imageslelievre ( 2019-01-23 15:23:38 +0100 )edit

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: 2019-01-22 18:38:13 +0100

Seen: 810 times

Last updated: Jan 22 '19