verry.integrate.Integrator#

class verry.integrate.Integrator#

Bases: ABC, Generic

Abstract base class for ODE integrators.

This class is usually not instantiated directly, but is created by IntegratorFactory.

Variables:
  • status (Literal["FAILURE", "RUNNING", "SUCCESS", "WAITING"]) – Current status of the integrator.

  • t (Interval) – Current time.

  • y (tuple[Interval, ...]) – Current state.

  • t_bound (Interval) – Boundary time.

  • t_prev (Interval) – Previous time.

  • series (tuple[IntervalSeries, ...]) – Current interval series.

  • order (int) – Degree of series.

Warning

The values of t, y, t_prev, and series are undefined if step() has not been invoked or if the previous execution resulted in failure.

fun must be a \(C^\infty\)-function on some open interval that contains t0 and t_bound. Furthermore, fun must neither be a constant nor contain conditional branches (cf. Common pitfalls).

Notes

The implementation of Integrator must satisfy the following conditions:

  • t and t_prev are always disjoint.

  • If status is "RUNNING", the graph of the solution intersects the Cartesian product of t and y.

  • If status is "RUNNING" and the last called method is step(), the infimum and supremum of t are equal.

  • If status is "SUCCESS", t equals t_bound, and y contains the image of t_bound under the solution.

Here \(\phi(t;t_0,y_0)\) denotes a time-dependent flow of ODEs. Suppose that \((t_{\rm prev},y_{\rm prev})\) is an arbitrary element of the Cartesian product of \([t_{\rm prev}]\) and \([y_{\rm prev}]\). Let \(d\) be order, and \(q_{\rm apx}(s)\) be a (\(d-1\))-th order Taylor polynomial of \(\phi(t_{\rm prev}+s;t_{\rm prev},y_{\rm prev})\). Also, let \([p(s)]=[p_{\rm apx}(s)]+[a]s^d\) be series, assuming that the degree of \([p_{\rm apx}(s)]\) is smaller than \(d\). Then \([p(s)]\) must satisfy the following conditions:

  • \(q_{\rm apx}(s)\in[p_{\rm apx}(s)]\) holds coefficient-wise.

  • \(\phi(t_{\rm prev}+s;t_{\rm prev},y_{\rm prev})-q_{\rm apx}(s)\in [a]s^d\) holds for all \(s\in(0,t-t_{\rm prev})\).

is_active()#

Return True if and only if status is "RUNNING" or "WAITING".

abstractmethod step()#

Perform one integration step.

Returns:

  • r0 (bool) – r0 is True if and only if status is not "FAILURE".

  • r1 (str | None) – r1 is None If r0 is True; otherwise, r1 describes the reason for failure.

Raises:

RuntimeError – If status is "FAILURE" or "SUCCESS".

abstractmethod update(t_next, y_next)#

Receive a state, usually refined by Tracker.

t and y are updated to t_next and y_next.

Parameters:
Raises:
  • ValueError – If t_next is not included in t_prev | t.

  • RuntimeError – If status is neither "RUNNING" nor "SUCCESS".