amici.ode_model.State
- class amici.ode_model.State(identifier, name, init, dt)[source]
A State variable defines an entity that evolves with time according to the provided time derivative, abbreviated by
x
.- Variables
_conservation_law – algebraic formula that allows computation of this state according to a conservation law
_dt – algebraic formula that defines the temporal derivative of this state
- __init__(identifier, name, init, dt)[source]
Create a new State instance. Extends
ModelQuantity.__init__()
bydt
- Parameters
identifier (
sympy.core.symbol.Symbol
) – unique identifier of the statename (
str
) – individual name of the state (does not need to be unique)init (
sympy.core.expr.Expr
) – initial valuedt (
sympy.core.expr.Expr
) – time derivative
Methods Summary
__init__
(identifier, name, init, dt)Create a new State instance.
get_dt
()Gets the time derivative
get_dx_rdata_dx_solver
(state_id)Returns the expression that allows computation of
dx_rdata_dx_solver
for this state, accounting for conservation laws.Gets the set of free symbols in time derivative and initial conditions
get_id
()ModelQuantity identifier
get_name
()ModelQuantity name
get_val
()ModelQuantity value
Returns the expression that allows computation of x_rdata for this state, accounting for conservation laws.
Checks whether this state has a conservation law assigned.
set_conservation_law
(law)Sets the conservation law of a state.
set_dt
(dt)Sets the time derivative
set_val
(val)Set ModelQuantity value
Methods
- __init__(identifier, name, init, dt)[source]
Create a new State instance. Extends
ModelQuantity.__init__()
bydt
- Parameters
identifier (
sympy.core.symbol.Symbol
) – unique identifier of the statename (
str
) – individual name of the state (does not need to be unique)init (
sympy.core.expr.Expr
) – initial valuedt (
sympy.core.expr.Expr
) – time derivative
- get_dx_rdata_dx_solver(state_id)[source]
Returns the expression that allows computation of
dx_rdata_dx_solver
for this state, accounting for conservation laws.- Returns
dx_rdata_dx_solver expression
- get_free_symbols()[source]
Gets the set of free symbols in time derivative and initial conditions
- Return type
- Returns
free symbols
- get_id()
ModelQuantity identifier
- Return type
- Returns
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type
- Returns
value of the ModelQuantity
- get_x_rdata()[source]
Returns the expression that allows computation of x_rdata for this state, accounting for conservation laws.
- Returns
x_rdata expression
- has_conservation_law()[source]
Checks whether this state has a conservation law assigned.
- Returns
True if assigned, False otherwise
- set_conservation_law(law)[source]
Sets the conservation law of a state.
If a conservation law is set, the respective state will be replaced by an algebraic formula according to the respective conservation law.
- Parameters
law (
amici.ode_model.ConservationLaw
) – linear sum of states that if added to this state remain constant over time- Return type
- set_dt(dt)[source]
Sets the time derivative
- Parameters
dt (
sympy.core.expr.Expr
) – time derivative- Return type
- set_val(val)
Set ModelQuantity value
- Returns
value of the ModelQuantity