Opened 11 years ago
Last modified 10 years ago
#10682 closed defect
sum fails with lower bound != 0 or 1 (upgrade maxima to 5.26) — at Version 10
Reported by: | fmaltey | Owned by: | burcin |
---|---|---|---|
Priority: | critical | Milestone: | sage-5.0 |
Component: | symbolics | Keywords: | maxima 5.26.0 binomial sum |
Cc: | mjo | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | several doctests need to be patched due to changes in output format/term order |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
I test
sage: var ('n,k') sage: sum (binomial(n,k)*k^2, k, 0, n) # is right sage: sum (binomial(n,k)*k^2, k, 1, n) # is right n(n+1)2^(n-2) sage: sum (binomial(n,k)*k^2, k, 2, n) # is false : I get 0
This works correctly on Maxima 5.26 - we need to upgrade! The new spkg is here.
Change History (10)
comment:1 Changed 11 years ago by
- Description modified (diff)
comment:2 Changed 10 years ago by
- Priority changed from major to critical
comment:3 Changed 10 years ago by
Maxima 5.23.2 http://maxima.sourceforge.net using Lisp ECL 11.1.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(simplify_sum); (%o1) /usr/local/sage/4.7.1/local/share/maxima/5.23.2/share/contrib/solve_rec/simplify_sum.mac (%i2) simplify_sum(sum(binomial(n,k)*k^2,k,2,n)); (%o2) 0
comment:4 follow-up: ↓ 5 Changed 10 years ago by
Possibly the following ticket is relevant:
maxima: binomial sums - ID: 2919296
If so, it might be fixed. I don't have access to maxima 5.26 to test.
comment:5 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 10 years ago by
- Status changed from new to needs_info
Replying to nbruin:
Possibly the following ticket is relevant:
maxima: binomial sums - ID: 2919296
If so, it might be fixed. I don't have access to maxima 5.26 to test.
It is fixed. (What's a big deal of having access to maxima 5.26? It compiles with ECL supplied with Sage 4.8):
$ ./maxima-local ;;; Loading #P"/usr/local/src/sage/sage-4.8.alpha4/local/lib/ecl-11.1.1/sb-bsd-sockets.fas" ;;; Loading #P"/usr/local/src/sage/sage-4.8.alpha4/local/lib/ecl-11.1.1/sockets.fas" ;;; Loading #P"/usr/local/src/sage/sage-4.8.alpha4/local/lib/ecl-11.1.1/defsystem.fas" ;;; Loading #P"/usr/local/src/sage/sage-4.8.alpha4/local/lib/ecl-11.1.1/cmp.fas" Maxima 5.26.0_41_gbc6210e http://maxima.sourceforge.net using Lisp ECL 11.1.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(simplify_sum); (%o1) /tmp/maxima/share/contrib/solve_rec/simplify_sum.mac (%i2) simplify_sum(sum(binomial(n,k)*k^2,k,2,n)); 2 n (n + n) 2 - 4 n (%o2) ----------------- 4 (%i3)
Thus, we need to update maxima spkg to 5.26.
By the way, I never understood why sum() is hardcoded this way in Sage. Sometimes I'd rather use Python's sum(), but I don't know how to do this.
comment:6 Changed 10 years ago by
- Description modified (diff)
- Summary changed from sum fails with lower bound != 0 or 1 to sum fails with lower bound != 0 or 1 (upgrade maxima to 5.26)
comment:7 in reply to: ↑ 5 Changed 10 years ago by
Replying to dimpase:
Sometimes I'd rather use Python's sum(), but I don't know how to do this.
This is off-topic but a good question. It shows people don't think of checking the python documentation for something like this, so perhaps a more prominent pointer is necessary
sage: import __builtin__ sage: __builtin__.sum? ... Docstring: sum(sequence[, start]) -> value
(What's a big deal of having access to maxima 5.26? It compiles with ECL supplied with Sage 4.8)
I tried on sage.math.washington.edu with the 4.8 precompiled tarball there and it didn't work for me. Luckily there are other people more skilled at compiling maxima.
comment:8 Changed 10 years ago by
- Description modified (diff)
- Status changed from needs_info to needs_review
comment:9 Changed 10 years ago by
- Status changed from needs_review to needs_work
comment:10 Changed 10 years ago by
- Description modified (diff)
- Work issues set to several doctests need to be patched due to changes in output format/term order
Several doctests need to be patched due to changes in output format/term order. See the log.
This is not some general issue where sum fails on all inputs with lower bound != 0, 1. For example, this is fine:
Starting at 2, I guess this should be the answer:
The answer seems fine for starting at 3,4, by the way:
This is probably a serious bug in Maxima, since the real work is done by the function
which just calls maxima in some complicated way.
I am raising the priority since this is a subtle and very serious mathematically incorrect result. Also, somebody needs to isolate this to a pure-maxima session exhibiting the bug (if it is in maxima!) and report upstream. I tried for a minute and failed.