4th Order Runge-Kutta Method
"Runge-Kutta" methods are numerical techniques used to solve differential equations. The Runge-Kutta ("RK") methods attempt to....
"......obtain greater accuracy (than Euler's method), and at the same time avoid the need for
higher derivatives, by evaluating the function f(x,t) at selected points on each sub-interval."
[Elementary Numerical Analysis, Conte & de Boor.]
There are different types of RK-Methods, classified by how many points are used within each timestep, "dt".
The method I have used, which is described below, is the "4th Order RK-Method" as it uses infomation from 4 points to move through one time-step.
For an equation of the form y'=f(x,t) with y(t0)=y0, we generate approximations yn to y(t0+n(dt)) for a fixed time-step dt and n=0,1,2,.... using the recursion formula:
yn+1 = yn + 1/6(k1 + 2k2 + 2k3 + k4)
k1 = dt x f(xn, t)
k2 = dt x f(xn + k1/2, t + dt/2)
k3 = dt x f(xn + k2/2, t + dt/2)
k4 = dt x f(xn + k3, t + dt)