Module rk4
A classical fourth order Runge-Kutta scheme.
Butcher tableau:
0 | 1/2 | 1/2 1/2 | 0 1/2 1 | 0 0 1 +------------------- 1/6 1/3 1/3 1/6
Functions
rk4 (n) | Create an integrator for n-arrays. |
integrator (y, f, t, dt, ynew) | Integrator for n-arrays |
Functions
- rk4 (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