Convert system of first-order quasilinear differential algebraic equations to equivalent system of differential index 0

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


[newEqs,constraintEqs,oldIndex] = daetools::reduceDAEToODE(eqs,vars)


[newEqs,constraintEqs,oldIndex] := daetools::reduceDAEToODE(eqs,vars) converts a high-index system of first-order semilinear algebraic equations eqs to an equivalent system of ordinary differential equations, newEqs. It also returns a vector of constraint equations and the differential index oldIndex of the original system of semilinear DAEs, eqs.

The differential index of the new system is 0, that is, the Jacobian of newEqs with respect to the derivatives of the variables in vars is invertible.

The implementation of daetools::reduceDAEToODE is based on Gaussian elimination. This algorithm is more reliable than the Pantelides algorithm used by daetools::reduceDAEIndex, but it can be much slower.

The number of equations eqs must coincide with the number of variables vars.


Example 1

Check if a DAE system has a low (0 or 1) or high (>1) differential index. If the index is higher than 1, then first try to reduce the index by using daetools::reduceDAEIndex and then by using daetools::reduceDAEToODE.

Create the following system of differential algebraic equations. Here, x1(t), x2(t), and x3(t) represent state variables of the system. The system also contains the expressions q1(t), q2(t), and q3(t) that do not represent state variables.

eqs := [diff(x2(t),t) = q1(t) - x1(t),
        diff(x3(t),t) = q2(t) - 2*x2(t) - t*(q1(t)-x1(t)),
        q3(t) - t*x2(t) - x3(t) = 0];
vars := [x1(t), x2(t), x3(t)]

Use daetools::isLowIndexDAE to check the differential index of the system. For this system, daetools::isLowIndexDAE returns FALSE. This means that the differential index of the system is 2 or higher.

daetools::isLowIndexDAE(eqs, vars)

Use daetools::reduceDAEIndex as your first attempt to rewrite the system so that the differential index is 1. For this system, daetools::reduceDAEIndex issues a warning because it cannot reduce the differential index of the system to 0 or 1.

[newEqs, newVars, R, oldIndex] :=
    daetools::reduceDAEIndex(eqs, vars):

newEquations = newEqs;
newVariables = newVars;
relations = R;
originalIndex = oldIndex
Warning: Index of reduced DAEs is larger than 1. [daetools::reduceDAEIndex]

If daetools::reduceDAEIndex cannot reduce the semilinear system so that the index is 0 or 1, try using daetools::reduceDAEToODE. This function can be much slower, therefore it is not recommended as a first choice.

[newEqs, constraintEqs, oldIndex] :=
    daetools::reduceDAEToODE(eqs, vars):

ODEs = eqs;
constraintEquations = constraintEqs;
originalIndex = oldIndex



A list or a vector of equations or expressions in the state variables vars and their derivatives. Expressions represent equations with 0 right side.


A list or a vector of identifiers or expressions, such as [x1(t), x2(t)].

Return Values

A nested list containing the following three outputs: a list of ordinary differential equations, a list of constraint equations encountered during system reduction, and the differential index of the original DAE system.

Introduced in R2014b