MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Differential operators, Help

In a message dated 9/23/2000 4:03:07 AM, wkb at writes:

>This should be relatively easy, but after several tries I have not been
>to do it.
>I want define a differential operator in the following way. Let Dx and
>denote the operators for first and second order differentiation with respect
>to x. I want P to be an operator which depends on x,  Dx and Dx2.
>For example, with
>                  P = Dx2 + x Dx
>I want P[f[z],z] = f''[z] + z f'[z].
>This much I can do, but I cannot find a method which also gives the
>following result,
>P[ P[f[z],z], z]  -> (f''[z] + z f'[z])''+ z (f''[z] + z f'[z])'
>Or more generally, if I have two such operators P and Q I want the correct
>result from expressions such as
>      P[ Q[f[x],x], x]

P[expr_, x_Symbol:x] := D[expr, {x, 2}] + x*D[expr, x];

Q[expr_, x_Symbol:x] := D[expr, {x, 2}] - 2x^2*D[expr, x];

P[f[z], z]

z*Derivative[1][f][z] + Derivative[2][f][z]

P[P[f[z], z], z] // Simplify

z*Derivative[1][f][z] + (2 + z^2)*Derivative[2][f][z] + 
  2*z*Derivative[3][f][z] + Derivative[4][f][z]

D[f''[z] + z f'[z], {z, 2}] + z *D[f''[z] + z f'[z], z] == % // Simplify


P[ Q[f[x]]]

-4*Derivative[1][f][x] - 8*x*Derivative[2][f][x] - 
  2*x^2*Derivative[3][f][x] + 
  x*(-4*x*Derivative[1][f][x] - 2*x^2*Derivative[2][f][x] + 
    Derivative[3][f][x]) + Derivative[4][f][x]

Bob Hanlon

  • Prev by Date: Re: About N in Mathematica 4
  • Next by Date: RE: Differential operators, Help
  • Previous by thread: Differential operators, Help
  • Next by thread: RE: Differential operators, Help