Check if differential index of system of equations is lower than 2

`isLowIndexDAE(`

checks
if the system `eqs`

,`vars`

)`eqs`

of first-order semilinear differential
algebraic equations (DAEs) has a low differential index. If the differential
index of the system is `0`

or `1`

,
then `isLowIndexDAE`

returns logical `1`

(true).
If the differential index of `eqs`

is higher than `1`

,
then `isLowIndexDAE`

returns logical `0`

(false).

The number of equations `eqs`

must match
the number of variables `vars`

.

Check if a system of first-order semilinear
DAEs has a low differential index (`0`

or `1`

).

Create the following system of two differential algebraic equations.
Here, `x(t)`

and `y(t)`

are the
state variables of the system. Specify the equations and variables
as two symbolic vectors: equations as a vector of symbolic equations,
and variables as a vector of symbolic function calls.

syms x(t) y(t) eqs = [diff(x(t),t) == x(t) + y(t), x(t)^2 + y(t)^2 == 1]; vars = [x(t), y(t)];

Use `isLowIndexDAE`

to check the differential
order of the system. The differential order of this system is `1`

.
For systems of index `0`

and `1`

, `isLowIndexDAE`

returns `1`

(`true`

).

isLowIndexDAE(eqs, vars)

ans = logical 1

Check if the following DAE system has a low
or high differential index. If the index is higher than `1`

,
then use `reduceDAEIndex`

to reduce it.

Create the following system of two differential algebraic equations.
Here, `x(t)`

, `y(t)`

, and `z(t)`

are
the state variables of the system. Specify the equations and variables
as two symbolic vectors: equations as a vector of symbolic equations,
and variables as a vector of symbolic function calls.

syms x(t) y(t) z(t) f(t) eqs = [diff(x(t),t) == x(t) + z(t),... diff(y(t),t) == f(t), x(t) == y(t)]; vars = [x(t), y(t), z(t)];

Use `isLowIndexDAE`

to check the differential
index of the system. For this system `isLowIndexDAE`

returns `0`

(`false`

).
This means that the differential index of the system is `2`

or
higher.

isLowIndexDAE(eqs, vars)

ans = logical 0

Use `reduceDAEIndex`

to rewrite the system
so that the differential index is `1`

. Calling this
function with four output arguments also shows the differential index
of the original system. The new system has one additional state variable, `Dyt(t)`

.

[newEqs, newVars, ~, oldIndex] = reduceDAEIndex(eqs, vars)

newEqs = diff(x(t), t) - z(t) - x(t) Dyt(t) - f(t) x(t) - y(t) diff(x(t), t) - Dyt(t) newVars = x(t) y(t) z(t) Dyt(t) oldIndex = 2

Check if the differential order of the new system is lower than `2`

.

isLowIndexDAE(newEqs, newVars)

ans = logical 1

`daeFunction`

| `decic`

| `findDecoupledBlocks`

| `incidenceMatrix`

| `massMatrixForm`

| `odeFunction`

| `reduceDAEIndex`

| `reduceDAEToODE`

| `reduceDifferentialOrder`

| `reduceRedundancies`