NDSolve::ndcf NDSolveValue::ndcf ParametricNDSolve::ndcf ParametricNDSolveValue::ndcf
Details
-
- This message is generated by a specific type of failure within the algorithms that are used for computing numerical solutions of ordinary differential equations.
- If you see this message and the cause is not evident from the nature of the example, please send your example to Technical Support so that it can be investigated.
- Off[message] switches off the message; On[message] switches it on. For example: Off[NDSolve::ndcf].
Examples
Basic Examples (2)
Consider the following differential algebraic equation:
eqns = {x''[t] == y[t], y[t] ^ 2 + x[t] ^ 2 == 1, x[0] == 1, x'[0] == 0};
NDSolve[eqns, {x, y}, {t, 0, 1}]The problem is with the initial conditions.
says that
from the second equation.
says that
. Thus, the pendulum has no initial velocity or acceleration, so it just sits there, which causes the problem. Changing the initial conditions helps:
eqns2 = {x''[t] == y[t], y[t] ^ 2 + x[t] ^ 2 == 1, x[0] == 0.5, x'[0] == 0};
NDSolve[eqns2, {x, y}, {t, 0, 1}]Note that the index reduction methods also have a problem with the original initial conditions:
eqns = {x''[t] == y[t], y[t] ^ 2 + x[t] ^ 2 == 1, x[0] == 1, x'[0] == 0};
NDSolve[eqns, {x, y}, {t, 0, 1}, Method -> {"IndexReduction" -> "Pantelides"}];
NDSolve[eqns, {x, y}, {t, 0, 1}, Method -> {"IndexReduction" -> "StructuralMatrix"}];Finding solutions of differential equations with discontinuities can be problematic, and increasing the working precision may not be a solution:
eqns = {Derivative[1][p][t] == 4. (-0.005 Sqrt[-100. + p[t]^2] + 0.07 Sqrt[600. - p[t]] z[t]), Derivative[1][z][t] == (Piecewise[
{{Max[0, 0.4*(170. - p[t]) - 1.2*(-0.005*Sqrt[-100. + p[t]^2] + 0.07*Sqrt[600. - p[t]]*z[t])],
z[t] <= 0}, {Min[0, 0.4*(170. - p[t]) - 1.2*(-0.005*Sqrt[-100. + p[t]^2] +
0.07*Sqrt[600. - p[t]]*z[t])], z[t] >= 1}},
0.4*(170. - p[t]) - 1.2*(-0.005*Sqrt[-100. + p[t]^2] + 0.07*Sqrt[600. - p[t]]*z[t])]), p[0] == 140., z[0] == 0.5};
newEqns = Map[Rationalize[#, 0]&, eqns];
NDSolve[newEqns, {p, z}, {t, 0, 20}, WorkingPrecision -> 100];The Piecewise function is problematic. Use "DiscontinuityProcessing"False:
NDSolve[newEqns, {p, z}, {t, 0, 20}, Method -> {"DiscontinuityProcessing" -> False}]