# Products of Differential Operators

I have a differential equation defined as the product of operators which I want to expand out into a polynomial in powers of $z\frac{d}{dz}$

$\qquad \prod_{n=1}^p(z\frac{d}{dz}+a_n)$

However when I try to code this using the D[#,x]& function it doesn't multiply out as I would wish it to. Instead each derivative just acts on the z rather that than $z\frac{d}{dz}$ and the whole thing just reduces to a number.

Do I need to define some special properties of an operator $z\frac{d}{dz}$?

I have considered trying to nest the operator but I am quite inexperienced and don't fully grasp how to do this whilst preserving the integrity of the operator.

• You can mark $z \frac{d}{dz}$ as $x$ and expand it as a regular polynomial since powers of $x$ commute with each other. However it will be interestion to find the general solution. – ybeltukov Jan 13 '15 at 16:33
• You should use Derivative instead of D and when defining that operator use SetDelayed (:=) rather than Set. Examine e.g. this answer Using D to find a symbolic derivative. – Artes Jan 13 '15 at 16:36
• There is a section in the notebook located here that discusses ways to work with products of differential operators. – Daniel Lichtblau Jan 13 '15 at 16:51

You could use Fold, e.g.

q[f_, x_, a_] := Expand@Fold[ x D[#1, x] + #2 #1 &, f, a];


Or rule replacement of polynomial as suggested in comment:

fun[f_, x_] := x D[f, x]
op[n_, f_, x_] := Nest[Expand@fun[#, x] &, f, n]
w[f_, x_, a_] := Module[{v, pol, r},
pol = Expand[Times @@ (v + # & /@ a)];
r = pol /. {Times @@ a -> (Times @@ a) f, v -> x D[f, x],
v^(s_) :> op[s, f, x]};
Expand[r]]


For example:

ar = Array[a, 4];
Grid[Table[{q[h[x], x, ar[[1 ;; j]]], w[h[x], x, ar[[1 ;; j]]]}, {j,
2, 4}], Frame -> All]