Dynamical System Protocols
The protocols module provides abstract interfaces for dynamical systems using Python protocols.
_DynamicalSystemProtocol()
The _DynamicalSystemProtocol class defines the minimal interface that any dynamical system must implement to be compatible with the integrator framework.
- class hiten.algorithms.dynamics.protocols._DynamicalSystemProtocol[source]
Bases:
ProtocolDefine the protocol for the minimal interface for dynamical systems.
This protocol specifies the required attributes that any dynamical system must implement to be compatible with the integrator framework. It uses structural typing to allow duck typing while maintaining type safety.
- rhs
Right-hand side function f(t, y) that computes the time derivative dy/dt given time t and state vector y.
- Type:
Callable[[float, ndarray], ndarray]
Notes
The @runtime_checkable decorator allows isinstance() checks against this protocol at runtime, enabling flexible type validation.
_HamiltonianSystemProtocol()
The _HamiltonianSystemProtocol class extends the base dynamical system protocol with Hamiltonian-specific methods required by symplectic integrators.
- class hiten.algorithms.dynamics.protocols._HamiltonianSystemProtocol[source]
Bases:
_DynamicalSystemProtocol,ProtocolDefine the protocol for the interface for Hamiltonian dynamical systems.
Extends the base dynamical system protocol with Hamiltonian-specific methods required by symplectic integrators. Provides access to partial derivatives and polynomial representation of the Hamiltonian.
See also
_DynamicalSystemProtocolBase protocol
_HamiltonianSystemConcrete implementation
- property n_dof: int
Number of degrees of freedom.
- Returns:
Degrees of freedom count. Total state dimension is 2 * n_dof.
- Return type: