beam_calculation.integrators.rk4 module
Define Runge-Kutta integraiton function.
- rk4(u: ndarray, du: Callable[[float, ndarray], ndarray], x: float, dx: float) ndarray
Compute variation of
u
betweenx
andx+dx
.Use 4-th order Runge-Kutta method.
Note
This is a slightly modified version of the RK. The
k_i
are proportional todelta_u
instead ofdu_dz
.- Parameters:
u (np.ndarray) – Holds the value of the function to integrate in
x
.du_dx (Callable[[float, np.ndarray], np.ndarray]) – Gives the variation of
u
components withx
.x (float) – Where
u
is known.dx (float) – Integration step.
- Returns:
delta_u – Variation of
u
betweenx
andx+dx
.- Return type:
np.ndarray