# Solving $0=-\lambda \phi (t)^3+\mu ^2 \phi (t)+\phi ''(t)$

I happen to know that the equation $$0=-\lambda \phi (t)^3+\mu ^2 \phi (t)+\phi ''(t)$$ has a simple solution: $$\phi(t) = \frac{\mu \tanh \left(\frac{\mu \left(t-t_0\right)}{\sqrt{2}}\right)}{\sqrt{\lambda }}$$ which is easily verified:

Block[
{eqn, \[Phi]},
\[Phi][t_] := \[Mu]/Sqrt[\[Lambda]] Tanh[(\[Mu] (t - t0))/Sqrt[2]];
eqn = \[Phi]''[t] + \[Mu]^2 \[Phi][t] - \[Lambda] \[Phi][t]^3 == 0;
FullSimplify[eqn,
Assumptions -> And[\[Mu] > 0, \[Lambda] > 0, t > t0]]
]
Out[137]=True


But Mathematica has a hard time providing a useful solution. It gives some very strange functions which I cannot reduce in any way to the known solution. In fact if you plot them they look like the given solution, rotated by 90 degrees. Is there a way to get it to simplify? Do not suppose the form of the solution given above in your answer to the question. How could you use Mathematica to find it? Here is the present solution using DSolve:

$$\left\{\left\{\phi (t)\to -\frac{2 i c_1 \sqrt{\lambda } \sqrt{-\frac{1}{\mu ^2-\sqrt{\mu ^4-2 c_1 \lambda }}} \text{sn}\left(\frac{\sqrt{\mu ^2 t^2+\sqrt{\mu ^4-2 \lambda c_1} t^2+2 \mu ^2 c_2 t+2 \sqrt{\mu ^4-2 \lambda c_1} c_2 t+\mu ^2 c_2{}^2+\sqrt{\mu ^4-2 \lambda c_1} c_2{}^2}}{\sqrt{2}}|\frac{\mu ^2-\sqrt{\mu ^4-2 \lambda c_1}}{\mu ^2+\sqrt{\mu ^4-2 \lambda c_1}}\right)}{\mu ^2+\sqrt{\mu ^4-2 c_1 \lambda }}\right\},\left\{\phi (t)\to \frac{2 i c_1 \sqrt{\lambda } \sqrt{-\frac{1}{\mu ^2-\sqrt{\mu ^4-2 c_1 \lambda }}} \text{sn}\left(\frac{\sqrt{\mu ^2 t^2+\sqrt{\mu ^4-2 \lambda c_1} t^2+2 \mu ^2 c_2 t+2 \sqrt{\mu ^4-2 \lambda c_1} c_2 t+\mu ^2 c_2{}^2+\sqrt{\mu ^4-2 \lambda c_1} c_2{}^2}}{\sqrt{2}}|\frac{\mu ^2-\sqrt{\mu ^4-2 \lambda c_1}}{\mu ^2+\sqrt{\mu ^4-2 \lambda c_1}}\right)}{\mu ^2+\sqrt{\mu ^4-2 c_1 \lambda }}\right\}\right\}$$

Applying the chain rule \[Phi]''[t]==\[Phi]s[\[Phi]] \[Phi]s'[\[Phi]]the ode can be reduced to first order for \[Phi]s[\[Phi]]==\[Phi]'[t] .

From the initial ode we know \[Phi]''[0]==0( because \[Phi][0]==0 ) which implies \[Phi]s[\[0]]==0

sol = DSolve[{\[Phi]s[\[Phi]] \[Phi]s'[\[Phi]] + \[Mu]^2 \[Phi] - \[Lambda] \[Phi] ^3 == 0 ,\[Phi]s[0]\[Equal]0  }, \[Phi]s, \[Phi]]

(*{{\[Phi]s -> Function[{\[Phi]}, -(Sqrt[-\[Phi]^2 (2 \[Mu]^2 - \[Lambda] \[Phi]^2)]/Sqrt[2])]},
{\[Phi]s ->Function[{\[Phi]},Sqrt[-\[Phi]^2 (2 \[Mu]^2 - \[Lambda] \[Phi]^2)]/Sqrt[2]]}}*)


Transforming back into time space we get for t[\[Phi]]

Integrate[1/\[Phi]s[\[Phi]] /. sol, \[Phi] ]// Simplify[#, \[Phi] > 0] &
(*{-(ArcTan[Sqrt[-\[Mu]^2 + (\[Lambda] \[Phi]^2)/2]/\[Mu]]/\[Mu]), ArcTan[Sqrt[-\[Mu]^2 + (\[Lambda] \[Phi]^2)/2]/\[Mu]]/\[Mu]}*)


Dissolve after \[Phi] gives the expected solution!

Perhaps phasespace gives some more insight

Module[{},
Manipulate[
Show[{StreamPlot[{\[Phi]p, -\[Mu] \[Phi] + \[Lambda] \[Phi]^3}, {\
\[Phi], -Pi/2, Pi/2}, {\[Phi]p, 0, 1},
FrameLabel -> {"\[Phi]", "\[Phi]'[\[Phi]]"}],
ParametricPlot[
Evaluate[{(\[Mu] Tanh[(t \[Mu])/Sqrt[2]])/Sqrt[\[Lambda]],
D[(\[Mu] Tanh[(t \[Mu])/Sqrt[2]])/Sqrt[\[Lambda]],
t]}], {t, -Pi , Pi }, PlotStyle -> Red]}], {{\[Lambda], 1}, 0,
3, Appearance -> "Labeled"}, {{\[Mu], 1}, 0, 3,
Appearance -> "Labeled"} , ControlPlacement -> {Top }]
]


Red curve is the special solution (OP's simple solution) which separates stable and unstable regions (separatrix)

• Clever! Is there a name for this technique-- integrating factor or some such? Apr 20 at 16:31
• Perhaps "Separation of variables" but I'm unsure. See Autonomous in MathWorld/Weisstein Apr 20 at 16:34
• @Diffycue So when Ulrich uses the solution to derive the solution it's ok, but not Bob? (Ulrich uses \[Phi][0]==0, without which we get the general solution in terms of theta functions.) Apr 20 at 16:43
• @MichaelE2 One answer is helpful and the other is not. Is it so hard to see? Apr 20 at 16:54
• @Diffycue Yes, it is. Both are helpful. OTOH it is not hard to see that one is based on weaker hypotheses. It's also possible to solve the problem without any hypotheses. -- Ulrich is right to point out autonomous, which implies the order may be reduced as he showed. -- What's hard to see is why ask for a solution you already know? But motivations don't matter a lot to me. Apr 20 at 16:59

In general our equation can be rewritten as a first order ODE if we multiply it by $$\;\phi'(t)$$ and integrate once: $$0=-\lambda \phi (t)^3 \phi'(t)+\mu ^2 \phi (t) \phi'()t+\phi ''(t) \phi'(t)$$ $$0=-\frac{c_1}{4}-\frac{\lambda}{4} \phi (t)^4 +\frac{\mu ^2}{2} \phi(t)^2 +\frac{\phi'(t)^2}{2}$$ This is a standard technique of recasting certain autonomous nonlinear second order ODEs to first order ones, usually used in case of elliptic functions underlying behind.
Now we can rewrite it in the following way: $$\int\frac{ dt}{\sqrt{2}}=\int \frac{d w}{\sqrt{w^4 -2\mu ^2 w^2 +c}}$$ where $$w =\sqrt{\lambda}\; \phi\;$$ and $$c_1 \lambda =c$$. The rhs in general is an elliptic integral an cannot be calculated in terms of elementary functions (this Integrate[1/Sqrt[w^4 -2 \[Mu]^2 w^2 + c], w] // TraditionalForm yields

and an inverse function is an elliptic function expressed in terms of JacobiSN which we get when solving this ODE without initial conditions),

however for a special case when $$c=\mu^4$$ it might be reduced to $$\int \frac{d w}{w^2 -\mu ^2}=-\frac{arcth(\frac{w}{\mu})}{\mu}$$ and this is the case of the solution in the question.

Clear["Global*"]

eqn = ϕ''[t] + μ^2 ϕ[t] - λ ϕ[t]^3 == 0;

rule = ϕ -> (μ/Sqrt[λ] Tanh[(μ (# - t0))/Sqrt[2]] &);

eqn /. rule // Simplify

(* True *)


To get the desired form you need consistent initial conditions.

{ϕ0, ϕp0} = {ϕ[0], ϕ'[0]} /. rule

(* {-((μ Tanh[(t0 μ)/Sqrt[2]])/Sqrt[λ]),
(μ^2 Sech[(t0 μ)/Sqrt[2]]^2)/(Sqrt[2] Sqrt[λ])} *)


Using the initial conditions

sol = DSolve[{eqn, ϕ[0] == ϕ0, ϕ'[0] == ϕp0}, ϕ, t][[1]]

(* {ϕ -> Function[{t}, (μ Tanh[1/2 (Sqrt[2] t μ - Sqrt[2] t0 μ)])/
Sqrt[λ]]}8)

(ϕ[t] /. sol // Simplify) === (ϕ[t] /. rule)

(* True *)

• Maybe I misunderstand your solution, but I don't see how this contributes anything. Apr 20 at 16:14
• You asked how to get Mathematica to give the known solution. This shows that if you give initial conditions consistent with the desired solution then you will get the desired form. Apr 20 at 16:18
• But in generating those conditions it was required to use the known form, which was forbidden: "Imagine that you did not know the solution above but had the intuition that the result could not be too complicated.". This seems only to add an additional step in verifying the known answer. Apr 20 at 16:22
• There are an infinite number of solutions as shown in the general solution with the arbitrary constants. All of these solutions are correct; none are excluded until you specify some initial conditions. Without specifying consistent conditions there is no reason to prefer your desired form over any other. All you can then ask for is to verify that there exists a set of arbitrary constants that reduces the general solution to your desired solution. Apr 20 at 16:33

If we look up the Jacobi theta functions in the DLMF, we'll find limiting values not included in the expressions returned by DSolve. They lie on the closure of the solution manifold, and it is typical for the general solution returned by DSolve to be missing such special solutions.

Following the implicit advice of the DLMF, we can recover the complete solution.

eqn = ϕ''[t] + μ^2 ϕ[t] - λ ϕ[t]^3 == 0;
dsol = DSolve[{eqn}, ϕ, t];


Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

Length@dsol            (* two solutions *)
ϕ[t] /. dsol // Total  (* of opposite signs *)

(*
2
0
*)

phisol = ϕ[t] /. First@dsol // FullSimplify (* show just one *)


$$\frac{\displaystyle i\, \text{sn}\left(\frac{\sqrt{\left(\mu ^2+\sqrt{\mu ^4-2 \lambda c_1}\right) (t+c_2){}^2}}{\displaystyle \sqrt{2}}\,\Bigg|\,\frac{\displaystyle \mu ^4-\sqrt{\mu ^4-2 \lambda c_1} \mu ^2-\lambda c_1}{\lambda c_1}\right)}{\sqrt{\frac{\displaystyle \lambda }{\displaystyle -\mu ^2+\sqrt{\mu ^4-2 c_1 \lambda }}}}$$

One limiting value is the limit of $$\text{sn}(z,k)$$ as $$k\rightarrow1$$. This yields the solution the desired by the OP, if we clean it up with some assumptions about the parameters:

lim = Solve[(μ^4 - λ C[1] - μ^2 Sqrt[μ^4 - 2 λ C[1]])/(λ C[1]) == 1,
C[1]][[1, 1]]

(*  C[1] -> μ^4/(2 λ)  *)

Limit[phisol, lim] // Simplify[#, {λ, μ} ∈ PositiveReals] &


$$\frac{\mu \tanh \left(\frac{\mu \sqrt{(t+c_2){}^2}}{\sqrt{2}}\right)}{\sqrt{\lambda }}$$

The other limiting value is the limit of $$\text{sn}(z,k)$$ as $$k\rightarrow0$$. This yields a solution even simpler than the one desired by the OP, namely the trivial solution. This is impossible to solve for algebraically directly from the expression for $$k$$. Instead we solve for an ansatz and verify it.

(* numerator of k *)
Solve[μ^4 - λ C[1] - μ^2 Sqrt[μ^4 - 2 λ C[1]] == 0, C[1]]


Solve::nongen: There may be values of the parameters for which some or all solutions are not valid.

(*  {{C[1] -> 0}}  *)

(* limit of k *)
Limit[(μ^4 - λ C[1] - μ^2 Sqrt[μ^4 - 2 λ C[1]])/(λ C[1]),
C[1] -> 0,
Assumptions -> μ ∈ Reals]

(*  0  *)

• Super cool, thank you! The strategy here should be useful in all sorts of cases. Apr 20 at 17:43
• @Diffycue Usually it's the limit as C[1] (or C[2]` etc.) goes to infinity, but that limit doesn't exist here. Apr 20 at 17:47