gncpy.math.rk4

rk4(f, x, h, **kwargs)[source]

Implements a classic Runge-Kutta integration RK4.

Parameters:
  • f (callable) – function to integrate, must take x as the first argument and arbitrary kwargs after

  • x (numpy array, or float) – state needed by function

  • h (float) – step size

Returns:

state – Integrated state

Return type:

numpy array, or float