daetools
::reduceDAEIndex
Convert system of firstorder differential algebraic equations to equivalent system of differential index 1
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
,newVars
,R
,oldIndex
] := daetools::reduceDAEIndex(eqs
,vars
)
[newEqs,newVars,R,oldIndex] := daetools::reduceDAEIndex(eqs,vars)
converts
a highindex system of firstorder differential algebraic equations eqs
to
an equivalent system newEqs
of differential index 1
.
The daetools::reduceDAEIndex
function keeps the
original equations and variables and introduces new variables and
equations. It also returns the matrix R
that
expresses the new variables in newVars
as derivatives
of the original variables vars
and the differential
index oldIndex
of the original system of DAEs, eqs
.
After conversion, daetools::reduceDAEIndex
checks
the differential index of the new system by calling daetools::isLowIndexDAE
.
If the index of newEqs
is 2
or
higher, then daetools::reduceDAEIndex
issues
a warning.
The implementation of daetools::reduceDAEIndex
uses
the Pantelides algorithm. This algorithm reduces higherindex systems
to lowerindex systems by selectively adding differentiated forms
of the original equations. The Pantelides algorithm can underestimate
the differential index of a new system, and therefore, can fail to
reduce the differential index to 1
. In this case, daetools::reduceDAEIndex
issues
a warning and returns the value of oldIndex
as UNKNOWN
.
The daetools::reduceDAEToODE
function uses more
reliable, but slower Gaussian elimination. Note that daetools::reduceDAEToODE
requires
the DAE system to be semilinear.
Reduce the differential index of a system that contains two
secondorder differential algebraic equations. Because the equations
are secondorder equations, first use reduceDifferentialOrder
to
rewrite the system to a system of firstorder DAEs.
Create the following system of two secondorder DAEs. Here, x(t)
, y(t)
,
and F(t)
are state variables of the system.
eqs := [diff(x(t), t, t) = F(t)*x(t), diff(y(t), t, t) = F(t)*y(t)  g, x(t)^2 + y(t)^2 = r^2]; vars := [x(t), y(t), F(t)]
Rewrite this system so that all equations become firstorder
differential equations. The daetools::reduceDifferentialOrder
function
replaces the secondorder DAE by two firstorder expressions by introducing
the new variables Dxt(t)
and Dyt(t)
.
[eqs, vars, R] := daetools::reduceDifferentialOrder(eqs, vars): newEquations = eqs; newVariables = vars; relations = R
Use daetools::reduceDAEIndex
to rewrite
the system so that the differential index is 1
.
[eqs,vars,R,originalIndex] := daetools::reduceDAEIndex(eqs,vars): newEquations = eqs; newVariables = vars; relations = R; originalDAEIndex = originalIndex
Use daetools::reduceRedundancies
to shorten
the system.
[eqs, vars, solvedEquations, constantVariables, replacedVariables, otherEquations] := daetools::reduceRedundancies(eqs, vars): newEquations = eqs; newVariables = vars;

A list or a vector of equations or expressions in the state
variables 

A list or a vector of identifiers or expressions, such as 
A nested list containing the following four outputs: a list of new equations, a list of new
variables, a list of relations between new and original variables, and the
differential index of the original DAE system. If
daetools::reduceDAEIndex
fails to reduce the
differential index to 1
, then it issues a warning and
returns UNKNOWN
instead of the differential index of the
original DAE system.