rk4 module
Define Runge-Kutta integraiton function.
- rk4(u: ndarray, du: Callable[[float, ndarray], ndarray], x: float, dx: float) ndarray
Compute variation of
ubetweenxandx+dx.Use 4-th order Runge-Kutta method.
Note
This is a slightly modified version of the RK. The
k_iare proportional todelta_uinstead ofdu_dz.- Parameters:
u (numpy.ndarray) – Holds the value of the function to integrate in
x.du_dx (Callable[[float, numpy.ndarray], numpy.ndarray]) – Gives the variation of
ucomponents withx.x (float) – Where
uis known.dx (float) – Integration step.
- Returns:
delta_u – Variation of
ubetweenxandx+dx.- Return type: