ode_ralston2_step

ode_ralston2_step#

class braintools.quad.ode_ralston2_step(f, y, t, *args, **kwargs)#

Ralston’s 2nd-order Runge–Kutta method (minimized truncation error).

Butcher tableau#

  • c = [0, 2/3]

  • a21 = 2/3

  • b = [1/4, 3/4]

param f:

Right-hand side function f(y, t, *args) -> PyTree.

type f:

Callable[[PyTree, float | Quantity, ...], PyTree]

param y:

Current state at time t.

type y:

PyTree

param t:

Current time.

type t:

Array | ndarray | bool | number | bool | int | float | complex | Quantity

type *args:

param *args:

Additional positional arguments forwarded to f.

returns:

The updated state after one Ralston RK2 step.

rtype:

PyTree