WrappedScipyRungeKutta¶
- class probnum.diffeq.perturbed.scipy_wrapper.WrappedScipyRungeKutta(solver_type, steprule)¶
Bases:
ODESolver
Wrapper for Runge-Kutta methods from SciPy.
Methods Summary
attempt_step
(state, dt)Perform one ODE-step from start to stop and set variables to the corresponding values.
Compute the interpolant after each step.
initialize
(ivp)Return t0 and y0 (for the solver, which might be different to ivp.y0) and initialize the solver.
method_callback
(state)Call dense output after each step and store the interpolants.
perform_full_step
(state, initial_dt)Perform a full ODE solver step.
postprocess
(odesol)Process the ODESolution object before returning.
rvlist_to_odesol
(times, rvs)Create a ScipyODESolution object which is a subclass of diffeq.ODESolution.
solution_generator
(ivp[, stop_at, callbacks])Generate ODE solver steps.
solve
(ivp[, stop_at, callbacks])Solve an IVP.
Methods Documentation
- Parameters
solver_type (RungeKutta) –
- attempt_step(state, dt)[source]¶
Perform one ODE-step from start to stop and set variables to the corresponding values.
To specify start and stop directly, rk_step() and not _step_impl() is used.
- Parameters
state (ODESolverState) – Current state of the ODE solver.
- Returns
New state.
- Return type
_odesolver_state.ODESolverState
- dense_output()[source]¶
Compute the interpolant after each step.
- Returns
sol – Interpolant between the last and current location.
- Return type
rk.RkDenseOutput
- initialize(ivp)[source]¶
Return t0 and y0 (for the solver, which might be different to ivp.y0) and initialize the solver. Reset the solver when solving the ODE multiple times, i.e. explicitly setting y_old, t, y and f to the respective initial values, otherwise those are wrong when running the solver twice.
- Returns
self.ivp.t0 (float) – initial time point
self.ivp.initrv (randvars.RandomVariable) – initial random variable
- perform_full_step(state, initial_dt)¶
Perform a full ODE solver step.
This includes the acceptance/rejection decision as governed by error estimation and steprule.
- postprocess(odesol)¶
Process the ODESolution object before returning.
- rvlist_to_odesol(times, rvs)[source]¶
Create a ScipyODESolution object which is a subclass of diffeq.ODESolution.
- Parameters
times (array) –
rvs (array) –
- solution_generator(ivp, stop_at=None, callbacks=None)¶
Generate ODE solver steps.
- Parameters
ivp (problems.InitialValueProblem) –
stop_at (Iterable[FloatLike]) –
callbacks (Optional[CallbackType]) –
- solve(ivp, stop_at=None, callbacks=None)¶
Solve an IVP.
- Parameters
ivp (problems.InitialValueProblem) – Initial value problem.
stop_at (Iterable[FloatLike]) – Time-points through which the solver must step. Optional. Default is None.
callbacks (Optional[CallbackType]) – Callbacks to happen after every accepted step.