I am trying to compose functions of xleft, maybe like xleft[xleft[f]] or even higher order. And here is my function:

xleft := Function [{f}, D[f[x, y, z], x] - y*D[f[x, y, z], z]/2]

But I couldn't make it work like xleft[xleft[f]] since I guess there are problems of mapping different dimensions. Can somebody help me ?


1 Answer 1


All you have to do is to be consistent about using only expressions as arguments to the operator, not function heads. The reason is that the operator as you define it returns an expression and not a function. That's why you then cannot apply the operator twice. But by working only with expressions, this problem is avoided:

xleft = Function[f, D[f, x] - y  D[f, z]/2];

xleft[f[x, y, z]]

$f^{(1,0,0)}(x,y,z)-\frac{1}{2} y f^{(0,0,1)}(x,y,z)$

xleft[xleft[f[x, y, z]]]

$-\frac{1}{2} y f^{(1,0,1)}(x,y,z)-\frac{1}{2} y \left(f^{(1,0,1)}(x,y,z)-\frac{1 }{2} y f^{(0,0,2)}(x,y,z)\right)+f^{(2, 0,0)}(x,y,z)$

Now you can apply the operator as many times as you like. The only difference in the application is that the argument f has to be replaced by f[x,y,z].

Alternatively (but I'd prefer the first approach), you could also work only with functions and not with expressions:

xleft = Function[f, 
   Function[{x, y, z}, D[f[x, y, z], x] - y D[f[x, y, z], z]/2]];

xleft[xleft[f]][x, y, z]

$-\frac{1}{2} y f^{(1,0,1)}(x,y,z)-\frac{1}{2} y \left(f^{(1,0,1)}(x,y,z)-\frac{1 }{2} y f^{(0,0,2)}(x,y,z)\right)+f^{(2, 0,0)}(x,y,z)$

Here, the operator returns a function but then you have to evaluate the result by giving it back the arguments at the end.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.