[Maxima] defining functions of s variables
andre maute
andre.maute at gmx.de
Tue Jan 8 13:49:51 CST 2008
Hi Bart,
perhaps you are seeking the
- makelist-concat construct for creating s variables
- apply-buildq-lambda construct for evaluation of the function
--------------------- snip -----------------
f(x) := block(
[res, k],
res : 1,
for k : 1 thru length(x) do block(
res : res * x[k]^k
),
return( res )
);
s : 6;
/* variables */
x : makelist( concat(x,i), i, 1, s );
/* derivatives */
for k : 1 thru s do block(
print( k, " ", diff(f(x),x[k]) )
);
/* evaluation, e.g. f( [1, ..., 1] ) */
g : f(x);
p : makelist( 1, i, 1, s );
result : apply( buildq( [x,g], lambda(x,g) ), p );
--------------------- snip -----------------
Regards Andre
More information about the Maxima
mailing list