# Need help with solving a second order differential equation

I need help with solving this differential equation.

DSolve[
{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.

-
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. –  Yi Wang Feb 10 at 10:09
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 –  Nasser Feb 10 at 10:24

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:

Needs["DifferentialEquationsNDSolveProblems"];
Needs["DifferentialEquationsNDSolveUtilities"];

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]},