Runge-Kutta's Method

 

 

Example:  Use the Runge-Kutta Method to find an approximate solution to

          dy/dx  =  2 y ,   y(0) = 0.5     Use step size, h = 0.25      and    yexact  =  2 e2y

 

Strategy:    Use the Runge-Kutta Algorithm as given below

 

         yn+1  =  yn  +  h k            f(x,y)  =  2 y          where  h  =  step size

 

             k  =  (1/6) [ k1  +  2k2  +  2k3  +  k4 ]

 

and      k1  =  f(xn, yn) ,         k2  =  f( xn + h/2 , yn + hk1 / 2 )

 

            k3  =  f( xn + h/2 , yn + hk2 / 2 ) ,   k4  =  f( xn+1 ,  yn + hk3 )

 

 

                          y1  =  y0  +  h k                   y0 =  0.5    f(x,y)  =  2 y

 

  k1  =  f(x0, y0)  =  2 y0  =  2 (0.5)  =  1.0

 

  k2  =  f( x0 + h/2 , y0 + hk1 / 2 )  =  2[0.5 + 0.25(1.0/2)]  =  1.25

 

  k3  =  f( x0 + h/2 , y0 + hk2 / 2 )  =  2[0.5 + 0.25(1.25/2)]  =  1.3125

 

  k4  =  f( x1 , y0 + hk3 )  =  [0.5 + 0.25(1.3125)]  =  1.65625

           

So   ki  =  1.0 + 2(1.25) + 2(01.3125) + 1.65625  =  7.78125

 

   k  =     ki  / 6  =  1.296875

 

y1  =  y0  +  h k  =  0.5  +  0.25[1.296875]  =  0.82421875      at  x  =  0.25

 

 

                         y2  =  y1  +  h k                              y1 =  0.82421875     

 

  k1  =  f(x1, y1)  =  2 y1  =  2 (0.82421875)  =  1.6484375

 

  k2  =  f( x1 + h/2 , y1 + hk1 / 2 )  =  2[(0.82421875 + 0.25((0.82421875/2)]  =  2.060546875

 

  k3  =  f( x1 + h/2 , y1 + hk2 / 2 )  =  2[(0.82421875 + 0.25(2.060546875/2)]  =  2.163574219

 

  k4  =  f( x2 , y1 + hk3 )  =  2[(0.82421875 + 0.25(2.163574219)]  =  2.73022469

           

       k  =  (1/6) [ k1  +  2k2  +  2k3  +  k4 ]       yexact  =  2 e2(0.5)  =  1.359140914

       

So   k  =  [1.6484375+ 2(2.060546875) + 2(2.163574219) + 2.73022469]/6  =  2.137817383

 

y2  =  y1  +  h k  =   0.82421875  +  0.25 [2.137817383 ]  =  1.358673096       at  x  =  0.5

 

Click here to return to the discussion of approximate methods for first order d.e.'s.

 

 

 




Copyright © 2017 Richard C. Coddington

All rights reserved.