cottax.ode.ode_condition module

OdeCondition: each state with its rate and its initial value, x’ = r, x(t0) = x0, over one span.

class Dt[V: Place](state: V, rate: V, initial: V)[source]

Bases: Frozen, Generic[V]

x’ = r from x(t0) = x0: state changes at the rate held at rate, starting from the value held at initial.

state: V
rate: V
initial: V
relabel(renaming: Renaming[V])[source]
Return type:

Dt[V]

class OdeCondition[V: Place](relations: tuple[Dt[V], ...], span: V)[source]

Bases: ConditionalNode[V], Generic[V]

x’ = r from x0 per relation, over the span: an initial-value problem, so one solution. It determines exactly its states, so it is always a problem: outside its cycle a state is its value at t1; inside, the current state. The initial values and the span are its parameters, held fixed while it is integrated. Supports addition.

relations: tuple[Dt[V], ...]

A state twice, or a state that is a rate or an initial value, is core’s refusal (OwnsTwice, ReadsOwn).

span: V

one for every state.

Type:

Where (t0, t1) is read

property states: tuple[V, ...]
property rates: tuple[V, ...]
property initials: tuple[V, ...]
property parameters: tuple[V, ...]

The initial values, then the span.

property unknowns: tuple[V, ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property conditions: tuple[V, ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property reads: tuple[V, ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property owns: tuple[V, ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

determined(unknowns: tuple[V, ...])[source]

Itself, handed exactly its states: what it determines is not edited.

Return type:

OdeCondition[V]

relabel(renaming: Renaming[V])[source]

The same definition with its places renamed.

Return type:

OdeCondition[V]

is_ode(node: object)[source]

An ODE: what an integrator answers.

Return type:

bool

class DeterminesItsStates(states: tuple, unknowns: tuple)[source]

Bases: Violation

states: tuple
unknowns: tuple
template: AbstractClassVar[str] = 'an ODE determines its states and nothing else: {states!r}, not {unknowns!r}'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class SpansDiffer(span: object, other: object)[source]

Bases: Violation

span: object
other: object
template: AbstractClassVar[str] = 'two ODEs over {span!r} and {other!r} are not one integration: read one span in both (`span=` the same place, or a `Rename`) before joining them'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording