rk4 module

Define Runge-Kutta integraiton function.

rk4(u, du, x, dx)[source]

Compute variation of u between x and x+dx.

Use 4-th order Runge-Kutta method.

Note

This is a slightly modified version of the RK. The k_i are proportional to du instead of du/dx.

Parameters:
Return type:

ndarray[tuple[Any, ...], dtype[double]]

Returns:

Variation of u between x and x+dx.

rk4_2d(u, v, delta, x, dx)[source]

Compute variation of u and v between x and x+dx.

Use 4-th order Runge-Kutta method. u and v are scalar. This version is rk4() but with two dimensions only.

Note

This is a slightly modified version of the RK. The k_i are proportional to delta_u instead of du_dz.

Parameters:
Return type:

tuple[float, float]

Returns:

Variation of u and v between x and x+dx.