However the truncation error generated by this method has to be understood in order to make a good use of it.
Consider the following differential equation:
y'=f(x,y) ,
with y(x_{0}) = K (initial or starting value of y)
We wish to approximate the solution to this equation over the interval [a,b]. Let divide this interval into n smaller intervals of size h. A numerical approximation to the above differential equation may be obtained using the 4th order Runge Kutta method as follows.
let y_{0} = K
y_{i+1} = y_{i} + (1/6) [k1 + 2k2 + 2k3 + k4]
for i=0,1,...,n1
where
y_{0} = K (starting value)
k1 = hf(x_{i},y_{i}) ,
k2 = hf(x_{i}+h/2,y_{i}+k1/2) ,
k3 = hf(x_{i}+h/2,y_{i}+k2/2) ,
k4 = hf(x_{i}+h,y_{i}+k3)
The local truncation error is of the order O(h_{5}) and in principle decreases as h decreases.
The exploration is carried by changing the step size h.
TUTORIAL
All the differential equations used in the applet have the same initial value y(0) = 1 and exact solutions for comparison.
1  click on the button above "click here to start" and MAXIMIZE the window obtained.
2  Select the first (left panel, top) differential equation y' = x^{2}. At the start h = 1.25 and n = 8. Examine the exact (ex value) solution and the approximate (ap value) one on the left panel. Decrease h by increasing n, read h and n top right. Any differences?
3  Select the second diffenrial equation y' = x^{4}. Explore by deceasing h and compare the exact and approximate values.
4  Select the two other differential equations and analyze the results. Compare the exact and approximate values.
More references on differential equations.
Introduction to Differential Equations
