# Extended Dynamic Mode Decomposition

Extended Dynamic Mode Decomposition is a method for generating an approximating linear differential equation in a chosen basis of observables. If X and Y are data matrices containing points of the same trajectory and Ψ is a basis, then EDMD approximates

$K = Ψ(Y)~Ψ(X)^{\dagger}$

where $\dagger$ denotes the Moore-Penrose pseudoinverse and K is the approximation of the Koopman Operator.

EDMD approximates discrete time systems of the form

$\Psi(u_{i+1}) = K ~ \Psi(u_{i}) \\ u_{i+1} = C~\Psi(u_{i})$

gEDMD approximates continuous time systems of the form

$\frac{d}{dt}\Psi(u) = K_{G} ~ \Psi(u) \\ \frac{d}{dt}u = C~\frac{d}{dt}\Psi(u)$

where $K_{G}$ is the generator of the Koopman Operator. C is a matrix mapping from the observations back onto the states or differential states.

## Functions

DataDrivenDiffEq.EDMDFunction
EDMD(X, basis; alg, p, t, C)
EDMD(X, Y, basis; alg, p, t, C)

Approximates a 'NonlinearKoopman' with the AbstractKoopmanAlgorithm 'alg' from the data matrices X or X and Y, respectively. If only X is given, the data is split into X[:, 1:end-1] and X[:, 2:end].

Additional keyworded arguments include p for the parameter of the basis and t for an array of time points. C is the matrix representing the mapping from the Koopman space into the state space.

Example

@parameters p[1] t
@variables u[1:2]
h = Operation[u; sin.(u); cos(p[1]*t)]
basis = Basis(h, u, parameters = p, iv = t)
koopman = EDMD(X, basis, p = [2.0], t = collect(0:0.2:10.0), C = Float64[1 0 0 0 0; 0 1 0 0 0])
source
DataDrivenDiffEq.gEDMDFunction
gEDMD(X, Y, basis; alg, p, t, C)
gEDMD(t, X, basis; dt, p, C, alg, fdm, itp)

Approximates a 'NonlinearKoopman' with the AbstractKoopmanAlgorithm 'alg' from the data matrices X and Y. X should contain the state trajectory and Y the differential state trajectory.

If no measurements of the differential state are available, gEDMD can be called with measurement time points t as the first argument. It will then create an interpolation using the interpolation method from DataInterpolations.jl defined in itp. The trajectory will then be resampled to equidistant measurements over time corresponding to the mean of diff(t) or dt, if given. The differential state measurements will be computed via 'FiniteDifferences.jl', given a FiniteDifferenceMethod in fdm.

Example

koopman = gEDMD(X, Y, basis)

fdm = backward_fdm(5,1)
itp = CubicSpline
koopman = gEDMD(t, X, basis, fdm = fdm, itp = itp)
source