Numerical Recipes-based ODESolve

These classes are an adaptation of the very nice Numerical Recipes ODE solvers into Python. The solver is divided into two parts: specific step iterators (eg Dopri853) and the framework for stepping through the ODE (steppers)

Steppers and helpers

class pynlo.util.ode_solve.steppers.Output(nsaves=None)[source]

The output class is used by the ode solver to store the integrated output at specified x values. In addition to housing the matrices containing the x and y data, the class also provides a simple function call to store new data and resizes the output grids dynamically.

Parameters:nsaves – Number of anticipated save points, used for calculating value of x at which integrand will be evaluted and saved.
init(neqn, xlo, xhi, dtype=<type 'numpy.float64'>)[source]

Setup routine, which creates the output arrays. If nsaves was provided at class initialization, the positions at which the integrand will be saved are also calculated.

Parameters:
  • neqn – Number of equations, or the number of y values at each x.
  • xlo – Lower bound of integration (start point.)
  • xhi – Upper bound of integration (stop point.)
  • dtype – Data type of each y. Any Python data type is acceptable.
out(nstp, x, y, s, h)[source]

nstp is current step number, current values are x & y, Stepper is s and step size is h

class pynlo.util.ode_solve.steppers.StepperBase(yy, dydxx, xx, atoll, rtoll, dense)[source]
class pynlo.util.ode_solve.steppers.ODEint(ystartt, xx1, xx2, atol, rtol, h1, hminn, outt, stepper_class, RHS_class, dense=True, dtype=None)[source]

Dormand-Prince 853 Stepper

class pynlo.util.ode_solve.dopr853.StepperDopr853(yy, dydxx, xx, atoll, rtoll, dens)[source]

Bases: pynlo.util.ode_solve.steppers.StepperBase