Library Reference

Resource Sharers and Machines

AlgebraicDynamics.DWDDynam.ContinuousMachineType

An undirected 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 only depend on the state, so it must be of the form $r(u(t))$.

source
AlgebraicDynamics.DWDDynam.DiscreteMachineType

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 only depend on the state, so it must be of the form $r(u_n)$.

source
AlgebraicDynamics.UWDDynam.eval_dynamicsFunction
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
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
AlgebraicDynamics.UWDDynam.euler_approxFunction
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
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

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::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
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

Integration with OrdinaryDiffEq.jl and DynamicalSystems.jl

SciMLBase.ODEProblemType
ODEProblem(r::ContinuousResourceSharer, u0::Vector, tspan)

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

source
ODEProblem(m::ContinuousMachine, xs::Vector, u0::Vector, tspan)

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
DynamicalSystemsBase.DiscreteDynamicalSystemType
DiscreteDynamicalSystem(r::DiscreteResourceSharer, u0::Vector, p)

Constructs a DiscreteDynamicalSystem from the equation of motion r.dynamics(u,p,t). Pass nothing in place of p if your system does not have parameters.

source
DiscreteDynamicalSystem(m::DiscreteMachine, xs::Vector, u0::Vector, p)

Constructs an DiscreteDynamicalSystem from the equation of motion defined by (u,p,t) -> m.dynamics(u, x, p, t). The exogenous variables are determined by xs. Pass nothing in place of p if your system does not have parameters.

source
DynamicalSystemsBase.trajectoryFunction
trajectory(r::DiscreteResourceSharer, u0::AbstractVector, p, nsteps::Int; dt::Int = 1)

Evolves the resouce sharer r for nsteps times with step size dt, initial condition u0, and parameters p.

source
trajectory(m::DiscreteMachine, u0::AbstractVector, xs::AbstractVector, p, nsteps::Int; dt::Int = 1)

Evolves the machine m for nsteps times with step size dt, initial condition u0, and parameters p. Any inputs to m are determied by xs. If m has no inputs then you can omit xs.

source