Skip to content

RKN1210 Integrator

Runge-Kutta-Nyström 12(10) high-precision integrator specialized for second-order ODEs.

RKN1210Integrator

RKN1210Integrator(dimension: int, dynamics_fn: callable, jacobian: Union[DAnalyticJacobian, DNumericalJacobian] = None, sensitivity: Any = None, config: IntegratorConfig = None)

RKN12(10) Runge-Kutta-Nyström adaptive integrator (EXPERIMENTAL).

High-order specialized integrator for second-order ODEs (like orbital mechanics). More efficient and accurate than general-purpose methods for position-velocity systems.

WARNING: This integrator is experimental and may have stability issues.

Parameters:

Name Type Description Default
dimension int

State vector dimension (must be even: position + velocity)

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

Raises:

Type Description
ValueError

If dimension is not even

Example
import brahe as bh
import numpy as np

def dynamics(t, state):
    # Two-body dynamics: [r, v] -> [v, a]
    r = state[:3]
    v = state[3:]
    r_norm = np.linalg.norm(r)
    a = -bh.GM_EARTH / (r_norm**3) * r
    return np.concatenate([v, a])

config = bh.IntegratorConfig.adaptive(abs_tol=1e-9, rel_tol=1e-6)
integrator = bh.RKN1210Integrator(dimension=6, dynamics_fn=dynamics, config=config)

# Adaptive step (tolerances from config)
result = integrator.step(0.0, state, 1.0)

Initialize instance.

dimension property

dimension: Any

step method descriptor

step(t: float, state: ndarray, dt: float) -> AdaptiveStepResult

Perform one adaptive integration step.

Tolerances are read from the integrator's configuration.

Parameters:

Name Type Description Default
t float

Current time

required
state ndarray

State vector at time t [position, velocity]

required
dt float

Requested timestep

required

Returns:

Name Type Description
AdaptiveStepResult AdaptiveStepResult

Result containing new state, actual dt used, error estimate, and suggested next dt

step_with_sensmat method descriptor

step_with_sensmat(t: float, state: ndarray, sens: ndarray, params: ndarray, dt: float) -> Tuple

Advance state and sensitivity matrix with adaptive step control.

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

Requested timestep

required

Returns:

Name Type Description
tuple Tuple

(new_state, new_sensitivity, dt_used, error_estimate, dt_next)

Example
import brahe as bh
import numpy as np

# Setup integrator with Jacobian and sensitivity providers
config = bh.IntegratorConfig.adaptive(abs_tol=1e-9, rel_tol=1e-6)
integrator = bh.RKN1210Integrator(6, dynamics, jacobian, sensitivity, config)
state = np.array([...])
sens = np.zeros((6, 2))  # 6 state dims, 2 params
params = np.array([1.0, 2.0])

new_state, new_sens, dt_used, error, dt_next = integrator.step_with_sensmat(
    0.0, state, sens, params, 1.0
)

step_with_varmat method descriptor

step_with_varmat(t: float, state: ndarray, phi: ndarray, dt: float) -> Tuple

Perform one adaptive integration step with variational matrix.

Tolerances are read from the integrator's configuration.

Parameters:

Name Type Description Default
t float

Current time

required
state ndarray

State vector at time t

required
phi ndarray

State transition matrix (dimension x dimension)

required
dt float

Requested timestep

required

Returns:

Name Type Description
tuple Tuple

(new_state, new_phi, dt_used, error_estimate, dt_next)

step_with_varmat_sensmat method descriptor

step_with_varmat_sensmat(t: float, state: ndarray, phi: ndarray, sens: ndarray, params: ndarray, dt: float) -> Tuple

Advance state, variational matrix (STM), and sensitivity matrix with adaptive step control.

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

Requested timestep

required

Returns:

Name Type Description
tuple Tuple

(new_state, new_phi, new_sensitivity, dt_used, error_estimate, dt_next)

Example
import brahe as bh
import numpy as np

# Setup integrator with Jacobian and sensitivity providers
config = bh.IntegratorConfig.adaptive(abs_tol=1e-9, rel_tol=1e-6)
integrator = bh.RKN1210Integrator(6, dynamics, jacobian, sensitivity, config)
state = np.array([...])
phi = np.eye(6)
sens = np.zeros((6, 2))  # 6 state dims, 2 params
params = np.array([1.0, 2.0])

new_state, new_phi, new_sens, dt_used, error, dt_next = integrator.step_with_varmat_sensmat(
    0.0, state, phi, sens, params, 1.0
)

See Also