# Library Reference

## Resource Sharers and Machines

AlgebraicDynamics.DWDDynam.ContinuousMachineType
ContinuousMachine{T}(ninputs, nstates, noutputs, f, r)

An directed open continuous system. The dynamics function f defines an ODE $\dot u(t) = f(u(t),x(t),p,t)$ where $u$ is the state and $x$ captures the exogenous variables.

The readout function may depend on the state, parameters, and time, so it must be of the form $r(u,p,t)$.

source
AlgebraicDynamics.DWDDynam.DiscreteMachineType
DiscreteMachine{T}(ninputs, nstates, noutputs, f, r)

A directed open discrete dynamical system. The dynamics function f defines a discrete update rule $u_{n+1} = f(u_n, x_n, p, t)$ where $u_n$ is the state and $x_n$ is the value of the exogenous variables at the $n$th time step.

The readout function may depend on the state, parameters, and time step, so it must be of the form $r(u_n,p,n)$.

source
AlgebraicDynamics.UWDDynam.eval_dynamicsFunction
eval_dynamics(m::AbstractMachine, u::AbstractVector, xs:AbstractVector, p, t)

Evaluates the dynamics of the machine m at state u, parameters p, and time t. The exogenous variables are set by xs which may either be a collection of functions $x(t)$ or a collection of constant values.

The length of xs must equal the number of inputs to m.

source
eval_dynamics(r::AbstractResourceSharer, u::AbstractVector, p, t)

Evaluates the dynamics of the resource sharer r at state u, parameters p, and time t.

Omitting t and p is allowed if the dynamics of r does not depend on them.

source
AlgebraicDynamics.UWDDynam.euler_approxFunction
euler_approx(m::ContinuousMachine, h)

Transforms a continuous machine m into a discrete machine via Euler's method with step size h. If the dynamics of m is given by $\dot{u}(t) = f(u(t),x(t),p,t)$ the the dynamics of the new discrete system is given by the update rule $u_{n+1} = u_n + h f(u_n, x_n, p, t)$.

source
euler_approx(m::ContinuousMachine)

Transforms a continuous machine m into a discrete machine via Euler's method where the step size is introduced as a new parameter, the last in the list of parameters.

source
euler_approx(r::ContinuousResourceSharer, h)

Transforms a continuous resource sharer r into a discrete resource sharer via Euler's method with step size h. If the dynamics of r is given by $\dot{u}(t) = f(u(t),p,t)$ the the dynamics of the new discrete system is given by the update rule $u_{n+1} = u_n + h f(u_n, p, t)$.

source
euler_approx(r::ContinuousResourceSharer)

Transforms a continuous resource sharer r into a discrete resource sharer via Euler's method where the step size is introduced as a new parameter, the last in the list of parameters.

source

## oapply

AlgebraicDynamics.UWDDynam.fillsFunction
fills(r::AbstractResourceSharer, d::AbstractUWD, b::Int)

Checks if r is of the correct signature to fill box b of the undirected wiring diagram d.

source
Catlab.WiringDiagrams.WiringDiagramAlgebras.oapplyFunction
oapply(d::WiringDiagram, ms::Vector)

Implements the operad algebras for directed composition of dynamical systems given a composition pattern (implemented by a directed wiring diagram d) and primitive systems (implemented by a collection of machines ms).

Each box of the composition pattern d is filled by a machine with the appropriate type signature. Returns the composite machine.

source
oapply(d::WiringDiagram, m::AbstractMachine)

A version of oapply where each box of d is filled with the machine m.

source
oapply(d::WiringDiagram, generators::Dict)

A version of oapply where generators is a dictionary mapping the name of each box to its corresponding machine.

source
 oapply(d::AbstractUWD, rs::Vector)

Implements the operad algebras for undirected composition of dynamical systems given a composition pattern (implemented by an undirected wiring diagram d) and primitive systems (implemented by a collection of resource sharers rs). Returns the composite resource sharer.

Each box of d must be filled by a resource sharer of the appropriate type signature.

source
oapply(d::AbstractUWD, r::AbstractResourceSharer)

A version of oapply where each box of d is filled with the resource sharer r.

source
 oapply(d::AbstractUWD, generators::Dict)

A version of oapply where generators is a dictionary mapping the name of each box to its corresponding resource sharer.

source
oapply(d::OpenCPortGraph, ms::Vector)

Implements the operad algebras for directed composition of dynamical systems given a composition pattern (implemented by an open circular port graph d) and primitive systems (implemented by a collection of machines ms).

Each box of the composition pattern d is filled by a machine with the appropriate type signature. Returns the composite machine.

source
oapply(d::OpenCPortGraph, m::AbstractMachine)

A version of oapply where each box of d is filled with the machine m.

source

## Integration with OrdinaryDiffEq.jl and DynamicalSystems.jl

SciMLBase.ODEProblemType
ODEProblem(m::ContinuousMachine, xs::Vector, u0::Vector, tspan, p=nothing; kwargs...)

Constructs an ODEProblem from the vector field defined by (u,p,t) -> m.dynamics(u, x, p, t). The exogenous variables are determined by xs.

source
ODEProblem(r::ContinuousResourceSharer, u0::Vector, tspan)

Constructs an ODEProblem from the vector field defined by r.dynamics(u,p,t).

source
Missing docstring.

Missing docstring for DiscreteDynamicalSystem. Check Documenter's build log for details.

Missing docstring.

Missing docstring for trajectory. Check Documenter's build log for details.