NDSolve::ndnco NDSolveValue::ndnco ParametricNDSolve::ndnco ParametricNDSolveValue::ndnco NDSolve`Reinitialize::ndnco
Examples
Basic Examples (4)
An error occurs because there are not enough initial conditions to uniquely specify a solution:

This shows a valid specification of a unique solution for this differential equation:
This is a second-order ODE, but only one initial condition is given:

A numerical solver needs more the one. This works, for instance:

For a numerical solution, you have to add a boundary condition. Refer to the picture below. Since there is an initial condition on the function and its first derivative at , the temporal variable is
. Therefore, boundary conditions are needed at
and
. Two conditions are needed because the equation is second order in
. Similarly, in the
-direction the equation is second order in
, so two conditions are needed. In the code above, there is just one boundary condition on
at
.
Adding the additional boundary condition resolves the error message:

Too many initial conditions are given here:

The problem is that too many conditions are given. The equation is a second-order ODE, so only two conditions on the function are needed:
However, the values at are not guaranteed to give
,
as was stated in the original problem:
The solution is uniquely determined by the two initial conditions. Different initial conditions will produce different values for the solution at . Alternatively, you can just specify how you want the function to behave at the far end:
Now the solution is what you want it to be at :
But now the values at are different:
There is a tradeoff. The equation will never allow for all four conditions to be met simultaneously. If you are interested in the two boundary conditions, you need to use the shooting method:
Now the solution satisfies the two boundary conditions of and
:
An alternative to the last method is to use the finite element method, which also allows the boundary to be at :