[Maxima] how to define mathematical operators?

Barton Willis willisb at unk.edu
Mon Dec 1 06:41:54 CST 2008


-----maxima-bounces at math.utexas.edu wrote: -----

>(%i1) infix("@");
>(%o1) @
>(%i2) "@"(f,g):=f(g);
>(%o2) f @ g:=f(g)
>(%i3) H(V):=lambda([f],diff(f(x),x)+V*f(x));
>(%o3) H(V):=lambda([f],diff(f(x),x)+V*f(x))
>(%i4) H(W)@lambda([x],%psi(x));
>(%o4) %psi(x)*V+'diff(%psi(x),x,1)
>
>Here I would like to see %psi(x)*W+'diff(%psi(x),x,1) with W instead of V.

Try using buildq to define H:

 (%i3) H(V):= buildq([V], lambda([f],diff(f(x),x)+V*f(x)));
 (%o3) H(V):=buildq([V],lambda([f],diff(f(x),x)+V*f(x)))

 (%i4) H(W)@lambda([x],%psi(x));
 (%o4) %psi(x)*W+'diff(%psi(x),x,1)

The user documentation for buildq has some nice examples.

Barton




More information about the Maxima mailing list