Developer reference

Listing solvers

nbkode.get_groups()[source]

Get group names.

nbkode.get_solvers(*groups, implicit=None, fixed_step=None, runge_kutta=None, multistep=None)[source]

Get available solvers.

Parameters
  • groups (str) – name of the group to filter

  • implicit (bool) – if True, only implicit solvers will be returned.

  • fixed_step (bool) – if True, only fixed step solvers will be returned.

Return type

tuple(Solver)

Solvers

Fixed step

class nbkode.ForwardEuler(*args, first_stepper_cls='auto', **kwargs)[source]

The simple explicit (forward) Euler scheme

y[n+1] = y[n] + h * f(t[n], y[n])


class nbkode.BackwardEuler(*args, first_stepper_cls='auto', **kwargs)[source]

The simple implicit (backward) Euler scheme

y[n+1] = y[n] + h * f(t[n+1], y[n+1])


class nbkode.AdamsBashforth1(*args, first_stepper_cls='auto', **kwargs)[source]

The Adams–Bashforth method with ONE is equivalent to Euler


class nbkode.AdamsBashforth2(*args, first_stepper_cls='auto', **kwargs)[source]

The Adams–Bashforth method with TWO.

u[n+1] = u[n] + h * (3/2 *f(u[n], t[n]) - 1/2 * f(u[n-1], t[n-1]))

class nbkode.AdamsBashforth3(*args, first_stepper_cls='auto', **kwargs)[source]

The Adams–Bashforth method with THREE.

u[n+1] = u[n] + h /12 .*(23*f(u[n], t[n]) - 16*f(u[n-1], t[n-1])
                        + 5*f(u[n-2], t[n-2]))

class nbkode.AdamsBashforth4(*args, first_stepper_cls='auto', **kwargs)[source]

The Adams–Bashforth method with FOUR.

u[n+1] = u[n] + h / 24 .* (55.*f(u[n], t[n]) - 59*f(u[n-1], t[n-1]) +
                           37*f(u[n-2], t[n-2]) - 9*f(u[n-3], t[n-3]))

class nbkode.AdamsBashforth5(*args, first_stepper_cls='auto', **kwargs)[source]

class nbkode.AdamsMoulton1(*args, first_stepper_cls='auto', **kwargs)[source]

class nbkode.AdamsMoulton2(*args, first_stepper_cls='auto', **kwargs)[source]

class nbkode.AdamsMoulton3(*args, first_stepper_cls='auto', **kwargs)[source]

class nbkode.AdamsMoulton4(*args, first_stepper_cls='auto', **kwargs)[source]

class nbkode.AdamsMoulton5(*args, first_stepper_cls='auto', **kwargs)[source]

Variable step

class nbkode.DOP853(*args, **kwargs)[source]

Explicit Runge-Kutta method of order 8.

This is a Python implementation of “DOP853” algorithm originally written in Fortran 4, 5. Note that this is not a literate translation, but the algorithmic core and coefficients are the same. Can be applied in the complex domain.

References

4

E. Hairer, S. P. Norsett G. Wanner, “Solving Ordinary Differential Equations I: Nonstiff Problems”, Sec. II.

5

Page with original Fortran code of DOP853.


class nbkode.RungeKutta23(*args, **kwargs)[source]

Explicit Runge-Kutta method of order 3(2).

This uses the Bogacki-Shampine pair of formulas 1. The error is controlled assuming accuracy of the second-order method, but steps are taken using the third-order accurate formula (local extrapolation is done). A cubic Hermite polynomial is used for the dense output. Can be applied in the complex domain.

References

1

P. Bogacki, L.F. Shampine, “A 3(2) Pair of Runge-Kutta Formulas”, Appl. Math. Lett. Vol. 2, No. 4. pp. 321-325, 1989.


class nbkode.RungeKutta45(*args, **kwargs)[source]

Explicit Runge-Kutta method of order 5(4).

This uses the Dormand-Prince pair of formulas 2. The error is controlled assuming accuracy of the fourth-order method accuracy, but steps are taken using the fifth-order accurate formula (local extrapolation is done). A quartic interpolation polynomial is used for the dense output 3. Can be applied in the complex domain.

References

2

J. R. Dormand, P. J. Prince, “A family of embedded Runge-Kutta formulae”, Journal of Computational and Applied Mathematics, Vol. 6, No. 1, pp. 19-26, 1980.

3

L. W. Shampine, “Some Practical Runge-Kutta Formulas”, Mathematics of Computation,, Vol. 46, No. 173, pp. 135-150, 1986.