# Unifying SINDy and DMD

The SINDy and DMD algorithms have been combined under a single interface to match the interface of other SciML packages. Thus, you can simply define a Problem, and then seamlessly switch between solvers.

See the individual descriptions below for how to call the traditional SINDy and DMD solvers within the unified interface.

## DMD

For dynamic mode decomposition, use `DMDSVD()`

without a basis:

`res = solve(problem, DMDSVD(), kwargs...)`

## Extended DMD

For extended dynamic mode decomposition, use `DMDSVD()`

with a basis:

`res = solve(problem, basis, DMDSVD(), kwargs...)`

## DMD Optional Arguments

If control signals are present, they get processed according to this paper for dynamic mode decomposition and as described here for extended dynamic mode decomposition, assuming a linear relationship on the operator.

Possible keyword arguments include:

`B`

a linear mapping known a priori which maps the control signals onto the lifted states.`digits`

controls the digits / rounding used for deriving the system equations (`digits = 1`

would round`10.02`

to`10.0`

).`operator_only`

returns a`NamedTuple`

containing the operator, input and output mapping, and matrices used for updating the operator, as described here.

If `eval_expression`

is set to `true`

, the returning result of the Koopman based inference will not contain a parameterized equation, but rather use the numeric values of the operator/generator.

## SINDy

For Sparse Identification of Nonlinear Dynamics, use `STLQS()`

:

`res = solve(problem, basis, STLQS(), kwargs...)`

## Implicit SINDy

For Sparse Identification of Nonlinear Dynamics, use `ImplicitOptimizer()`

:

`res = solve(problem, basis, ImplicitOptimizer(), kwargs...)`

Where control signals are included in the candidate basis.

For implicit optimizers, you can pass an additional `Vector{Num}`

of variables corresponding to $u_t$ for implicitly defined equations $f(u_t, u, p, t) = 0$:

`res = solve(problem, basis, ImplicitOptimizer(), implicits, kwargs...)`

This indicates that we do not have coupling between two implicitly defined variables unless coupling is explicitly included. To elaborate, consider the following:

```
basis = Basis([x, y, z], [x,y,z])
res = solve(problem, basis, ImplicitOptimizer())
```

Allows solutions of the form `x = y + z`

.

```
basis = Basis([x, y, z], [x,y,z])
res = solve(problem, basis, ImplicitOptimizer(), [x,y])
```

Excludes solutions of the form `x = z`

or `y = z`

since we declared `x`

and `y`

as implicit variables assuming they don't interact. However, defining:

```
basis = Basis([x, y, z, x*y], [x,y,z])
res = solve(problem, basis, ImplicitOptimizer(), [x,y])
```

Allows solutions of the form `x = y*x + z`

or `y = y*x + z`

, while suppressing `x = y + z`

. This is because `y*x`

includes both `x`

and `y`

, so the function will get included in the evaluation.

## SINDy Optional Arguments

Possible keyword arguments include:

`normalize`

-> normalizes the data matrix $\\Theta$ such that each row (corresponding to candidate functions) has a 2-norm of`1.0`

`denoise`

-> applies optimal shrinking to the matrix $\\Theta$ to remove the influence of noise`maxiter`

-> maximum iterations of the used optimizer`round`

-> rounds according to the currently used threshold of the optimizer