# Evaluate coefficients of delta functions in a given expression

Suppose that I have a function of the form:

myfn[x_] = smoothfn[x] + A[x] DiracDelta[x-x0] + B[x] DiracDelta'[x-x0],


where smoothfn is some smooth function.

It is a well-known result that for any smooth function $$F(x)$$, we have the following properties:

$$F(x) \delta(x-x_0) = F(x_0) \delta(x-x_0), \qquad \qquad \qquad \qquad F(x) \delta'(x-x_0) = -F'(x_0) \delta(x-x_0) + F(x_0) \delta'(x-x_0).$$

(This can be checked by integrating both sides against an arbitrary test function). I would like to implement a function in Mathematica, myop, that takes a function as its first argument (presumably one would need to reserve a second argument to tell it what the variable is) and returns the function so that all the coefficients in front of the Dirac functions (and their derivatives) are evaluated at $$x_0$$. In the above example, I would want something of the type:

myop[myfn[x],x]
(* Out: smoothfn[x] + (A[x0]-B'[x0]) DiracDelta[x-x0] + B[x0] DiracDelta'[x-x0] *)


Is there a simple way to achieve this?

• That second case looks wrong. Should only be the F'[x_0] term, and that negated (derived by IBP). Example:In[87]:= Integrate[f[x]*DiracDelta'[x - 2], {x, -Infinity, Infinity}] Out[87]= -Derivative[1][f][2] May 12 at 15:47
• @DanielLichtblau: The expression Integrate[f[x]*DiracDelta'[x - 2], {x, -Infinity, Infinity}] makes no sense in traditional math. May 12 at 20:02
• @DanielLichtblau Sorry, corrected the typo. May 12 at 22:37
• @user64494 It makes as much sense as same but sans the prime. And I would be careful with a term like “traditional math”. It is simply unclear what assumptions are being made e.g. about f[x]. May 13 at 16:39