# Boundary value problem for a nonlinear ODE

I want to solve the following equation

y''[x] + a + b y[x] + c y[x]^2 == 0, y[∞] == 0, y'[∞] == 0


where a, b and c are constants.

• It helps to start with correct syntax...Is the 2 after y[x] supposed to be a power? Are a, b, c constants? Commented Jul 22, 2020 at 16:55
• @MichaelE2 There is y[x]^2 not y[x] 2 :) Commented Jul 22, 2020 at 16:57
• is y[x] 2 supposed to be y[x]^2? You said nonlinear. Otherwise where is the non-linearity? Mathematica gives no solutions with these BC. Commented Jul 22, 2020 at 16:58
• @MichaelE2 But with y[x]^2 it looks better :) Commented Jul 22, 2020 at 17:07
• If $y(x) \rightarrow 0$ as $x \rightarrow 0$, then $y''(x) \rightarrow -a$. If $a \ne 0$, this leads to a contradiction. Commented Jul 22, 2020 at 22:46

DSolveyields an involved implicit result in terms of elliptic integrals. In order to solve explicitly the problem at hand we should first transform the equation. Let's multiply given differential equation by $$\;y'(x)$$ $$y'y''+c y' y^2+by y'+a y'=0$$ then integrating it and multiplying by $$2$$ we get $${y'}^2+\frac{2c}{3}y^3+b y^2+2a y+d=0$$ where $$d$$ is an integration constant. With appropriate initial or boundary conditions it could be determined. Now, with a bit of insight we would like transforming this differential equation into the Weierstrass canonical form which reads $${y'}^2-4y^3+g_2\; y+g_3=0$$ In order to proceed further we change the dependent variable $$\;y(x)=p\; w(x)+q$$.

(y'[x]^2 + 2 a y[x] + b y[x]^2 + 2/3 c y[x]^3 + d)/p^2 /. {y'[x] -> p w'[x],
y[x] -> p w[x] + q} // Expand // Collect[#, {w[x]}] &

 d/p^2 + (2 a q)/p^2 + (b q^2)/p^2 + (2 c q^3)/(3 p^2)
+ ((2 a)/p + (2 b q)/p + (2 c q^2)/p) w[x] + (b + 2 c q) w[]^2
+ 2/3 c p w[x]^3 + w'[x]^2


We find $$(p,q)$$

{p, q} /. First@Solve[{2/3 c p == -4, b + 2 c q == 0}, {p, q}]

 {-(6/c), -(b/(2 c))}


Now we rewrite the differential equation in terms of the new variable w[x]:

((y'[x]^2 + 2 a y[x] + b y[x]^2 + 2/3 c y[x]^3 + d)/(6/c)^2 /. {y'[x] -> -(6/c) w'[x],
y[x] -> -(6/c) w[x] - b/(2 c)} // Expand // Collect[#, {w[x]}] &) == 0

b^3/216 - (a b c)/36 + (c^2 d)/36 + (b^2/12 - (a c)/3) w[x] - 4 w[x]^3 + w'[x]^2 == 0


Now we can find the general solution with DSolve, although without the initial (boundary) conditions (this is a current arbitrary restriction in DSolve, perhaps in next versions of the system it will be improved):

DSolve[ b^3/216 - (a b c)/36 + (c^2 d)/36 + (b^2/12 -(a c)/3) w[x] - 4w[x]^3
+ w'[x]^2 == 0, w[x], x]

{{w[x] -> WeierstrassP[x - C[1],
{1/216 (18 b^2 - 72 a c), 1/216 (b^3 - 6 a b c + 6 c^2 d)}]},
{w[x] -> WeierstrassP[x + C[1],
{1/216 (18 b^2 - 72 a c), 1/216 (b^3 - 6 a b c + 6 c^2 d)}]}}


Finally returning to the original dependent variable y[x] we define a new function being an explicit general solution in terms of all constants:

ys[x_, a_, b_, c_, C1_, d_] := -((12WeierstrassP[x - C1,
{1/216 (18 b^2 - 72 a c), 1/216 (b^3 - 6 a b c + 6 c^2 d)}] + b)/(2 c))


Problem of determining the actual solution to the conditions given is more subtle and it cannot be given in general in an explicit form, unless we prescribe different initial (boundary) conditions. Parameters (constants of integration) d and C[1] should be found from the conditions given, nevertheless they are inconsistent with the differential equation. Elliptic functions are doubly periodic meromorphic functions in the complex plane, and so one cannot prescribe such conditions at infinity as it was supposed, unless we restrict to a special case. For more detailed discussion of the issue see e.g. Optimization of ODE with respect to the initial condition or Problem solving Third order non-linear differential equation in Mathematica. These posts demonstrate that we can solve the equation with respect to the initial conditions, although it is not guaranteed that we can relay only on symbolic functionality, it may appear that certain numeric assistance will be needed.

Special cases

a=0, b=0, d=0, C1=0

Recalling that WeierstrassP[x, {0, 0}] == 1/x^2 we can find a case where the given boundary conditions are satisfied.

ys[x, 0, 0, c, 0, 0]

-(6/(c x^2))


that yields:

With[{x = Infinity},
{ys[x, 0, 0, c, 0, 0], Derivative[1, 0, 0, 0, 0, 0][ys][x, 0, 0, c, 0, 0]}]

 {0, 0}


It appears that in this case the equation can be solved immediately:

DSolveValue[{y''[x] + c y[x]^2 == 0}, y[x], x]

 (6^(1/3) WeierstrassP[((-c)^(1/3) (x + C[1]))/6^(1/3), {0, C[2]}])/(-c)^(1/3)

% /. {C[1] -> 0, C[2] -> 0}

 -(6/(c x^2))


a=1, b=2, c=-1, C1= -1/2, d= 3

This represents a tipical solution when C1 is real

ys[x, 1, 2, -1, -1/2, 3]

1/2 (2 + 12 WeierstrassP[1/2 + x, {2/3, 19/108}])


and it shows that conditons at infinity cannot be prescribed

Plot[ys[x, 1, 2, -1, -1/2, 3], {x, -2, 5}, PlotStyle -> Thick]


Not an answer, but long comment and some analysis.

The problem can be more clearly seen as follows.

The solution to the ODE contains elliptic integrals, whose solution contain elliptic special functions.

The problem is evaluating this at $$\infty$$ and its derivative also, to solve for the constant of integrations. And this it can not do.

The solutions to your ode without the BC is actually

$$\int ^{y \left( x \right) }\!-3\,{\frac {1}{\sqrt {-6\,c{{\it \_a}}^{ 3}-9\,b{{\it \_a}}^{2}-18\,a{\it \_a}+9\,{\it \_C1}}}}{d{\it \_a}}-x-{ \it \_C2}=0$$

$$\int ^{y \left( x \right) }\!3\,{\frac {1}{\sqrt {-6\,c{{ \it \_a}}^{3}-9\,b{{\it \_a}}^{2}-18\,a{\it \_a}+9\,{\it \_C1}}}}{d{ \it \_a}}-x-{\it \_C2}=0$$

Obtained from Maple.

Mathematica gives the same solution, but it also evaluates these integrals. This is why Mathemtica's solution is (notice the Solve in the solution, which means it is implicit, since it could solve it)

ClearAll[x, y, a, b, c];
ode = y''[x] + a + b*y[x] + c*y[x]^2 == 0
sol = DSolve[ode, y[x], x]


which is

The above is actually the same as solving the integrals from Maple as you can see:

ClearAll[z]
sol = Integrate[-3/Sqrt[-6 c z^3 - 9 b z^2 - 18 a z + 9 C[1]], z]


The problem comes when trying to solve these solution are $$y(\infty)=0$$ and the derivative as well. This is why Mathematica gives the solution as implicit Solve[...]. It can not evaluate these solutions at $$\infty$$ and set the result to zero to solve for the 2 constants of integrations.

May be a smart use of Limit could help. But Maple is also stuck at these B.C. also.