Equations¶
While the internal storage of equations may differ, when they are returned
equations are usually in the form of an Equation
object.

class
myokit.
Equation
(lhs, rhs)¶ Defines an equation: a statement that a lefthand side is equal to a righthand side.
The sides of an equation are stored in the properties
lhs
andrhs
.
code
()¶

Equation lists¶
When returning a list of equations, the EquationList
type is used. This
extends the python list
type with a number of specialized iterators.

class
myokit.
EquationList
¶ Represents an ordered list of
Equation
objects
append
()¶ L.append(object) – append object to end

count
(value) → integer  return number of occurrences of value¶

count_equations
(const=None, inter=None, state=None, bound=None, deep=False)¶ Returns the number of equations matching the given criteria. See
equations()
for an explanation of the arguments.

count_variables
(const=None, inter=None, state=None, bound=None, deep=False)¶ Returns the number of variables matching the given criteria. See
variables()
for an explanation of the arguments.

equations
(const=None, inter=None, state=None, bound=None, deep=False)¶ Creates and returns a filtered iterator over the equations of this object’s variables.
The returned values can be filtered using the following arguments:
const=TrueFalseNone
Set to
True
to return only constants’ equations.False
to exclude all constants and any other value to ignore this check.For a definition of “constant variable” see
variables()
.inter=TrueFalseNone
Set to
True
to return only intermediary variables’ equations,False
to exclude all intermediary variables and any other value to ignore this check.For a definition of “intermediary variable” see
variables()
.state=TrueFalseNone
 Set to
True
to return only state variables’ equations,False
to exclude all state variables and any other value to ignore this check. bound=TrueFalseNone
 Set to
True
to return only bound variables’ equations,False
to exclude all bound variables and any other value to ignore this check. deep=TrueFalse
(by default it’sFalse
) Set to
True
to include the equations of nested variables meeting all other criteria.

extend
()¶ L.extend(iterable) – extend list by appending elements from the iterable

has_equations
(const=None, inter=None, state=None, bound=None, deep=False)¶ Returns True if there are any equations that can be returned by calling :meth:
equations
with the same arguments.

has_variable
(name)¶ Returns True if the given name corresponds to a variable in this object. Accepts both single names
x
and qualified namesx.y
as input.This function performs the same search as
variable
, so in most cases it will be more efficient to callvariable()
in a trycatch block rather than checking for existence explicitly.

has_variables
(const=None, inter=None, state=None, bound=None, deep=False)¶ Returns True if there are any variables that can be returned by calling :meth:
variables
with the same arguments.

index
(value[, start[, stop]]) → integer  return first index of value.¶ Raises ValueError if the value is not present.

insert
()¶ L.insert(index, object) – insert object before index

pop
([index]) → item  remove and return item at index (default last).¶ Raises IndexError if list is empty or index is out of range.

remove
()¶ L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.

reverse
()¶ L.reverse() – reverse IN PLACE

sort
()¶ L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) > 1, 0, 1

var
(name)¶ Searches for the given variable and returns it if found. Accepts both single names
x
and qualified namesx.y
as input.

variables
(const=None, inter=None, state=None, bound=None, deep=False, sort=False)¶ Creates and returns a filtered iterator over the contained variables.
The returned values can be filtered using the following arguments:
const=TrueFalseNone
Constants are defined as variables that do not depend on state variables or derivatives. In other words, any variable whose value can be determined before starting an ODE solving routine.
Set to
True
to return only constants,False
to exclude all constants and any other value to ignore this check.inter=TrueFalseNone
Intermediary variables are those variables that are not constant but are not part of the state. In other words, intermediary variables are the variables that need to be calculated at every step of an ODE solving routine before calculating the ODE derivatives and updating the state.
Set to
True
to return only intermediary variables,False
to exclude all intermediary variables and any other value to ignore this check.state=TrueFalseNone
 Set to True to return only state variables, False to exclude all state variables and any other value to ignore this check.
bound=TrueFalseNone
 Set to True to return only variables bound to an external value, False to exclude all bound variables and any other value to forgo this check.
deep=TrueFalse
(by default it’sFalse
) Set to True to return nested variables meeting all other criteria.
sort=TrueFalse
(by default it’sFalse
) Set to True to return the variables in a consistent order.
