I have a function which is a function of some scalar variables called :$x,y,t,\rho$ I want to calculate its derivative in the form of : $(\partial_{t}-\partial_{z})^m (\partial_{x} -\partial_{y})^n$ where $m$ and $n$ could be 1,2,3,4 each time.How I can get this derivative correctly?To say the whole thing once: $(\partial_{t}-\partial_{z})^m (\partial_{x} -\partial_{y})^n f(x,y,t,\rho)$,Could anybody help me?
1 Answer
In a comment, Hans Olo stated that the powers used in the notation are intended to indicate the number of times the differential operators are applied. I would then also assume that the product shown is intended to reflect concatenation of the operators. If that is the case, a nested Nest
is needed
Clear["Global`*"]
dOp[func_, m_, n_] :=
Nest[(D[#, x] - D[#, y]) &, Nest[(D[#, t] - D[#, ρ]) &, func, m], n]
For example,
dOp[f[x, y, t, ρ], 0, 0]
(* f[x, y, t, ρ] *)
dOp[f[x, y, t, ρ], 0, 1]
dOp[f[x, y, t, ρ], 1, 0]
dOp[f[x, y, t, ρ], 2, 2]
z
is intended to be with respect toρ
thender[m_, n_] = ((D[#, t] - D[#, ρ])^m*(D[#, x] - D[#, y])^n) &@f[x, y, t, ρ];
$\endgroup$Nest
$\endgroup$