The fourth-order Runge-Kutta, RK4, which we will employ in the solution of various differential equations below, has the following algorithm k1=hf(ti,yi)k2=hf(ti+h/2,yi+k1/2) k3=hf(ti+h/2,yi+k2/2)k4=hf(ti+h,yi+k3) with the final result yi+1=yi+16(k1+2k2+2k3+k4). Thus, the algorithm consists in first calculating k1 with ti, y1 and f as inputs. Thereafter, we increase the step size by h/2 and calculate k2, then k3 and finally k4. The global error goes as O(h4).