Integrators Types
The types module provides data structures and result containers for numerical integration.
Result Classes
- class hiten.algorithms.integrators.types.EventResult[source]
Bases:
object
Result container for a single event detection.
- y_event
Detected event state (None when hit is False).
- Type:
numpy.ndarray | None
- class hiten.algorithms.integrators.types._Solution[source]
Bases:
object
Store a discrete solution returned by an integrator.
- Parameters:
times (numpy.ndarray, shape (n,)) – Monotonically ordered time grid.
states (numpy.ndarray, shape (n, d)) – State vectors corresponding to times.
derivatives (numpy.ndarray or None, optional, shape (n, d)) – Evaluations of f(t,y) at the stored nodes. When available a cubic Hermite interpolant is employed by
interpolate()
; otherwise linear interpolation is used.
- Raises:
ValueError – If the lengths of times, states, or derivatives (when provided) are inconsistent.
Notes
The class is a dataclasses.dataclass and behaves like an immutable record.
- interpolate(t)[source]
Evaluate the trajectory at intermediate time points.
If
derivatives
are provided a cubic Hermite scheme of order three is employed on every step; otherwise straight linear interpolation is used.- Parameters:
t (float or array_like) – Query time or array of times contained in [times[0], times[-1]].
- Returns:
Interpolated state with shape (d,) when t is scalar or (m, d) when t comprises m points.
- Return type:
- Raises:
ValueError – If any entry of t lies outside the stored integration interval.
Examples
>>> sol = integrator.integrate(sys, y0, np.linspace(0, 10, 11)) >>> y_mid = sol.interpolate(5.5)