I need to define a multivariable differential equation of the type
$$
\mathcal{D}=\Theta_1^2-z_1(-\Theta_1+\Theta_2+\Theta_3+\Theta_4)(1+\Theta_1+\Theta_2+\Theta_3+\Theta_4)\\
\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;-z_1(z_2+z_3+z_4)(1+\Theta_1+\Theta_2+\Theta_3+\Theta_4)(2+\Theta_1+\Theta_2+\Theta_3+\Theta_4)
$$
where $\Theta_k=z_k\partial_{z_k}$.
I have tried to define each paranthesis as their own operator and compose all the operators with one another:
Θ[f_, k_] := k*D[f, k]
d1[k_, z1_, z2_, z3_, z4_] := (k # + Θ[#, z1] + Θ[#, z2] + Θ[#, z3] + Θ[#, z4]) &
d2[k_, z1_, z2_, z3_, z4_] := (Θ[#, z1] + Θ[#, z2] + Θ[#, z3] + Θ[#, z4] - 2 Θ[#, k]) &
D1[z1_, z2_, z3_, z4_] := (Θ[Θ[#, z1], z1]-z1 d2[z1, z1, z2, z3, z4]@d1[1, z1, z2, z3, z4]-z1 d1[1, z1, z2, z3, z4]@d1[2, z1, z2, z3, z4]) &
D1[z1, z2, z3, z4]@f[z]
Which produces the undesired output
(-z1)*((-z1)*(Derivative[0, 1][Θ][#1, z1] & ) + z2*(Derivative[0, 1][Θ][#1, z2] & ) + z3*(Derivative[0, 1][Θ][#1, z3] & ) +
z4*(Derivative[0, 1][Θ][#1, z4] & )) - z1*((2*#1 + Θ[#1, z1] + Θ[#1, z2] + Θ[#1, z3] + Θ[#1, z4] & ) +
z1*(Derivative[0, 1][Θ][#1, z1] & ) + z2*(Derivative[0, 1][Θ][#1, z2] & ) + z3*(Derivative[0, 1][Θ][#1, z3] & ) +
z4*(Derivative[0, 1][Θ][#1, z4] & )) + z1*(Derivative[1, 0, 0, 0][f][z1, z2, z3, z4] + z1*Derivative[2, 0, 0, 0][f][z1, z2, z3, z4])
How can one define a differential operator that is the product of two or more (generally) different differential operators?
Times
for other than scalars since for examplex
andd/dx
(asD[#,x]&
) do not commute as operators. $\endgroup$