1

I'm trying to solve the following ODE

$\frac{df}{dx}=-\sqrt{2}\left(\frac{1}{4}-2f(x)^{2}\right)$

In the text where it appears, the authors make a distinction into three cases: $f=-1/(2\sqrt{2})$, $f<-1/(2\sqrt{2})$ and $f>-1/(2\sqrt{2})$ depending on the sign of the right hand side of the equation. Further, $f(x)$ is a negative function.

When I give it into Mathematica with DSolve as

 DSolve[D[f[x],x]==-Sqrt[2]*(1/4-2*f[x]^2),f[x],x]

it only gives me the $\tanh$ solution, which according to the text corresponds to the case $f>-1/(2\sqrt{2})$. For the case $f<-1/(2\sqrt{2})$ I'm supposed to be getting a $\coth$ solution but don't see how.

Where are two other cases? Thank you for any help.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
GregVoit
  • 157
  • 8
  • 1
  • @Artes I wouldn't say it's closely related (I read through that thread before posting the question) since the case discussed there does have some initial data, which makes it possible to find an alternative way of finding other solutions, and I don't have any further conditions. – GregVoit Mar 08 '16 at 06:55
  • 1
    Even though you don't specify the initial data, to get different classes of solutions you should somehow make the system return desired solutions, if not by the initial value. In principle, this is a different aspect of the same issue. DSolve doesn't find all solutions, rather generic ones. – Artes Mar 08 '16 at 07:02
  • Can anyone show me how to do that? @Artes – GregVoit Mar 08 '16 at 07:22
  • 1
    You can use e.g. sols = (Table[ DSolve[D[f[x], x] == -Sqrt[2]*(1/4 - 2 f[x]^2) && f[0] == -(a/(2 Sqrt[2])), f[x], x], {a, -2, 0, 1/2}] // Quiet // Simplify // Flatten)[[All, 2]]; Plot[sols, {x, -2, 2}, Evaluated -> True] and compere the plots with e.g. Plot[{Tanh[x], Coth[x]}, {x, -2, 2}, Evaluated -> True]. In the first case you got both corresponding cases. – Artes Mar 08 '16 at 07:25
  • If you want all cases plot this Join[sols, {-(1/(2 Sqrt[2]))}]. – Artes Mar 08 '16 at 07:38
  • @Artes thank you! One question: how did you come up with the initial data $f(0)=-a/(2\sqrt{2})$? – GregVoit Mar 08 '16 at 08:59
  • 1
    We want solutions from different classes, thus we are varying a in such a way with Table to include solutions from the both classes. – Artes Mar 08 '16 at 09:21
  • @Artes: I have looked up your reference "closely related" which I find indeed closely related. I have put the following comment there: "I see no reason to worry. There is no problem in letting the constant of Integration C[1] go to infinity. Infinity is just one point in the complex plane. Then the general solution collapses into the "expected" simple exponential." The same limit in our present example leads to the completely valid constant solution f = - 1/(2 Sqrt(2)). – Dr. Wolfgang Hintze Mar 08 '16 at 12:00

2 Answers2

4

EDIT

Sorry. I have made a mistake in the choice of the initial conditions which is corrected below. This error does not change the general staetements.

Corrected exposition

As far as I can see there is no problem with the completeness of the solutions provided by Mathematica.

$Version

(* Out[16]= "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)

The general solution to the ODE is found by Mathematica to be

sol = DSolve[f'[x] == -Sqrt[2] (1/4 - 2 f[x]^2), f[x], x]

(* Out[2]= {{f[x] -> -((-1 + E^(2 x + 4 Sqrt[2] C[1]))/(
    2 Sqrt[2] (1 + E^(2 x + 4 Sqrt[2] C[1]))))}} *)

As expected, the solution contains one arbitrary constant C[1].

The two branches of the solution correspond just to different choices of C[1].

Notice also that C[1] can be a complex number.

Let us have closer look on the situation.

The critical value of the function is

fc = -(1/(2 Sqrt[2]));

Now we complete the problem by imposing an initial condition on f.

And we distinguish two cases (here I am correcting my mistake of not imposing the condition of on the module)

(1) Abs[f[0]] < Abs[fc]:

ff1[x_] = f[x] /. 
  DSolve[f'[x] == -Sqrt[2] (1/4 - 2 f[x]^2) && f[0] == 1/4, f[x], x][[1]]

During evaluation of In[12]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

    (* Out[14] = -((1 - 3 E^(2 x) + 2 Sqrt[2] E^(2 x))/(
 2 Sqrt[2] (-1 - 3 E^(2 x) + 2 Sqrt[2] E^(2 x))))    *)

(2) Abs[f[0]] > Abs[fc]:

ff2[x_] = f[x] /. 
  DSolve[f'[x] == -Sqrt[2] (1/4 - 2 f[x]^2) && f[0] == 2, f[x], x][[1]]

During evaluation of In[14]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>

(* Out[15] = -((-7 - 9 E^(2 x) + 4 Sqrt[2] E^(2 x))/(
 2 Sqrt[2] (7 - 9 E^(2 x) + 4 Sqrt[2] E^(2 x)))) *)

and compare the results in a plot:

Plot[{ff1[x], ff2[x]}, {x, 0, 3}, 
 PlotLabel -> "Solution of ODE\nblue curve = ff1, yellow curve = ff2",
  PlotRange -> {-2, 2}]

enter image description here

Summarizing: Mathematica in fact provides the general solution. This includes automatically the cases mentioned in the OP which correspond just to different initial conditions.

Dr. Wolfgang Hintze
  • 13,039
  • 17
  • 47
1

If we solve for a general initial condition at x == 0, we get the following:

dsol = DSolve[{D[f[x], x] == -Sqrt[2]*(1/4 - 2*f[x]^2), f[0] == F0}, f, x];
{dsol} = dsol /. 
  HoldPattern@Function[v_, body_] :> Function @@ {v, FullSimplify[body]}

Solve::ifun: Inverse functions are being used.... >>

(*
  {{f -> Function[{x}, (4 F0 Cosh[x] - Sqrt[2] Sinh[x]) / 
     (4 Cosh[x] - 8 Sqrt[2] F0 Sinh[x])]}}
*)

You can see the solution contains all three cases (for a negative f) as follows:

Reduce[F0 < 0 && f[x] < 0 && y == f[x] /. dsol, {F0, x, y}, Reals, 
    Backsubstitution -> True] /. Or | And -> List /. 
  x > _ :> Sequence[] // Grid

Mathematica graphics

Whether to write the nontrivial solutions in terms of Tanh or Coth, or even as above, seems a matter of taste.

-Sqrt[2]/4 Tanh[x - ArcTanh[4 F0/Sqrt[2]]] - f[x] /. dsol // TrigExpand // Simplify
-Sqrt[2]/4 Coth[x - ArcCoth[4 F0/Sqrt[2]]] - f[x] /. dsol // TrigExpand // Simplify
(*  0  *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • In V13, DSolve[D[f[x], x] == -Sqrt[2]*(1/4 - 2*f[x]^2), f[x], x, IncludeSingularSolutions -> True] now gives answers that include the limiting values as the constant of integration C[1] approaches zero and infinity. – Michael E2 Jul 21 '22 at 23:43