another question



richard noel fell [09/10/03 16:22 -0400]:
> I would like to calculate the partial sums of a fourier series and have 
> maxima do the work. So, I define an array of functions (well, that is my 
> intent)
> f[0](x):=0;
> for i:1 thru 10 do 
> f[i+1](x):=f[i](x)+(-1)^i/(2*i+1)^2*sin(%pi*x/(2*i+1)^2). Then, I would 
> plot the partial sums via plot2d.
> 

Have you tried something like:

 f[0](x):=0;
 f[i+1](x):=f[i](x)+(-1)^i/(2*i+1)^2*sin(%pi*x/(2*i+1)^2)$
    In other words - no loop!
		Then, define a partial sum, say
 ss[3](x):=sum(f[i](x),i,0,3);
    end then plot:
 plot2d('(ss[3](x)),[x,-3,3]);
 
 It worked for me.
 
 Milan Lukic

> However, both commercial Macsyma and maxima, while perfectly happy with 
> a subscripted definition such as f[0](x):=x, they complain when I try to 
> do this in a for loop.  maxima gives the error message:
> ERROR ((MPLUS) |$i| 1) is not of type STRING
> 
> Is there a way to overcome this difficulty? Thanks,
> Dick Fell
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>