composition of functions



On Thursday 11 September 2008 21:53:00 Wolfgang Lindner wrote:
> dear list,
>
> is there a recommended way to do the composition of functions?
> Currently I do the following, but it becomes 'ugly' doing the
> composition of more than 2 functions:
>
> (%i93) comp(g,f,x):=limit(g,x,f);      /* (g o f)(x) := g(f(x)) */
> (%i94) comp(sqrt(1-x^2),sqrt(x) ,x);
> (%o94) sqrt(1-x)
> (%i95) comp(asin(x),sin(x) ,x);
> (%o95) x
>
> Is it ok to use Maxima's limit function for that?
> What is your advice, please?

Strictly speaking, you deal with expressions, not functions.
And it looks like a work for "at":

  (%i1) comp(g,f,x) := at(g,x=f)$
  (%i2) comp(sqrt(1-x^2),sqrt(x),x);
  (%o2) sqrt(1-x)
  (%i3) comp(asin(x),sin(x),x);
  (%o3) x

-- 
Prickle-Prickle, Bureaucracy 35, 3174 YOLD
Alexey Beshenov http://beshenov.ru/