Interface Functions
SymbolicIndexingInterface.is_variable
— Functionis_variable(sys, sym)
Check whether the given sym
is a variable in sys
.
SymbolicIndexingInterface.variable_index
— Functionvariable_index(sys, sym, [i])
Return the index of the given variable sym
in sys
, or nothing
otherwise. If constant_structure
is false
, this accepts the current time index as an additional parameter i
.
SymbolicIndexingInterface.variable_symbols
— Functionvariable_symbols(sys, [i])
Return a vector of the symbolic variables being solved for in the system sys
. If constant_structure(sys) == false
this accepts an additional parameter indicating the current time index. The returned vector should not be mutated.
SymbolicIndexingInterface.is_parameter
— Functionis_parameter(sys, sym)
Check whether the given sym
is a parameter in sys
.
SymbolicIndexingInterface.parameter_index
— Functionparameter_index(sys, sym)
Return the index of the given parameter sym
in sys
, or nothing
otherwise.
SymbolicIndexingInterface.parameter_symbols
— Functionparameter_symbols(sys)
Return a vector of the symbolic parameters of the given system sys
. The returned vector should not be mutated.
SymbolicIndexingInterface.is_independent_variable
— Functionis_independent_variable(sys, sym)
Check whether the given sym
is an independent variable in sys
. The returned vector should not be mutated.
SymbolicIndexingInterface.independent_variable_symbols
— Functionindependent_variable_symbols(sys)
Return a vector of the symbolic independent variables of the given system sys
.
SymbolicIndexingInterface.is_observed
— Functionis_observed(sys, sym)
Check whether the given sym
is an observed value in sys
.
SymbolicIndexingInterface.observed
— Functionobserved(sys, sym, [states])
Return the observed function of the given sym
in sys
. The returned function should have the signature (u, p) -> [values...]
where u
and p
is the current state and parameter vector. If istimedependent(sys) == true
, the function should accept the current time t
as its third parameter. If constant_structure(sys) == false
, accept a third parameter which can either be a vector of symbols indicating the order of states or a time index which identifies the order of states.
See also: is_time_dependent
, constant_structure
SymbolicIndexingInterface.is_time_dependent
— Functionis_time_dependent(sys)
Check if sys
has time as (one of) its independent variables.
SymbolicIndexingInterface.constant_structure
— Functionconstant_structure(sys)
Check if sys
has a constant structure. Constant structure systems do not change the number of variables or parameters over time.
Traits
SymbolicIndexingInterface.ScalarSymbolic
— Typestruct ScalarSymbolic <: SymbolicTypeTrait end
Trait indicating a type is a scalar symbolic variable.
See also: ArraySymbolic
, NotSymbolic
, symbolic_type
SymbolicIndexingInterface.ArraySymbolic
— Typestruct ArraySymbolic <: SymbolicTypeTrait end
Trait indicating type is a symbolic array. Calling collect
on a symbolic array must return an AbstractArray
containing ScalarSymbolic
variables for each element in the array, in the same shape as the represented array. For example, if a
is a symbolic array representing a 2x2 matrix, collect(a)
must return a 2x2 array of scalar symbolic variables.
See also: ScalarSymbolic
, NotSymbolic
, symbolic_type
SymbolicIndexingInterface.NotSymbolic
— Typestruct NotSymbolic <: SymbolicTypeTrait end
Trait indicating a type is not symbolic.
See also: ScalarSymbolic
, ArraySymbolic
, symbolic_type
SymbolicIndexingInterface.symbolic_type
— Functionsymbolic_type(x) = symbolic_type(typeof(x))
-symbolic_type(::Type)
Get the symbolic type trait of a type. Default to NotSymbolic
for all types except Symbol
.
See also: ScalarSymbolic
, ArraySymbolic
, NotSymbolic
SymbolicIndexingInterface.hasname
— Functionhasname(x)
Check whether the given symbolic variable (for which symbolic_type(x) != NotSymbolic()
) has a valid name as per getname
.
SymbolicIndexingInterface.getname
— Functiongetname(x)::Symbol
Get the name of a symbolic variable as a Symbol
Types
SymbolicIndexingInterface.SymbolCache
— Typestruct SymbolCache{V,P,I}
-function SymbolCache(vars, [params, [indepvars]])
A struct implementing the symbolic indexing interface for the trivial case of having a vector of variables, parameters and independent variables. This struct does not implement observed
, and is_observed
returns false
for all input symbols. It is considered to be time dependent if it contains at least one independent variable.