# Validating a solution for a differential equation with DiracDelta

For the following differential equation

$$\displaystyle-\frac{∂ ^2\phi2 (x)}{∂ x^2}+λ ~[\phi2 (x)]^3-\mu ^2~\phi2 (x)=\phi2(x)~δ(x)$$

-D[ϕ2[x], {x, 2}] - μ^2*ϕ2[x] + λ*ϕ2[x]^3 == ϕ2[x]*DiracDelta[x]


One possible solution for $$\phi2[x]$$ is given by $$\text{\phi 2}(\text{x})\text{:=}\displaystyle\frac{\mu \tanh \left(\frac{\mu \sqrt{x^2}}{\sqrt{2}}\right)}{\sqrt{λ }}$$

ϕ2[x_] := (μ/Sqrt[λ])*Tanh[(Sqrt[x^2]*μ)/Sqrt[2]]


The following command (hopefully?) validates the solution:

Simplify[-D[ϕ2[x], {x, 2}] - μ^2*ϕ2[x] + λ*ϕ2[x]^3 == ϕ2[x]*DiracDelta[x]]

(*True*)


Apparently, another identity/solution is when the RHS is replaced by $$a~constant~~\times~ δ(x)$$

When trying to validate this in MMa, the following doesn't seem to work:

Simplify[-D[ϕ[x], {x, 2}] - μ^2*ϕ[x] + λ*ϕ[x]^3 == constant1*DiracDelta[x]]

(*0 == constant1*DiracDelta[x]*)


Is there a trick here, or is the earlier "validation" of $$\phi2(x)~δ(x)$$ as a solution itself misleading?

Note that $$\sqrt{x^2}$$ is being used for $$|x|$$, since MMa's Abs[x] didn't work for the validation.

• Up to Wiki en.wikipedia.org/wiki/Distribution_(mathematics), the product $\phi2(x)~\delta(x)$ is defined if $\phi2(x)$ is a smooth function. Therefore, $\text{$\phi $2}(\text{x})\text{:=}\displaystyle\frac{\mu \tanh \left(\frac{\mu \sqrt{x^2}}{\sqrt{2}}\right)}{\sqrt{\lambda }}$, not being smooth at the origin, is not any solution of the ODE under consideration. – user64494 Jun 19 '19 at 17:57

I don't think, that it is allowed to check an ode with DiracDelta pointwise. Though the first True of your simplification must be wrong.

The general solution fullfills -D[\[Phi]2[x], {x, 2}] - \[Mu]^2*\[Phi]2[x] + \[Lambda]*\[Phi]2[x]^3==0 , x>0 . Dirac only forces a sudden change of the initial conditions.

Integrate your ode in a small range Element[x, {-\[CurlyEpsilon], \[CurlyEpsilon]}]

-\[Phi]2'[\[CurlyEpsilon]]+\[Phi]2'[-\[CurlyEpsilon]]+ 2\[CurlyEpsilon](-\[Mu]^2*\[Phi]2[0] + \[Lambda]*\[Phi]2[0]^3) ==\[Phi]2[0]


Limit \[CurlyEpsilon] -> 0 gives the new initial condition

\[Phi]2'[SuperPlus[0]]==\[Phi]2'[0]-\[Phi]2[0] (*RHS \[Phi][x] DiracDelta[x]*)

\[Phi]2'[SuperPlus[0]]==\[Phi]2'[0]-\[Phi]2[0] (*RHS 1  DiracDelta[x]*)

• Thank you Ulrich. I am trying to trace the exact commands. What would be the command in MMa to perform the following (or the equivalent you suggested), to get from $\int_{-b}^{b} \phi2^{\prime \prime}(x) -a^{2}\int_{-b}^{b} \phi2(x) = k~\int_{-b}^{b} \phi2(x)~\delta(x)$ So that it leads to (LHS) = $\lim_{b\to 0}\,\phi^{\prime}(b) - \phi2^{\prime}(- b)=[\phi2^{\prime}(0)]$ and (RHS) = $k~\int_{-b}^{b} \phi(x)~\delta(x) = k~\phi2(0)$ = $[\phi2^{\prime}(0)]=k\,\phi2(0)$ = $\phi2(x)~=~A~e^{\mp~a~|x|}$ – user58293 Jan 19 '19 at 13:59
• @user58293 Is this a new question/new ode?The initialvalue problem \[Phi]''[x] - a^2 \[Phi][x] == k \[Phi][x] \[Delta][x], \[Phi][0] == \[Phi]0, \[Phi]'[0] == \[Phi]p0 is "equivalent" to \[Phi]''[x] - a^2 \[Phi][x] == 0, \[Phi][0] == \[Phi]0, \[Phi]'[0] == \[Phi]p0+k \[Phi][0] The new initial conditions follows from integrating the ode. – Ulrich Neumann Jan 19 '19 at 14:11
• What's the command to go from integration with limits, and get the "new" initial condition that contains "Superplus"? The modified question in the comment is to try and capture (perhaps) a slightly more common/general case and ensure that my MMa command inputs are exactly as you intended. Thanks again Ulrich! – user58293 Jan 19 '19 at 14:35
• The command is Integrate["ode" ,{x,-b,b},Assumption->b>0 ] with following Limit[...,b->0]. Thereby you have to help MMA a little bit to integrate the LHS. – Ulrich Neumann Jan 19 '19 at 14:37
• My apologies, the steps/commands are still not obvious to me. – user58293 Jan 20 '19 at 0:21

For the second question(see comment) proceed as follows:

initial value problem

 {Derivative[2][\[Phi]][x] - a^2*\[Phi][x] ==  k*\[Phi][x]*DiracDelta[x],
\[Phi][0]==\[Phi]0,\[Phi]'[0]==\[Phi]p0}


integrating the ode in the range -b

 Derivative[1][\[Phi]][b]-Derivative[1][\[Phi]][-b]+  2 b a^2*\[Phi][2]
==k*\[Phi][0]


Limit b->0

Derivative[1][\[Phi]][b]-Derivative[1][\[Phi]][-b] ==k*\[Phi][0]


Here you can see the sudden change of Derivative[1][[Phi]][x] due to the Dirac-impuls!

The equivalent initial value problem is

{Derivative[2][\[Phi]][x] - a^2*\[Phi][x] ==0 ,
\[Phi][0]==\[Phi]0,\[Phi]'[0]==\[Phi]p0 +k *\[Phi][0]}


can be solved easily

DSolve[{Derivative[2][\[Phi]][x] - a^2*\[Phi][x] ==0, \[Phi][0] == \[Phi]0, \[Phi]'[0] == \[Phi]p0 +k*\[Phi][0]}, \[Phi], x][[1]]
(*{\[Phi] ->Function[{x}, (E^(-a x) (a \[Phi]0 + a E^(2 a x) \[Phi]0 - k \[Phi]0 +E^(2 a x) k \[Phi]0 - \[Phi]p0 + E^(2 a x) \[Phi]p0))/(2 a)]}*)