Module rk2
A simple yet stable second order Runge-Kutta scheme (Heun's method).
Butcher tableau:
0 | 1 | 1 +---------- 1/2 1/2
Functions
rk2 (n) | Create an integrator for n-arrays. |
integrator (y, f, t, dt, ynew) | Integrator for n-arrays |
Functions
- rk2 (n)
-
Create an integrator for n-arrays.
Parameters:
- n number of variables (length of the array)
Returns:
-
Integrator for n-arrays
- integrator (y, f, t, dt, ynew)
-
Integrator for n-arrays
Parameters:
- y variables at time t
- f function to calculate the time derivatives of the variables
- t time
- dt time integration step
- ynew n-array (buffer) to store the new y-value
Returns:
- t+dt (incremented time)
- ynew array with variables at time t+dt