# `daetools`::`reduceRedundancies`

Simplify system of first-order differential algebraic equations by eliminating redundant equations and variables

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.

## Syntax

```[`newEqs`,
`newVars`,
`solvedEquations`,
`constantVariables`,
`replacedVariables`,
`otherEquations`
] := daetools::reduceRedundancies(`eqs`, `vars`)
```

## Description

```[newEqs, newVars, solvedEquations, constantVariables, replacedVariables, otherEquations] := daetools::reduceRedundancies(eqs, vars)``` eliminates simple equations from the system of first-order differential algebraic equations `eqs`. It returns a list of remaining equations, a list of remaining variables, and four more lists containing information on the eliminated equations and variables. For details, see Return Values.

## Examples

### Example 1

Use `daetools::reduceRedundancies` to simplify a system of five differential algebraic equations in four variables to a system of two equations in two variables.

Create the following system of five differential algebraic equations for four state variables: `x1(t)`, `x2(t)`, `x3(t)`, and `x4(t)`. This system also contains symbolic parameters `a1`, `a2`, `a3`, `a4`, `b`, `c`, and a parameter function `f(t)` that is not a state variable.

```eqs := [a1*diff(x1(t),t)+a2*diff(x2(t),t) = b*x4(t), a3*diff(x2(t),t)+a4*diff(x3(t),t) = c*x4(t), x1(t) = 2*x2(t), x4(t) = f(t), f(t) = sin(t)]; vars := [x1(t), x2(t), x3(t), x4(t)]```

Use `daetools::reduceRedundancies` to eliminate redundant equations and corresponding state variables.

```[newEqs, newVars, solvedEquations, constantVariables, replacedVariables, otherEquations ] := daetools::reduceRedundancies(eqs, vars):```

Display the new equations and new variables.

```newEqs; newVars```

Display the equations that `daetools::reduceRedundancies` used to replace those state variables from `vars` that do not appear in `newEqs`.

`solvedEquations`

Display those state variables from `vars` that `daetools::reduceRedundancies` replaced by constant values.

`constantVariables`

Display those state variables from `vars` that `daetools::reduceRedundancies` replaced by expressions in terms of other variables.

`replacedVariables`

Display those equations from `eqs` that do not contain any of the state variables `vars`.

`otherEquations`

## Parameters

 `eqs` A list or a vector of equations or expressions in the state variables `vars` and their derivatives. Expressions represent equations with `0` right side. `vars` A list or a vector of identifiers or expressions, such as ```[x1(t), x2(t)]```.

## Return Values

A nested list containing the following lists:

• A list of new equations

• A list of those variables that remain in the new DAE system

• A list of equations that do not appear in `newEqs`

• A list of equations ```[y1 = value1(t), y2 = value2(t),...]``` defining those of the variables `[y1,y2,...]` (contained in the original equations `eqs` and the original `vars`) that were eliminated from `eqs`. In `newEqs`, they are replaced by the values.

• A list of equations ```[y1 = Y1(t,x,diff(x,t),...), y2 = Y2(t,x,diff(x,t),...),...]``` defining those of the variables `]y1,y2,...]` (in the original `vars`) that were eliminated in terms of the variables that are still in `newVars`. (Typically, equations involving only two variables are used to eliminate one of the variables.)

• A list of equations that do not contain any of the variables. These equations do not appear in `newEqs`.

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos