Same bug as in SIMPSUM ?



Well, it is the simpsum bug, because on my patched version maxima does the
right thing -- and it shows exactly the behaviour of the bug: sum
unpatched fails if one part of a sum can be summed while another can't, in
this case sum unpatched returns only the summed stuff.

maxima patched: (instructions how to patch can be found in the bug report)

(C1) exp:2^(-i-1)*(i+1)+2^(-i-1);

				   - i - 1    - i - 1
(D1) 			  (i + 1) 2	   + 2
(C2) sum(exp,i,0,n);

		       n
		      ====
		      \		      - i - 1	 - i - 1
(D2) 		       >    ((i + 1) 2	      + 2       )
		      /
		      ====
		      i = 0
(C3) sum(exp,i,0,n),simpsum;

				  n
				 ====
		       - n - 1	 \	        - i - 1
(D3) 		    - 2	       +  >    (i + 1) 2        + 1
				 /
				 ====
				 i = 0
(C4) sum(exp,i,0,n),simpsum,expand;

				      n
				     ====
			   - n - 1   \	      - i - 1
(D4) 		      - 2 2	   +  >	   i 2	      + 2
				     /
				     ====
				     i = 0
(C5) nusum(exp,i,0,n);

				       n + 4
(D5) 				   3 - -----
					  n
				       2 2

Martin

On 24 Jan 2003, Wolfgang Jenkner wrote:

> Mathieu Avila <mavila@irisa.fr> writes:
> 
> > In the dump following, the same expression "expt" is evaluated in two
> > different manners, and the result is different (whereas it
> > shoulnd't). The EV with the expand flag gives the right result.
> [...]
> > (C1) exp:2^(-INDICE-1)*(INDICE+1)+2^(-INDICE-1);
> >                                 - INDICE - 1    - INDICE - 1
> > (D1)              (INDICE + 1) 2             + 2
> > (C2) expt:sum( exp , indice,0,final);
> >             FINAL
> >             ====
> >             \                         - INDICE - 1    - INDICE - 1
> > (D2)         >         ((INDICE + 1) 2             + 2            )
> >             /
> >             ====
> >             INDICE = 0
> > (C3) ev(expt,simpsum);
> >                                     - FINAL - 1
> > (D3)                           1 - 2
> > (C4) ev(expt,simpsum,expand);
> > 
> >                                      - FINAL - 1
> > (D4)                          2 - 2 2
> 
> 
> I think that both results are wrong.
> 
> 
> (C1) expt:2^(-i-1)*(i+1)+2^(-i-1);
> 				   - i - 1    - i - 1
> (D1) 			  (i + 1) 2	   + 2
> (C2) testsum(f):=apply('sum,[expt,i,0,f]);
> (D2) 		  testsum(f) := APPLY('SUM, [EXPT, i, 0, f])
> (C3) testsum(1);
> 				       7
> (D3) 				       -
> 				       4
> 
> wheras the two results you got give 3/4 resp. 3/2.
> 
> I suggest instead
> 
> (C4) closed_form(f):=3-2^(-f-1)*(f+4);
> 					   - f - 1
> (D4) 		    closed_form(f) := 3 - 2	   (f + 4)
> (C5) for f from 0 thru 10 do sprint(testsum(f));
> 1 7/4 9/4 41/16 11/4 183/64 187/64 757/256 381/128 3059/1024 3065/1024 
> (D5) 				     DONE
> (C6) for f from 0 thru 10 do sprint(closed_form(f));
> 1 7/4 9/4 41/16 11/4 183/64 187/64 757/256 381/128 3059/1024 3065/1024 
> (D6) 				     DONE
> (C7) 
> 
> Wolfgang
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>