ODESolver

class probnum.diffeq.ODESolver(ivp)

Bases: abc.ABC

Interface for ODESolver.

Methods Summary

initialise()

Returns t0 and y0 (for the solver, which might be different to ivp.y0)

method_callback(time, current_guess, …)

Optional callback.

postprocess(times, rvs)

Turn list of random variables into an ODE solution object and potentially do more.

solve(firststep, steprule, **kwargs)

Solve an IVP.

step(start, stop, current, **kwargs)

Every ODE solver needs a step() method that returns a new random variable and an error estimate.

Methods Documentation

abstract initialise()[source]

Returns t0 and y0 (for the solver, which might be different to ivp.y0)

method_callback(time, current_guess, current_error)[source]

Optional callback.

Can be overwritten. Do this as soon as it is clear that the current guess is accepted, but before storing it. No return. For example: tune hyperparameters (sigma).

postprocess(times, rvs)[source]

Turn list of random variables into an ODE solution object and potentially do more. Overwrite for instance via.

>>> def postprocess(self, times, rvs):
>>> # do something with times and rvs
>>> odesol = super().postprocess(times, rvs)
>>> # do something with odesol
>>> return odesol
solve(firststep, steprule, **kwargs)[source]

Solve an IVP.

Parameters
  • firststep (float) – First step for adaptive step-size rule.

  • steprule (StepRule) – Step-size selection rule, e.g. constant steps or adaptive steps.

abstract step(start, stop, current, **kwargs)[source]

Every ODE solver needs a step() method that returns a new random variable and an error estimate.