# NDSolve solving problem

I am trying to solve for the function y[x] obeying the ODE:

$\frac{x}{1 + x}y^{\prime\prime}(x) + \frac{2 x + 1}{(1 + x)^2} y^{\prime}(x) = \frac{1}{3\sqrt{y(x)}}$

using NDSolve.

NDSolve[{(x/(1 + x)) D[y[x], {x, 2}] + ((2 x + 1)/(1 + x)^2) D[
y[x], {x, 1}] == 1/(3 Sqrt[y[x]]), y == 0}, y, {x, 0, 0.02}]


but I got this error

NDSolve::ndnco: The number of constraints (1) (initial conditions) is not equal to the total differential order of the system (2).


Does anyone know why I keep getting this error?

• You have second order ODE, but you only gave one IC. For numerical solver, it needs more one. (ps. the title of your question suggest it is a plotting problem, but there is no plotting issue here) (ps. actually the error message you get says the reason for the error :) – Nasser Apr 6 '15 at 18:22
• Also at 'x=0' the factor is front of y''[x] is null so this is a nasty ODE – chris Apr 6 '15 at 18:28
• This works for instance NDSolve[{(x/(1 + x)) D[y[x], {x, 2}] + ((2 x + 1)/(1 + x)^2) D[ y[x], {x, 1}] == 1/(3 Sqrt[y[x]]), y == 1, y' == 0}, y, {x, 1, 2}] – chris Apr 6 '15 at 18:28

You can solve your problem numerically after mending two things

1) replace the 0 in x = 0 by a small quantity eps ( = 10^-5, say), i.e. write y[eps] == eps

2) add the second initial condition needed for an ODE of the second order, take e.g. y'(eps) = 1

The ODE is then easily NDSolved:

eps = 10^-5;

yy[x_] = y[x] /.
NDSolve[{((1 + 2 x) Derivative[y][x])/(1 + x)^2 + (
x (y^\[Prime]\[Prime])[x])/(1 + x) == 1/(3 Sqrt[y[x]]), y[eps] == eps,
Derivative[y][eps] == 1}, y[x], {x, eps, 20}][]

(*
Out= InterpolatingFunction[{{0.00001,20.}},<>][x]
*)


You can now plot the function. Here you can even start at x = 0. For comparison we have added the approximate solution y = (3x/4)^(2/3) close to x = 0 obtained by inserting y = A x^p into the ODE and calculating A and p for x->0.

Plot[yy[x], {x, 0, 2}, PlotLabel -> "Solution of ODE",
AxesLabel -> {"x", "y[x]"}]
(* 150407_Plot _ODE.jpg *) 