rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

bad answer from simpsum? #1592

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:19:55 Created by bremner on 2006-01-08 16:36:39 Original: https://sourceforge.net/p/maxima/bugs/850


Maxima version: 5.9.2 Maxima build date: 17:19 11/8/2005 host type: i686-pc-linux-gnu lisp-implementation-type: GNU Common Lisp (GCL) lisp-implementation-version: GCL 2.6.7

The attached test case shows different results depending on whether the simpsum flag is set.

The number got by brute summation is the same as that got by maple.

here is a transcript

[ 12 quixote ~/research/path/calc ] maxima Maxima restarted. (%i1) display2d:off;

(%o1) false (%i2) load("test.max");

(%o2) ?test\.max (%i3) val1;

(%o3) 'sum(-3*b*2^(b+1)-3*2^(b+1)+1536*b+1536,b,3,8) (%i4) val2;

(%o4) 35424 (%i5) val3 ;

(%o5) 56880 (%i6)

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:19:56 Created by robert_dodier on 2006-01-14 08:12:23 Original: https://sourceforge.net/p/maxima/bugs/850/#d795


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:20:00 Created by robert_dodier on 2006-01-14 08:12:23 Original: https://sourceforge.net/p/maxima/bugs/850/#c989


Logged In: YES user_id=501686

Dunno what's going on here exactly, but these bugs are fixed by recent (post-5.9.2) changes to sum and product functions, which are now in cvs and will be included in the 5.9.3 release.

By the way subst ([l=10, j=3], expr); has the same effect as nested subst's. (See also sublis.)

Here's what I get when I try this on a recent cvs version:

(%i1) display2d:false;

(%o1) false (%i2) expr:sum(b*(j-1)^(l-1)*j+(j-1)^(l-1)*j-b*(j-1)^(b+1)*j-(j-1)^(b+1)*j,b,3,l-2);

(%o2) 'sum(b*((j-1)^(l-1))*j+(j-1)^(l-1)*j-b*((j-1)^(b+1))*j -(j-1)^(b+1)*j,b,3,l-2) (%i3) val1:subst(l=10,subst(j=3,expr));

(%o3) 35424 /* <-- OK !! */ (%i4) simp:false; /* <-- TURN OFF SIMPLIFICATION SO WE CAN EXTRACT THE SUMMAND */

(%o4) false (%i5) val1:subst(l=10,subst(j=3,expr));

(%o5) 'sum(-1*((-1+3)^(b+1))*3+(-1)*b*((-1+3)^(b+1))*3 +(-1+3)^(-1+10)*3 +b*((-1+3)^(-1+10))*3,b,3,-2+10) (%i6) summand:part(val1,1);

(%o6) -1*((-1+3)^(b+1))*3+(-1)*b*((-1+3)^(b+1))*3 +(-1+3)^(-1+10)*3+b*((-1+3)^(-1+10))*3 (%i7) simp:true;

(%o7) true (%i8) val2:sum(ev(summand),b,3,8);

(%o8) 35424 /* <-- OK !! */ (%i9) val3:ev(val1,simpsum);

(%o9) 35424 /* <-- OK !! */