Runge-Kutta Method

The Euler method uses the first order Taylor series to find the next value of the ordinary differential equation. Therefore, this method is not very accurate. To achieve higher accuracy, Runge-Kutta method employs higher order terms of the Taylor series in its approximation. For example the second order Runge-Kutta method uses the Taylor series up to he second order term.

where,

Using the mathematical relations, it can be demonstrated that the above equation can be written in the following form:

where,
A1, A2, P1 and Q11 are some constant which can be obtained from following system of equations:

It is clear that the number of unknowns are more than the number of equations. Therefore, a series of solution can be found for these constants.

For A1 = A2 = ½ and P1 = Q11 = 1 the general Runge-Kutta method is transformed to the following form:

This method is known as Heun’s method with single corrector.

For A1 =0, A2 = 1 and P1 = Q11 = ½  the general Runge-Kutta method can be written as follows:

This method is known as improved polygon method.

For A1 =1/3, A2 = 2/3 and P1 = Q11 = ¾, the Ralston’s method can be obtained:

The order of all above methods is O(h2). The algorithm of the Heun’s method can written as follows:

 

Step 1: Choose initial point (x0,y0) and end point xn.

Step 2: For i=1 to n do steps 3,6.

Step 3: xi = x0 + ih.

Step 4: k1 = f(xi-1 , yi-1).

Step 5: k2 = f(xi , yi-1 + hk1).

Step 6: yi = yi-1 + h(k1 + k2)/2.

Step 5: End.

 
 
Ordinary Differential Equations                               
            (Source Code in C++)                                                   

o        Euler Method                                                              

o        Runge-Kutta Method                                                    

                                                                                
 
 
Comments