"); hg.document.close(); } function ptip(){ hg=window.open('','','toolbar=no,width=400,height=100,top=0,left=0'); hg.document.open(); hg.document.writeln(""); hg.document.writeln("Positive definite "); hg.document.close(); } function sclose(){ hg.window.close(); }
Runge-Kutta Method :

Runge-Kutta method here after called as RK method is the generalization of the concept used in Modified Euler's method.

In Modified Eulers method the slope of the solution curve has been approximated with the slopes of the curve at the end points of the each sub interval in computing the solution.  The natural generalization of this concept is computing the slope by taking a weighted average of the slopes taken at more number of points in each sub interval.  However, the implementation of the scheme differes from Modified Eulers method so that the developed algorithm is explicit in nature.  The final form of the scheme is of the form

yi+1  =  yi +  (weighted average of the slopes)             for i = 0, 1, 2 . . .
where h is the step length and yi and yi+1 are the values of y at xi and xi+1 respectively.

In genaral, the slope is computed at various points xs in each sub interval [xi, xi+1] and multiplied them with the step length h and then weighted average of it is then added to yi to compute yi+1.  Thus the RK method with v slopes called as v-stage RKmethod can be written as

K1  =  h f(xi, yi)
K2  =  h f(xi + c2h, yi + a21K1)
K3  =  h f(xi + c3h, yi + a31K1+ a32K2)
. . .
. . .
. . .

Kv  =  h f(xi + cvh, yi + av1K1+ av2K2 + . . . +avv-1Kv-1)
and

yi+1  =  yi +  (W1 K1 + W2 K2 + . . . + Wv Kv )             for i = 0, 1, 2 . . .

To determine the parameters c's, a's and W's in the above equation, yi+1 defined in the scheme is  expanded interms of steplengh h and the resultant equation is then compared with Taylor series expansion of the solution of the differential equation upto a certain number of terms say p.  Then the v-stage RKmethod will be of order p or is an pth order RK method.  Here for any v>4 the maximum possible order p of the R Kmethod is always less than v.  However, for any v lessthan or equal to 4, it is possible derive an RK method of order p = v.  Now, consider the case v = 2 to derive the 2-stage RK method.  For this

K1  =  h f(xi, yi)
K2  =  h f(xi + c2h, yi + a21K1)
yi+1  =  yi +  ( W1 K1 + W2 K2 )                                             for i = 0, 1, 2 . . .

Now by Taylor series expansion

y(xi+1) = y(xi) + h y'(xi) + h2 y''(xi)/2! + h3 y'''(xi)/3! + o(h4)
            = y(xi) + h f + h ( fx + fyf ) / 2! + h3( fxx + 2fxyf + fyy f2 + fy( fx + fyf )) / 3! + o(h4)

Also

K1  =  h fi
K2  =  h f(xi + c2h, yi + a21K1)
      =  h( fi + c2h fx a21K1fy + ( c2h)2 fxx /2! + (a21K1)2 fyy /2! + c2h a21K1 fxy + o(h4) )
    =  h( fi + c2h fx a21h fi fy + ( c2h)2 fxx /2! + (a21h fi)2 fyy /2! + c2h a21h fi fxy + o(h4) )
yi+1 = yi + (W1+W2) h fi + h2(W2c2fx + W2a21f fy) + h3 W2(c22a21f fxy + a221f2 fyy)/2 + o(h4)

Now by comparing the equal powers of h inyi+1and y(xi+1) we get

W1 + W2 = 1                 c2W2 = 1/2       and            a21W2 =  1/2

The solution of this system is

a21 =  c2,       W2 = 1/(2c2)        and        W1 = 1  -  1/(2c2)

where c2 is any arbitrary constant not equal to zero.  For these values of  a21, W2 , W1, since 2-stage RK method compares with Taylor series upto h2for any value of c2 the 2-stage RK method is of order two and hence this scheme is denoted in many text books as a second order RK method.  Now, to give some numerical values to a21, W2 , W1 first the valuec2 of  has to be fixed.  Generally the value of c2 is fixed such that the values of a21, W2 , W1 are integers or some real numbers which easy to remember.  Two of such cases are c2 = 1/2 and c2=1.

Case (i):  c2 = 1/2    Þ    a21= 1/2, W2 = 1, W1 = 0.  The corresopnding 2-stage (second order) RK method is

K1  =  h f(xi, yi)
K2  =  h f(xi + h/2, yi + K1 /2 )
yi+1  =  yi +  (  K2 )                                             for i = 0, 1, 2 . . .

or equivalently

yi+1  =  yi +  h f(xi + h/2, yi + h f(xi, yi) /2      for i = 0, 1, 2 . . .

Which is knothing but Eulers method with step length h = 1/2.

Case (ii):  c2 = 1    Þ    a21= 2, W2 =  W1 = 1/2.  The corresopnding 2-stage (second order) RK method is

K1  =  h f(xi, yi)
K2  =  h f(xi + h, yi + K1 )
yi+1  =  yi +  (  K1 + K2 )/2                                             for i = 0, 1, 2 . . .
or equivalently

yi+1  =  yi + .5 h (f(xi, yi) + f(xi + h, yi + h f(xi, yi) )      for i = 0, 1, 2 . . .

Which is knothing but the Modified Eulers method.

Following the same procedure one can develope the higher order RK methods by giving various values to v and comparing the obtained yi+1 with the same obtained by Taylor series method.  Classical RK methods of order three and four are
 

1  RK method of order three
(v = 3)
   K1  =  h f(xi, yi)
   K2  =  h f(xi + h/2, yi + K1 /2)
   K3  =  h f(xi + h, y - K + 2K2 )
   yi+1  =  yi +  (  K1 + 4K2 + K3 )/6 
2 RK method of order three
(v = 4)
   K1  =  h f(xi, yi)
   K2  =  h f(xi + h/2, yi + K1 /2)
   K3  =  h f(xi + h/2, yi + K2 /2)
   K4  =  h f(xi + h, y + K3 )
   yi+1  =  yi +  (  K1 + 2K2 + 2K3 + K4 )/6 

 
Worked out problems
Example 1 Find   y(1.0)  using RK method of order four by solving the IVP  y' = -2xy2,  y(0) = 1 with step length 0.2. Also compre the solution obtained with RK methods of order three and two. Solution
Example 2 Find  y  in  [0,3] by solving the initial value problem y' = (x - y)/2,  y(0) = 1 using RK method of order four with  h = 1/2 and 1/4. Solution
Example 3 Using RK method of order four find y(0.1) for y' = x - y2,  y(0) = 1. Solution
Example 4 Using RK method of order four find y at x = 1.1 and 1.2 by solving y' = x2 + y2 ,  y(1) = 2.3 Solution

 
 
Problems to workout

Solution of Transcendental Equations | Solution of Linear System of Algebraic Equations | Interpolation & Curve Fitting
Numerical Differentiation & Integration | Numerical Solution of Ordinary Differential Equations
Numerical Solution of Partial Differential Equations