I need help with solving this differential equation.

  {D[x[r], {r, 2}] + (1/r) D[x[r], r] + (1 - 1/r^2) x[r] - x[r]^3 == 0, 
   x[0] == 0, x[Infinity] == 1}, x[r], r]

I tried to solve this with DSolve, but no success. Any suggestion is highly appreciated.

  • $\begingroup$ A side remark: I see your efforts in making nice typeset of the question. However, it would be better if the code is typed in "Code Sample" block, which is the "{}" sign on the edit bar. Then people can copy and paste your code when they want to try it. $\endgroup$
    – Yi Wang
    Feb 10, 2014 at 10:09
  • 1
    $\begingroup$ You won't be able find closed for solution for this. First, it is non-linear. Second, there is removable singularity at $x=0$, and third is is a boundary value problem. You can try a Frobenius series solution and see if this works. Or just try a numerical solution. Even that requires some work to get right. Screen shot !Mathematica graphics $\endgroup$
    – Nasser
    Feb 10, 2014 at 10:24

1 Answer 1


You are trying to exactly solve the Ginzburg-Landau equation with potential 1-\frac{1}{r^2}. No wonder that you fail: it has no analytical solution. At least no solution that I would hear about, and I am in this business already for some time. One reason to see that it has no non-trivial exact solution is that when you fix its boundary conditions in another way: e.g. being zero at both ends it has a trivial solution x === 0 and may have a non-trivial one (at least if you introduce a parameter into it, then it will (or may) show up in some region of the parametric space. In such cases equations only rarely show analytical solutions that embrace both branches. And I guess this will not. Further, you may want to go through the book of Kamke, where all known to him cases were collected. But that is only to check that it is not there, I checked some years ago.

I advise you to try to solve it numerically:


Xmax = 100;
eqbc = {eq, x[0.01] == 0, x[Xmax] == 1};
sl = NDSolve[eqbc, x, {r, 0.01, Xmax}, 
  Method -> {StiffnessSwitching, 
  Method -> {ExplicitRungeKutta, Automatic}}, 
  AccuracyGoal -> 5, 
  PrecisionGoal -> 4]

returning the interpolation function. Then this:

Plot[Evaluate[x[r] /. sl], {r, 0.01, Xmax}, 
  AxesLabel -> {Style["x", Italic, 16], Style["r", Italic, 16]}, 
  AxesStyle -> Arrowheads[0.05]]

Shows you the result. It should look like the following:

enter image description here

Does it have sense for you? Have fun!

  • $\begingroup$ I am trying to calculate for Xmax = 10, but I get a few errors related to the singularities. Errors disappear for Xmax = 1. $\endgroup$
    – bordart
    Feb 10, 2014 at 11:15
  • $\begingroup$ @artalexan for me it worked also for Xmax=10, no problem. You should use the StiffnessSwitching method, do you? $\endgroup$ Feb 10, 2014 at 12:54
  • $\begingroup$ @Alexei Boulbitch I get the same plot, but with a few errors like this. NDSolve::ndsz: At r == 0.9111834202476907`, step size is effectively zero; singularity or stiff system suspected. >>. I am using Mathematica 9 x64. $\endgroup$
    – bordart
    Feb 10, 2014 at 14:38
  • $\begingroup$ Also, from the solution it doesn't seem that x[100] == 1, so something is wrong. $\endgroup$
    – bordart
    Feb 11, 2014 at 1:09
  • $\begingroup$ @artalexan It is, indid, a stiff system. That is why I used Method ->StiffnessSwitching. The latter requires the two packages I loaded before the code. And, yes, the solution I have written seems to behave incorrectly at r=100. $\endgroup$ Feb 17, 2014 at 8:16

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.