On Friday 28 November 2008 05:57:23 Jose A. Vallejo wrote:
> I am trying to do some work related to Quantum Mechanics with
> Maxima. I want to define a mathematical operator which acts on a
> function and returns another function. The operator computes the
> derivative of a function f(x) and adds the result to the function
> multiplied by a constant V (eventually, V could be another function
> of x): f -> df/dx+Vf.
> Of course, I could define
> H(V,f):=diff(f(x),x)+V*f(x)
> but this is not what I want. I want to be able to define H(V) and
> then to make it act on a function.
> In Mathematica I would do
> H[V_]@f_:=D[f,{x,2}]+Vf
> so I suppose that I am asking for an equivalent of Mathematica's @.
> I will appreciate any help on this.
(%i1) prefix ("h")$
(%i2) "h" (f) := diff(f(x),x) + V*f(x)$
(%i3) h lambda ([x], x^3);
3 2
(%o3) x V + 3 x
(%i1) infix ("@")$
(%i2) "@" (f,g) := f(g)$
(%i3) h (V) := lambda ([f], diff(f(x),x) + V*f(x))$
(%i4) h (V) @ lambda([x], x^3);
3 2
(%o4) x V + 3 x
Is it useful here?
--
Boomtime, Aftermath 40 YOLD 3174
Alexey Beshenov http://beshenov.ru/