RK4 Integrator¶
Classical 4th-order Runge-Kutta integrator for fixed-step integration.
RK4Integrator ¶
RK4Integrator(dimension: int, dynamics_fn: callable, jacobian: Union[DAnalyticJacobian, DNumericalJacobian] = None, sensitivity: Any = None, control_fn: Any = None, config: IntegratorConfig = None)
4th-order Runge-Kutta fixed-step integrator.
Classical RK4 method with fixed timesteps. Provides good accuracy for most problems with 4th-order error convergence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension | int | State vector dimension | required |
dynamics_fn | callable | Dynamics function with signature (t: float, state: ndarray) -> ndarray | required |
jacobian | DAnalyticJacobian or DNumericalJacobian | Jacobian provider for variational matrix propagation | None |
config | IntegratorConfig | Integration configuration | None |
Example
Initialize instance.
step method descriptor ¶
step_with_sensmat method descriptor ¶
step_with_sensmat(t: float, state: ndarray, sens: ndarray, params: ndarray, dt: float = None) -> Tuple
Advance state and sensitivity matrix by one timestep.
Propagates the sensitivity matrix S that maps parameter uncertainties to state uncertainties. The sensitivity evolves according to dS/dt = A*S + B.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t | float | Current time | required |
state | ndarray | State vector at time t | required |
sens | ndarray | Sensitivity matrix at time t (state_dim x param_dim) | required |
params | ndarray | Parameter vector | required |
dt | float | Integration timestep | None |
Returns:
| Name | Type | Description |
|---|---|---|
tuple | Tuple | (new_state, new_sensitivity) |
Example
step_with_varmat method descriptor ¶
Perform one integration step with variational matrix propagation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t | float | Current time | required |
state | ndarray | State vector at time t | required |
phi | ndarray | State transition matrix at time t (dimension × dimension) | required |
dt | float | Timestep. If None, uses the step size from configuration. | None |
Returns:
| Name | Type | Description |
|---|---|---|
tuple | Tuple | (new_state, new_phi) - State vector and STM at time t + dt |
step_with_varmat_sensmat method descriptor ¶
step_with_varmat_sensmat(t: float, state: ndarray, phi: ndarray, sens: ndarray, params: ndarray, dt: float = None) -> Tuple
Advance state, variational matrix (STM), and sensitivity matrix by one timestep.
Propagates both matrices simultaneously for complete uncertainty quantification: - STM (Phi): Maps initial state uncertainties to current state uncertainties - Sensitivity (S): Maps parameter uncertainties to state uncertainties
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t | float | Current time | required |
state | ndarray | State vector at time t | required |
phi | ndarray | State transition matrix at time t (state_dim x state_dim) | required |
sens | ndarray | Sensitivity matrix at time t (state_dim x param_dim) | required |
params | ndarray | Parameter vector | required |
dt | float | Integration timestep | None |
Returns:
| Name | Type | Description |
|---|---|---|
tuple | Tuple | (new_state, new_phi, new_sensitivity) |
Example
See Also¶
- Fixed-Step Integrators - Detailed guide on fixed-step integration
- Integrators Module - Overview of all integrators
- Configuration - Integrator configuration reference