Re: [Maxima] Strange behavior with sum



hi

Maybe local variables at block[] is treated let like,not 
let*,so I rewrite this,

 f(torder, pvar):= block([lamda,z,lamdaSum,zSum1,zSum],
  lamda:make_array('any,torder+1),
  z:make_array('any,torder+1),
  lamdaSum:sum('lamda[i]*pvar^i,i,0,torder),
  zSum1:sum('z[i]*pvar^i,i,0,torder)*lamdaSum,
  zSum:sum('z[i]*pvar^i,i,0,torder),
  zSum:lamdaSum*zSum,
  print(zSum,zSum1)
  );
 
its' well.
(C25) f(2,e);

	 2			     2
(lamda  e  + lamda  e + lamda ) (z  e  + z  e + z ) 
      2		  1	     0	  2	  1	 0

				    2			        2
			   (lamda  e  + lamda  e + lamda ) (z  e  + z  e + z ) 
				 2	     1	        0    2	     1	    0
		       2			   2
(D25) 	      (lamda  e  + lamda  e + lamda ) (z  e  + z  e + z )
		    2	        1	   0    2       1      0

Gosei Furuya (go_furuya@infoseek.jp)


 
> I have the following function
> f(torder, pvar):= block([
>             lamda:make_array('any,torder+1),
>             z:make_array('any,torder+1),
>             lamdaSum:sum('lamda[i]*pvar^i,i,0,torder),
>             zSum1:sum('z[i]*pvar^i,i,0,torder)*lamdaSum,
>             zSum:sum('z[i]*pvar^i,i,0,torder)],
>             zSum:lamdaSum*zSum,
>             print(zSum,zSum1)
> );
> f(2,e) returns
> 
> (lamda  e  + lamda  e + lamda ) (z  e  + z  e + z )
>       2           1          0    2       1      0
> 
>            2
>       (z  e  + z  e + z ) lamdaSum
>         2       1      0
> 
> so in the binding in the variable block, lamdaSum is not expanded, and
> outside the block it is.
> Since I need the expanded form, I need to know which behavior is
> correct, and if the unexpanded
> one is, then how can I convert to the expanded form, in case the
> behavior changes in the future.
> 
> Dan Stanger
> dan.stanger@ieee.org
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
>