Integrators
Riemax provides a simple implementation of a number of numerical integrators. However, integration with these relies on standard automatic differentiation. Riemax also provides an implementation of odeint
which provides custom reverse-mode differentiation in order to compute the adjoint. If you want more options for adjoint-enabled integrators, Diffrax is a great place to start. Hopefully, we can add similar functionality here soon...
riemax.numerical.integrators
riemax.numerical.integrators.ParametersIVP
Bases: typing.NamedTuple
Parameters for the Initial Value Problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
differential_operator |
function to compute dynamics |
required | |
dt |
step size for integration |
required | |
n_steps |
total number of steps to integrate for |
required |
Source code in src/riemax/numerical/integrators.py
riemax.numerical.integrators.euler_integrator(ivp_params: ParametersIVP[T], initial_state: T) -> tuple[T, T]
Forward-Euler method for integration of the initial value problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ivp_params |
riemax.numerical.integrators.ParametersIVP[T]
|
parameters for the initial value problem |
required |
initial_state |
T
|
state at t=0 |
required |
Returns:
Name | Type | Description |
---|---|---|
final_state |
T
|
final state of the initial value problem |
full_state |
T
|
entire solution of the initial value problem |
Source code in src/riemax/numerical/integrators.py
riemax.numerical.integrators.implicit_euler_integrator(ivp_params: ParametersIVP[T], initial_state: T) -> tuple[T, T]
implicit-Euler method for integration of the initial value problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ivp_params |
riemax.numerical.integrators.ParametersIVP[T]
|
parameters for the initial value problem |
required |
initial_state |
T
|
state at t=0 to integrate from |
required |
Returns:
Name | Type | Description |
---|---|---|
final_state |
T
|
final state of the initial value problem |
full_state |
T
|
entire solution of the initial value problem |
Source code in src/riemax/numerical/integrators.py
riemax.numerical.integrators.rk4_integrator(ivp_params: ParametersIVP[T], initial_state: T) -> tuple[T, T]
Runge-Kutta (4th order) method for integration of the initial value problem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ivp_params |
riemax.numerical.integrators.ParametersIVP[T]
|
parameters for the initial value problem |
required |
initial_state |
T
|
state at t=0 to integrate from |
required |
Returns:
Name | Type | Description |
---|---|---|
final_state |
T
|
final state of the initial value problem |
full_state |
T
|
entire solution of the initial value problem |
Source code in src/riemax/numerical/integrators.py
riemax.numerical.integrators.odeint(ivp_params: ParametersIVP[T], initial_state: T) -> tuple[T, T]
DOPRI (4,5th order) method for integration of initial value problem -- adjoint compatible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ivp_params |
riemax.numerical.integrators.ParametersIVP[T]
|
parameters for the initial value problem |
required |
initial_state |
T
|
state at t=0 to integrate from |
required |
Returns:
Name | Type | Description |
---|---|---|
final_state |
T
|
final state of the initial value problem |
full_state |
T
|
entire solution of the initial value problem |