1
$\begingroup$

I have a very simple question.

If I have a polynomial in x say, $f(x)$, how to construct the differential operator $f(\frac{d}{dx})$?

Failed Attempt:

In[739]:= f[x] = a0 + a1*x + a2*x^2 + a3*x^3;

f[x] /. {x -> Function@D[#, x], x^n_ -> Function@D[#, {x, n}]}

Out[740]= a0 + a1 (\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]#1\) &) + a2 (\!\(
\*SubscriptBox[\(\[PartialD]\), \({x, 2}\)]#1\) &) + a3 (\!\(
\*SubscriptBox[\(\[PartialD]\), \({x, 3}\)]#1\) &)
$\endgroup$
3
  • $\begingroup$ If $f(x)=2$, do you want $f(\frac{d}{dx})(x)$ to be $2x$ or $2$? $\endgroup$
    – Carl Woll
    Apr 15 '18 at 14:48
  • $\begingroup$ @Carl Woll I want it to be $2$ $\endgroup$
    – Subho
    Apr 15 '18 at 21:10
  • $\begingroup$ Ok, thanks, then my differential operator paclet would not be of interest to you. $\endgroup$
    – Carl Woll
    Apr 15 '18 at 21:20
3
$\begingroup$
f[x] = a0 + a1*x + a2*x^2 + a3*x^3;
f1[x_] = (f[x] /. {x -> D[#, x], x^n_ -> D[#, {x, n}]}) &;
f1[x][Exp[m x]]

a0 + a1 E^(m x) m + a2 E^(m x) m^2 + a3 E^(m x) m^3

$\endgroup$
2
$\begingroup$

Rules can be shortened using the _. pattern. A function can be defined as

g[y_] := f[x] /. {x^n_. -> D[y, {x, n}]}

For example, g[x^4] gives

a0 + 4*a1*x^3 + 12*a2*x^2 + 24*a3*x

$\endgroup$
1
  • $\begingroup$ ha ha, I am 10 seconds early :) $\endgroup$
    – Sumit
    Apr 15 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.