Interesting. There may be a clisp issue at work here.
With maxima-5.9.0 / clisp-2.27 on irix6.5 I see
(C1) f[0](x):=0;
(D1) f (x) := 0
0
(C2) f[i+1](x):=f[i](x);
*** - STRING: argument ((MPLUS) |$i| 1) should be a string, a symbol or a character
The following restarts are available:
R1 = Macsyma top-level
1. Break [1]>
.... but ....
(C2) f[0](x):=0;
(D2) f (x) := 0
0
(C3) f[i](x):=f[i-1](x);
(D3) f (x) := f (x)
i i - 1
-----Original Message-----
From: Milan Lukic [mailto:lmilan at shell]
Sent: Friday, 10 October 2003 11:59 AM
To: Maxima@www.ma.utexas.edu
Subject: Re: [Maxima] 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
>
_______________________________________________
Maxima mailing list
Maxima@www.math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima