Subject: how to define the composition of functions
From: Barton Willis
Date: Tue, 5 May 2009 09:47:43 -0500
You'll find suggestions in the Maxima mailing list; search
"compose functions" in
http://maxima.sourceforge.net/maximalist.html
To define "o" to be an infix composition function, use infix("o").
Try something like
(%i14) infix("o")$
Taken from to_poly_solver.mac:
(%i17) compose_functions(l) := block([z : ?gensym(), f],
if listp(l) then (
l : reverse(l),
f : z,
for lk in l do f : funmake(lk, [f]),
buildq([z,f], lambda([z], f)))
else error("The argument to 'compose_functions' must be a list."))$
(%i19) "o"(p,q) := compose_functions([p,q])$
(%i20) p o q;
(%o20) lambda([g33538],p(q(g33538)))
Ouch! Maxima doesn't know the function algebra:
(%i22) f : p o q - q o p;
(%o22) lambda([g33541],p(q(g33541)))-lambda([g33542],q(p(g33542)))
(%i23) f(x);
f evaluates to lambda([g33541],p(q(g33541)))-lambda([g33542],q(p(g33542)))
Improper name or value in functional position.
Barton
maxima-bounces at math.utexas.edu wrote on 05/05/2009 08:58:20 AM:
> [image removed]
>
> [Maxima] how to define the composition of functions
>
> Kursat Aker
>
> to:
>
> maxima
>
> 05/05/2009 08:59 AM
>
> Sent by:
>
> maxima-bounces at math.utexas.edu
>
>
> Hello,
>
> I would like to know how one can define the composition of functionsin
maxima.
> Say,
> p( psi ) := diff( psi, x);
> q( psi ) := x*psi;
> How can I define a composition operator, say o ?
> I would like to define the lie bracket on the space one-variable
functions.
> Thanks,
> kursat
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima