# Solving nonlinear differential equation with boundary condition at infinity

I have a differential equation I am trying to solve using

DSolve[{f''[x] + f[x] - f[x]^3 == 0}, {f[x]}, x]


with the boundary condition $$f(\pm\infty)\rightarrow \pm 1$$. I already know the solution, $$f(x)=\tanh(x/\sqrt{2})$$, but I'm wondering if there's a way I could have found this with Mathematica, which outputs an elliptic JacobiSN function.

• No time to write a long answer, but: DSolve[{f''[x] + f[x] - f[x]^3 == 0}, f[x], x] /. {C[1] -> 1/2, C[2] -> 0} – J. M. will be back soon Apr 3 at 23:40