get_method

Contents

get_method#

class braintools.quad.get_method(name, kind='ode')#

Look up a registered one-step integrator by name.

Parameters:
  • name (str) – Short name of the method (e.g. 'rk4', 'dopri5', 'milstein'). The full public function name (e.g. 'ode_rk4_step') is accepted too.

  • kind (str) – Equation kind. Default 'ode'.

Returns:

The registered stepper.

Return type:

Callable

Raises:
  • KeyError – If no method of that name is registered for kind. The message lists the closest registered names (difflib).

  • ValueError – If kind is unknown.

  • TypeError – If name is not a string.

See also

register_method

Add a stepper to the registry.

list_methods

List the registered names.

Examples

>>> from braintools.quad import get_method, ode_rk4_step, sde_milstein_step
>>> get_method('rk4') is ode_rk4_step
True
>>> get_method('milstein', kind='sde') is sde_milstein_step
True
>>> get_method('ode_rk4_step') is ode_rk4_step
True