Equations
DAE
: Differential Algebraic Equation
Defines a differential algebraic initial value problem
with vector field $v$, projection $u$, algebraic constraint $\phi=0$, initial conditions $q_{0}$ and $\lambda_{0}$, the dynamical variable $q$ taking values in $\mathbb{R}^{m}$ and the algebraic variable $\lambda$ taking values in $\mathbb{R}^{n}$.
Fields
d
: dimension of dynamical variable $q$ and the vector field $v$m
: dimension of algebraic variable $\lambda$ and the constraint $\phi$n
: number of initial conditionsv
: function computing the vector fieldu
: function computing the projectionϕ
: algebraic constraintt₀
: initial timeq₀
: initial condition for dynamical variable $q$λ₀
: initial condition for algebraic variable $\lambda$
The function v
, providing the vector field, takes three arguments, v(t, q, v)
, the functions u
and ϕ
, providing the projection and the algebraic constraint take four arguments, u(t, q, λ, u)
and ϕ(t, q, λ, ϕ)
, where t
is the current time, q
and λ
are the current solution vectors, and v
, u
and ϕ
are the vectors which hold the result of evaluating the vector field $v$, the projection $u$ and the algebraic constraint $\phi$ on t
, q
and λ
.
Example
function v(t, q, v)
v[1] = q[1]
v[2] = q[2]
end
function u(t, q, λ, u)
u[1] = +λ[1]
u[2] = -λ[1]
end
function ϕ(t, q, λ, ϕ)
ϕ[1] = q[2] - q[1]
end
t₀ = 0.
q₀ = [1., 1.]
λ₀ = [0.]
dae = DAE(v, u, ϕ, t₀, q₀, λ₀)
HDAE
: Hamiltonian Differential Algebraic Equation
Defines a Hamiltonian differential algebraic initial value problem, that is a canonical Hamiltonian system of equations subject to Dirac constraints,
with vector fields $v_i$ and $f_i$ for $i = 1 ... 3$, primary constraint $\phi(q,p)=0$ and secondary constraint $\psi(q,p,\lambda)=0$, initial conditions $(q_{0}, p_{0})$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$ and the algebraic variables $(\lambda, \gamma)$ taking values in $\mathbb{R}^{n} \times \mathbb{R}^{d}$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $v$ and $f$m
: dimension of algebraic variables $\lambda$ and $\gamma$ and the constraints $\phi$ and $\psi$n
: number of initial conditionsv
: tuple of functions computing the vector fields $v_i$, $i = 1 ... 3$f
: tuple of functions computing the vector fields $f_i$, $i = 1 ... 3$ϕ
: primary constraintsψ
: secondary constraintst₀
: initial timeq₀
: initial condition for dynamical variable $q$p₀
: initial condition for dynamical variable $p$
IDAE
: Implicit Differential Algebraic Equation
Defines a partitioned differential algebraic initial value problem
with vector field $f$, the momentum defined by $p$, projection $u$ and $r$, algebraic constraint $\phi=0$, conditions $(q_{0}, p_{0})$ and $\lambda_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$ and the algebraic variable $\lambda$ taking values in $\mathbb{R}^{n}$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $f$ and $p$m
: dimension of algebraic variable $\lambda$ and the constraint $\phi$n
: number of initial conditionsf
: function computing the vector field $f$p
: function computing $p$u
: function computing the projectiong
: function computing the projectionϕ
: algebraic constraintt₀
: initial timeq₀
: initial condition for dynamical variable $q$p₀
: initial condition for dynamical variable $p$λ₀
: initial condition for algebraic variable $\lambda$
IODE
: Implicit Ordinary Differential Equation
Defines an implicit initial value problem
with vector field $f$, the momentum defined by $p$, initial conditions $(q_{0}, p_{0})$ and the solution $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. This is a special case of a differential algebraic equation with dynamical variables $(q,p)$ and algebraic variable $v$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $f$ and $p$α
: function determining the momentumf
: function computing the vector fieldg
: function determining the projection, given by ∇α(q)λv
: function computing an initial guess for the velocity field (optional)t₀
: initial time (optional)q₀
: initial condition forq
p₀
: initial condition forp
The functions α
and f
must have the interface
function α(t, q, v, p)
p[1] = ...
p[2] = ...
...
end
and
function f(t, q, v, f)
f[1] = ...
f[2] = ...
...
end
where t
is the current time, q
is the current solution vector, v
is the current velocity and f
and p
are the vectors which hold the result of evaluating the functions $f$ and $α$ on t
, q
and v
. The funtions g
and v
are specified by
function g(t, q, λ, g)
g[1] = ...
g[2] = ...
...
end
and
function v(t, q, p, v)
v[1] = ...
v[2] = ...
...
end
ODE
: Ordinary Differential Equation
Defines an initial value problem
with vector field $v$, initial condition $q_{0}$ and the solution $q$ taking values in $\mathbb{R}^{d}$.
Fields
d
: dimension of dynamical variable $q$ and the vector field $v$n
: number of initial conditionsv
: function computing the vector fieldt₀
: initial timeq₀
: initial condition
The function v
providing the vector field must have the interface
function v(t, q, v)
v[1] = ...
v[2] = ...
...
end
where t
is the current time, q
is the current solution vector, and v
is the vector which holds the result of evaluating the vector field $v$ on t
and q
.
PDAE
: Partitioned Differential Algebraic Equation
Defines a partitioned differential algebraic initial value problem
with vector fields $v$ and $f$, projection $u$ and $r$, algebraic constraint $\phi=0$, conditions $(q_{0}, p_{0})$ and $\lambda_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$ and the algebraic variable $\lambda$ taking values in $\mathbb{R}^{n}$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $f$ and $p$m
: dimension of algebraic variable $\lambda$ and the constraint $\phi$n
: number of initial conditionsv
: function computing the vector field $v$f
: function computing the vector field $f$u
: function computing the projectiong
: function computing the projectionϕ
: algebraic constraintt₀
: initial timeq₀
: initial condition for dynamical variable $q$p₀
: initial condition for dynamical variable $p$λ₀
: initial condition for algebraic variable $\lambda$
IODE
: Partitioned Ordinary Differential Equation
Defines a partitioned initial value problem
with vector fields $v$ and $f$, initial conditions $(q_{0}, p_{0})$ and the solution $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $v$ and $f$v
: function computing the vector field $v$f
: function computing the vector field $f$t₀
: initial timeq₀
: initial condition forq
p₀
: initial condition forp
The functions v
and f
must have the interface
function v(t, q, p, v)
v[1] = ...
v[2] = ...
...
end
and
function f(t, q, p, f)
f[1] = ...
f[2] = ...
...
end
where t
is the current time, q
and p
are the current solution vectors and v
and f
are the vectors which hold the result of evaluating the vector fields $v$ and $f$ on t
, q
and p
.
PSDE
: Stratonovich Partitioned Stochastic Differential Equation
Defines a partitioned stochastic differential initial value problem
with the drift vector fields $v$ and $f$, diffusion matrices $B$ and $G$, initial conditions $q_{0}$ and $p_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$, and the m-dimensional Wiener process W
Fields
d
: dimension of dynamical variable $q$ and the vector field $v$m
: dimension of the Wiener processn
: number of initial conditionsns
: number of sample pathsv
: function computing the drift vector field for the position variable qf
: function computing the drift vector field for the momentum variable pB
: function computing the d x m diffusion matrix for the position variable qG
: function computing the d x m diffusion matrix for the momentum variable pt₀
: initial timeq₀
: initial condition for dynamical variable $q$ (may be a random variable itself)p₀
: initial condition for dynamical variable $p$ (may be a random variable itself)
The functions v
, f
, 'B' and G
, providing the drift vector fields and diffusion matrices, take four arguments, v(t, q, p, v)
, f(t, q, p, f)
, B(t, q, p, B)
and G(t, q, p, G)
, where t
is the current time, (q, p)
is the current solution vector, and v
, f
, 'B' and G
are the variables which hold the result of evaluating the vector fields $v$, $f$ and the matrices $B$, $G$ on t
and (q,p)
.
Example
function v(λ, t, q, v)
v[1] = λ*q[1]
v[2] = λ*q[2]
end
function B(μ, t, q, B)
B[1] = μ*q[1]
B[2] = μ*q[2]
end
t₀ = 0.
q₀ = [1., 1.]
λ = 2.
μ = 1.
v_sde = (t, q, v) -> v(λ, t, q, v)
B_sde = (t, q, B) -> B(μ, t, q, B)
sde = SDE(v_sde, B_sde, t₀, q₀)
SDE
: Stratonovich Stochastic Differential Equation
Defines a stochastic differential initial value problem
with drift vector field $v$, diffusion matrix $B$, initial conditions $q_{0}$, the dynamical variable $q$ taking values in $\mathbb{R}^{d}$, and the m-dimensional Wiener process W
Fields
d
: dimension of dynamical variable $q$ and the vector field $v$m
: dimension of the Wiener processn
: number of initial conditionsns
: number of sample pathsv
: function computing the deterministic vector fieldB
: function computing the d x m diffusion matrixt₀
: initial timeq₀
: initial condition for dynamical variable $q$ (may be a random variable itself)
The functions v
and B
, providing the drift vector field and diffusion matrix, v(t, q, v)
and B(t, q, B; col=0)
, where t
is the current time, q
is the current solution vector, and v
and B
are the variables which hold the result of evaluating the vector field $v$ and the matrix $B$ on t
and q
(if col==0), or the column col of the matrix B (if col>0).
Example
function v(λ, t, q, v)
v[1] = λ*q[1]
v[2] = λ*q[2]
end
function B(μ, t, q, B; col=0)
if col==0 #whole matrix
B[1,1] = μ*q[1]
B[2,1] = μ*q[2]
elseif col==1
#just first column
end
end
t₀ = 0.
q₀ = [1., 1.]
λ = 2.
μ = 1.
v_sde = (t, q, v) -> v(λ, t, q, v)
B_sde = (t, q, B) -> B(μ, t, q, B)
sde = SDE(v_sde, B_sde, t₀, q₀)
SODE
: Split Ordinary Differential Equation
Defines an initial value problem
with vector field $v$, initial condition $q_{0}$ and the solution $q$ taking values in $\mathbb{R}^{d}$. Here, the vector field $v$ is given as a sum of vector fields
Fields
d
: dimension of dynamical variable $q$ and the vector field $v$v
: tuple of functions computing the vector fieldt₀
: initial timeq₀
: initial condition
The functions v_i
providing the vector field must have the interface
function v_i(t, q₀, q₁, h)
q₁[1] = q₀[1] + ...
q₁[2] = q₀[2] + ...
...
end
where t
is the current time, q₀
is the current solution vector, q₁
is the new solution vector which holds the result of computing one substep with the vector field $v_i$ on t
and q₀
, and h
is the (sub-)timestep to compute the update for.
The fact that the function v
returns the solution and not just the vector field for each substep increases the flexibility for the use of splitting methods, e.g., it allows to use another integrator for solving substeps.
SPSDE
: Stratonovich Split Partitioned Stochastic Differential Equation
Defines a partitioned stochastic differential initial value problem
with the drift vector fields $v$ and $fi$, diffusion matrices $B$ and $Gi$, initial conditions $q_{0}$ and $p_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$, and the m-dimensional Wiener process W
Fields
d
: dimension of dynamical variable $q$ and the vector fields $vi$m
: dimension of the Wiener processn
: number of initial conditionsns
: number of sample pathsv
: function computing the drift vector field for the position variable qf1
: function computing the drift vector field for the momentum variable pf2
: function computing the drift vector field for the momentum variable pB
: function computing the d x m diffusion matrix for the position variable qG1
: function computing the d x m diffusion matrix for the momentum variable pG2
: function computing the d x m diffusion matrix for the momentum variable pt₀
: initial timeq₀
: initial condition for dynamical variable $q$ (may be a random variable itself)p₀
: initial condition for dynamical variable $p$ (may be a random variable itself)
The functions v
, f
, 'B' and G
, providing the drift vector fields and diffusion matrices, take four arguments, v(t, q, p, v)
, f(t, q, p, f)
, B(t, q, p, B)
and G(t, q, p, G)
, where t
is the current time, (q, p)
is the current solution vector, and v
, f
, 'B' and G
are the variables which hold the result of evaluating the vector fields $v$, $f$ and the matrices $B$, $G$ on t
and (q,p)
.
Example
function v(λ, t, q, v)
v[1] = λ*q[1]
v[2] = λ*q[2]
end
function B(μ, t, q, B)
B[1] = μ*q[1]
B[2] = μ*q[2]
end
t₀ = 0.
q₀ = [1., 1.]
λ = 2.
μ = 1.
v_sde = (t, q, v) -> v(λ, t, q, v)
B_sde = (t, q, B) -> B(μ, t, q, B)
sde = SDE(v_sde, B_sde, t₀, q₀)
VODE
: Variational Ordinary Differential Equation
Defines an implicit initial value problem
with vector field $f$, the momentum defined by $p$, initial conditions $(q_{0}, p_{0})$ and the solution $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. This is a special case of a differential algebraic equation with dynamical variables $(q,p)$ and algebraic variable $v$.
Fields
d
: dimension of dynamical variables $q$ and $p$ as well as the vector fields $f$ and $p$α
: function determining the momentumf
: function computing the vector fieldg
: function determining the projection, given by ∇α(q)λv
: function computing an initial guess for the velocity field (optional)t₀
: initial time (optional)q₀
: initial condition forq
p₀
: initial condition forp
λ₀
: initial condition forλ
The functions α
and f
must have the interface
function α(t, q, v, p)
p[1] = ...
p[2] = ...
...
end
and
function f(t, q, v, f)
f[1] = ...
f[2] = ...
...
end
where t
is the current time, q
is the current solution vector, v
is the current velocity and f
and p
are the vectors which hold the result of evaluating the functions $f$ and $α$ on t
, q
and v
. The funtions g
and v
are specified by
function g(t, q, λ, g)
g[1] = ...
g[2] = ...
...
end
and
function v(t, q, p, v)
v[1] = ...
v[2] = ...
...
end