Welcome to Maxima. Here is a function that sums its arguments
(%i1) sum_it_up([x]) := apply("+",x)$
(%i2) sum_it_up(1,2,3);
(%o2) 6
(%i3) sum_it_up();
(%o3) 0
(%i4) sum_it_up(a,b);
(%o4) b+a
If you want a function that has one or more arguments, try:
(the [x] argument must be last and there can only be one []
argument)
(%i5) sum_it_up_and_divide_by(z,[x]) := apply("+",x) / z$
(%i6) sum_it_up_and_divide_by(7,a,b,c,d);
(%o6) (d+c+b+a)/7
And for your example, try:
(%i10) f([x]) := apply("*", map("^",x, makelist(k,k,1,length(x))));
(%i11) f(a,b,c);
(%o11) a*b^2*c^3
(%i12) f();
(%o12) 1
(%i13) f(a);
(%o13) a
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To: maxima at math.utexas.edu
>From: Bart Vandewoestyne <Bart.Vandewoestyne at telenet.be>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 01/08/2008 07:59AM
>Subject: defining functions of s variables
>
>Dear list,
>
>As a newcomer to Maxima, I am trying to define a function of s
>variables.
>
>I know functions of multiple variables can be defined for example
>as follows:
>
>f(x,y) := x^1*y^2;
>
>I can then calculate for example mixed partial derivatives as
>follows:
>
>diff(f(x,y), x, 1, y, 1);
>
>Now my problem is that I want to be able to define functions of s
>variables, where s is a parameter defined by the user. For
>example (in *non-maxima* notation):
>
>f(x[1],...,x[s]) := x[1]^1*x[2]^2*...*x[s]^s;
>
> := product(x[i]^i);
>
>I then want to be able to compute certain partial derivatives of
>the s-dimensional functions I define.
>
>Is this at all possible with Maxima and what is the correct way
>of doing this?
>
>Thanks,
>Bart
>
>--
> "Share what you know. Learn what you don't."
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima