Opened 3 years ago

Closed 3 weeks ago

# Add doctest that sum(binomial(1, n), n, 0, oo) equals 2

Reported by: Owned by: rburing major sage-9.5 symbolics maxima, binomial, series slelievre Frédéric Chapoton Samuel Lelièvre Fixed upstream, in a later stable release. 1cbe5bb 1cbe5bb59008986f08eafbd541ffd7ee258c8d26

As reported at

```sage: sum(binomial(1, n), n, 0, oo, algorithm='sympy')  # correct
2
sage: sum(binomial(1, n), n, 0, oo)  # incorrect
3
```

The error can be traced back to Maxima as follows: evaluating

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

runs

```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 runs

```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
```

This was reported upstream as

and Robert Dodier committed a fix in Maxima in Oct 2019.

### comment:1 Changed 3 years ago by embray

• Milestone changed from sage-8.7 to sage-8.8

Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)

### comment:2 Changed 2 years ago by gh-sheerluck

maxima-5.43.0: simplify_sum still has bug

### comment:3 Changed 2 years ago by kcrisman

• Report Upstream changed from Reported upstream. No feedback yet. to Fixed upstream, but not in a stable release.

Bug has a couple possible fixes upstream but apparently no commit yet.

### comment:4 Changed 2 years ago by embray

• Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

### comment:5 Changed 15 months ago by dimpase

• Description modified (diff)

### comment:6 Changed 4 months ago by slelievre

• Component changed from interfaces to symbolics
• Description modified (diff)
• Milestone set to sage-9.4
• Report Upstream changed from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
• Summary changed from sum(binomial(1,n),n,0,oo) should be 2 instead of 3 (error due to maxima) to Add doctest that sum(binomial(1, n), n, 0, oo) equals 2

This is now fixed in Maxima, in a version we use in Sage.

The only thing missing to close this ticket is a doctest.

### comment:7 Changed 2 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

### comment:8 Changed 4 weeks ago by chapoton

• Authors set to Frédéric Chapoton
• Branch set to u/chapoton/27092
• Commit set to a2cd2eeb74c60223d6e86b44f580d27874c4c6a2
• Status changed from new to needs_review

Voilà

New commits:

 ​a2cd2ee `adding a doctest for sum()`

### comment:9 Changed 4 weeks ago by git

• Commit changed from a2cd2eeb74c60223d6e86b44f580d27874c4c6a2 to 1cbe5bb59008986f08eafbd541ffd7ee258c8d26

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

 ​1cbe5bb `adding a doctest for sum()`

### comment:10 Changed 4 weeks ago by slelievre

• Description modified (diff)
• Reviewers set to Samuel Lelièvre
• Status changed from needs_review to positive_review

En avant.

### comment:11 Changed 3 weeks ago by vbraun

• Branch changed from u/chapoton/27092 to 1cbe5bb59008986f08eafbd541ffd7ee258c8d26
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.