NDSolve::ivres
Details
-
- This message occurs when NDSolve is unable to get an consistent set of initial conditions for a general differential algebraic equation written in residual form
. - The message is issued when the specified initial conditions are found to be inconsistent with the underlying DAE system.
- The message warns that the specified initial conditions have been modified to generate a consistent set of initial conditions.
- Off[message] switches off the message; On[message] switches it on. For example: Off[NDSolve::ivres].
Examples
Basic Examples (1)
For the single-pendulum problem, the initial condition
is inconsistent with the algebraic equation
since
has to evaluate to a real-valued number:
eqns = {x'[t] == xp[t], xp'[t] == λ[t] x[t], y'[t] == yp[t], yp'[t] == λ[t] y[t] - 1, x[t] ^ 2 + y[t] ^ 2 == 1};
ics = {x[0] == 2, yp[0] == 1};
res = NDSolve[{eqns, ics}, {x, xp, y, yp, λ}, {t, 0, 5}, Method -> "IndexReduction" -> True]Both the initial conditions are modified to ensure consistent initial conditions:
{x[0], yp[0]} /. res[[1]]Provide consistent initial conditions to resolve the issue:
eqns = {x'[t] == xp[t], xp'[t] == λ[t] x[t], y'[t] == yp[t], yp'[t] == λ[t] y[t] - 1, x[t] ^ 2 + y[t] ^ 2 == 1};
ics = {x[0] == 1, yp[0] == 1};
NDSolve[{eqns, ics}, {x, xp, y, yp, λ}, {t, 0, 5}, Method -> "IndexReduction" -> True]