On 02/03/2012 03:55 PM, Jaime Villate wrote:
> You could have created a list rather than an array by simply writing
> the "for" command
> right away:
> for i:0 thru 9 do (Y[i](x) := i*x, display (Y[i]));
>
> After you have defined those 10 functions,...
Let me correct myself. The above command did not just define 10 functions
0, x, 2*x, ..., 9*x, but it really defined a function of two variables,
Y[y](x) ---> y*x
Thus, the above command would be equivalent to:
for i:0 thru 9 do (Y[y](x) := y*x, display (Y[i]));
which shows that the function Y[y](x) is being superfluously defined 10
times and an
even simpler form of the above command would be:
Y[y](x) := y*x;
for i:0 thru 9 do display (Y[i]);
If one really wants to define just an array of 10 functions, one should
use define()
instead of :=
for i:0 thru 9 do (define (Y[i](x), i*x), display(Y[i](x)));
This is one more good reason to advise users not to use "Maxima
functions" to
represent the kind of functions they are used to in mathematics.
Cheers,
Jaime