Symbolic sum giving incorrect answers

48 views
Skip to first unread message

Peter Taylor

unread,
Feb 11, 2022, 12:00:21 PM2/11/22
to sage-devel
"sum" is not specific enough a keyword to filter down the discussions. None of the titles of the "Mathematically incorrect answers" list on Trac are obviously about this issue, but is it new?

Code:

s, n, x, y, t = var('s, n, x, y, t')
print(sum(binomial(n,s) * (x+y)^s * x^(n-s), s, 0, n))
print(sum(binomial(n,s) * (x+1)^s * x^(n-s), s, 0, n))

Observed in version 9.4 using sagecell.sagemath.org:

(2*x + y)^n
(2*x)^n

Expected:


Regards,
Peter Taylor

Dima Pasechnik

unread,
Feb 11, 2022, 12:41:56 PM2/11/22
to sage-devel
On Fri, Feb 11, 2022 at 5:00 PM 'Peter Taylor' via sage-devel
<sage-...@googlegroups.com> wrote:
>
> "sum" is not specific enough a keyword to filter down the discussions. None of the titles of the "Mathematically incorrect answers" list on Trac are obviously about this issue, but is it new?
>
> Code:
>
> s, n, x, y, t = var('s, n, x, y, t')
> print(sum(binomial(n,s) * (x+y)^s * x^(n-s), s, 0, n))
> print(sum(binomial(n,s) * (x+1)^s * x^(n-s), s, 0, n))

This looks like a Maxima bug:

sage: SR(binomial(n,s) * (x+1)^s * x^(n-s)).sum( s, 0, n,
algorithm='giac') # correct
x^n*e^(n*log(2*x + 1) - n*log(x))
sage: SR(binomial(n,s) * (x+1)^s * x^(n-s)).sum( s, 0, n) # wrong
(actually, maxima is the default)
(2*x)^n
sage: SR(binomial(n,s) * (x+1)^s * x^(n-s)).sum( s, 0, n,
algorithm='maxima') # wrong
(2*x)^n

(this is with Sage 9.6.beta0)
> --
> 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/5936f5ad-848e-46bc-b123-8f521b61c4edn%40googlegroups.com.

Samuel Lelievre

unread,
Feb 11, 2022, 2:54:28 PM2/11/22
to sage-devel
Possibly related

- Sage Trac ticket 31418
  Incorrect (Maxima) symbolic sum
  https://trac.sagemath.org/ticket/31418

dmo...@deductivepress.ca

unread,
Feb 12, 2022, 12:13:08 AM2/12/22
to sage-devel
Thanks for the bug report.  I think this is new (although it is similar to #31844), so I opened ticket #33326.  It is a bug in maxima.
Reply all
Reply to author
Forward
0 new messages