composition of functions.



Your function 'a' requires three  inputs. The output of function 'b' is a list with three members. Thus a(b(x,y,z)) is bogus because
the function 'a' receives only one input (that happens to be a list with three members).  Two choices:

(1) Either call function 'a' using 'apply'

   (%i7) apply('a, b(x,y,z));
   (%o7) [-y-x,x,z+2*y]

(2) Define your function 'a' to take one list as its input:

  (%i8) aa(l) := [-first(l), first(l)+second(l), third(l)];
  (%o8) aa(l):=[-first(l),first(l)+second(l),third(l)]

  (%i9) aa(b(x,y,z));
  (%o9) [-y-x,x,z+2*y]

To read the user documentation for apply, input '? apply'


--Barton
________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Jianrong Li [lijr07 at gmail.com]
Sent: Wednesday, November 21, 2012 07:16
To: maxima-request at math.utexas.edu; maxima at math.utexas.edu
Subject: composition of functions.

Dear all,

I want to compute compositions of functions. I define

a(x, y, z):= [-x, x+y, z];
ee(x,y,z):=p^(x)*q^(y)*r^(z);
b(x, y, z):=[x+y, -y, 2*y+z];
c(x, y, z):=[x, y+z, -z];

s2:ee(a(b(a(b(c(b(a(b(x, y, z)))))))));

Then it has errors "Too few" arguments supplied to a(x,y,z); found: [[y+x,-y,z+2*y]]
 -- an error.

How can I define the functions correctly? Thank you very much.

Best wishes,
Jianrong.