# I want to be able to define (a(x) d/dx + b(x))^n

I want to be able to define an operator

$(a(x) d/dx + b(x))^n$

where $d/dx$ is the derivative operator and $a(x)$ and $b(x)$ are known functions and $n$ is a positive integer.

$\prod_{i=1,...,n} (a_i(x) d/dx + b_i(x) )$

where $a_i(x)$ and $b_i(x)$ are known functions and $n$ is a positive integer ?

• I believe the result I was looking for was abderiv[n_] = Function[f, Nest[(a[x] D[#, x] + b[x] #) &, f, n]]; – Quasar Supernova Sep 13 '16 at 12:41
• ...and the answer to the related query is most easily accomplished by a recursive procedure: abderg[0, x_] := f[x] and abderg[n_, x_] := (a[x, n] D[abderg[n - 1, x], x] + b[x, n] abderg[n - 1, x]) – Quasar Supernova Sep 14 '16 at 1:02

This can be done with Nest:

abderiv[n_] =
Function[f, Nest[(a[x] D[#, x] + b[x]) &, f, n]];

abderiv[0][f[x]]

(* ==> f[x] *)

abderiv[1][f[x]]

(* ==> b[x] + a[x] Derivative[1][f][x] *)

abderiv[2][f[x]]

(*
==> b[x] +
a[x] (Derivative[1][b][x] + Derivative[1][a][x] Derivative[1][f][x] +
a[x] (f^\[Prime]\[Prime])[x])
*)


Here the order n is provided as the argument to a function that is itself a function acting on an arbitrary expression f. The assumption in the question seems to be that the differentiation variable is always x, so I don't specify this variable as an additional argument.

• Thanks so much. I want to trouble you with a rejoinder. – Quasar Supernova Aug 20 '16 at 4:35
• More generally, If I define a function of three variables F(X,Y,Z) [which can be anything my whim decides] I want it to be meaningful when a) X,Y,Z are (complex) numbers b) X,Y are square matrices and Z is a complex number (say) c) X = d/dx, Y = \int dx, Z = x – Quasar Supernova Aug 20 '16 at 4:36
• Maybe have a look at this question and adapt it to your whims. To give more specific advice, it would be best if you show what code you've already written so that the parameters of the question are less hazy. – Jens Aug 20 '16 at 5:10
• Sorry again. While the above question was just for kicks, I really need the answer to this now as I am working on something. It is a stupid question I admit but I am getting errors all over the place. – Quasar Supernova Aug 20 '16 at 5:49
• @QuasarSupernova You really ought to mark this as accepted and post a followup question. It's not good form to ask a question, get an answer, and then go "just kidding, that wasn't my question". – QuantumDot Aug 20 '16 at 18:16