I have troubles finding a solution to a system of three coupled nonlinear ODEs. When I put it into Mathematica, I get back the input as an answer. Could anyone tell me what I'm doing wrong?

Here is the code

DSolve[{D[f[x], x] == I*Sqrt[2]*g[x], 
D[g[x], x] == 2*Sqrt[2]*g[x]*h[x], 
D[h[x], x] == I*(Sqrt[2]/2)*f[x]*h[x]/g[x]}, {f, g, h}, x]

Thank you for any help

P.S: I know that the closed form solution exists, I'm just trying to find it myself using Mathematica. The solution should be $f(x)=-A\cos x$, $g(x)=-\frac{1}{\sqrt{2}}iA\sin x$, $h(x)=\frac{1}{2\sqrt{2}}\cot x$, where $A$ is a const.

I can check that this is a true solution by direct inspection, but I want to know how to get it to start with.

  • $\begingroup$ duplicate question? mathematica.stackexchange.com/questions/50758/… $\endgroup$
    – m00nlight
    Sep 29, 2015 at 7:40
  • $\begingroup$ @m00nlight I don't think it's a duplicate since the question you linked is not about the coupled ODEs. There were questions similar to mine asked here (I checked) but none of them got the answer I'm afraid, apart form suggestions that there are no solutions in closed form $\endgroup$
    – GregVoit
    Sep 29, 2015 at 7:51
  • $\begingroup$ @GregVoit If you know that it exists, may be you know something about these solutions and, thus, can help Mma somehow? Such as, say, by transforming your equations using your knowledge. Think about it. $\endgroup$ Sep 29, 2015 at 8:32
  • $\begingroup$ @AlexeiBoulbitch I already tried everything I could I'm afraid, before posting a question here. That's why I'd be grateful for any specific hints - everything I thought I could try I already tried $\endgroup$
    – GregVoit
    Sep 29, 2015 at 8:42
  • 1
    $\begingroup$ Another solution is: h(x)=0, g(x)=C[1], f(x)= I*Sqrt(2)*C[1]*x+C[2]. $\endgroup$ Sep 29, 2015 at 17:40

1 Answer 1


If you know that it exists, may be you know something about these solutions and, thus, can help Mma somehow? Such as, say, by transforming your equations using your knowledge.

You may operate as follows: you may introduce

G[x]=Log[g[x]]; H[x]=Log[h[x]]






From here you easily get


Let us do all this using Mma. These are the equations:

eq1 = g'[x] == 2*Sqrt[2]*h[x]*g[x];
eq2 = h'[x] == (I*f[x]*h[x])/(Sqrt[2]*g[x]);
eq3 = f'[x] == I*Sqrt[2]*g[x];

Now, let us transform them as follows:

eq1A = eq1 /. {g -> (Exp[G[#]] &), h -> (Exp[H[#]] &)} // 
  Simplify[#, G[x] != 0] &
eq2A = eq2 /. {g -> (Exp[G[#]] &), h -> (Exp[H[#]] &)} // 
  Simplify[#, {G[x] != 0, H[x] != 0}] &
eq3A = eq3 /. {g -> (Exp[G[#]] &), h -> (Exp[H[#]] &)} // 
  Simplify[#, {G[x] != 0, H[x] != 0}] &

which gives

2 Sqrt[2] E^H[x] == Derivative[1][G][x]

-I Sqrt[2] f[x] + 2 E^G[x] Derivative[1][H][x] == 0

Derivative[1][f][x] == I Sqrt[2] E^G[x]

Then let us get the derivative of the both parts of eq2A:

eq2B = Map[D[#, x] &, eq2A]

(*  -I Sqrt[2] Derivative[1][f][x] + 
  2 E^G[x] Derivative[1][G][x] Derivative[1][H][x] + 
  2 E^G[x] (H^\[Prime]\[Prime])[x] == 0  *)

Now let us eliminate from this system f' and G':

Eliminate[{eq3A, eq2B, eq1A}, {f'[x], G'[x]}] // 
 Simplify[#, {G[x] != 0, H[x] != 0}] &

I show the result as a picture, to see it better:

enter image description here

Now one can solve it:

     eq1 = H''[x] == -1 - 2 Sqrt[2]*H'[x]*Exp[H[x]]
   sol = DSolve[eq1, H[x], x]


(* {{H[x] -> 
   1/2 (-x^2 - 2 x C[1] - 
      2 Log[2 Sqrt[
         2] (-C[2] + 
           E^(C[1]^2/2) Sqrt[\[Pi]/2] Erf[(x + C[1])/Sqrt[2]])])}}  *)

To get h[x] you return to the definition:

 Exp[H[x]] /. sol // FullSimplify

(*  {E^(-(1/2) x (x + 2 C[1]))/(
 Sqrt[2] (-2 C[2] + 
    E^(C[1]^2/2) Sqrt[2 \[Pi]] Erf[(x + C[1])/Sqrt[2]]))}  *)

And, finally, let us solve it numerically and build a plot out of the solution with arbitrarily chosen initial conditions:

 sol2 = NDSolve[{H''[x] == -1 - 2 Sqrt[2]*H'[x]*Exp[H[x]], H[0] == 3, 
    H'[0] == 1}, H, {x, 0, 3}];
Plot[Log[H[x]] /. sol2, {x, 0, 3}]


enter image description here

Have fun!

  • $\begingroup$ thank you, I think I can proceed from here now $\endgroup$
    – GregVoit
    Sep 29, 2015 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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