Higher Engineering Mathematics, Sixth Edition

(Nancy Kaufman) #1

Numerical methods for first order differential equations 471


49.5 The Runge-Kutta method


TheRunge-Kuttamethodforsolvingfirst orderdifferen-
tial equations is widely used and provides a high degree
of accuracy. Again, as with the two previous meth-
ods, the Runge-Kutta method is a step-by-step process
where results are tabulated for a range of values ofx.
Although several intermediate calculations are needed
at each stage, the method is fairly straightforward.
The 7 stepprocedure for the Runge-Kutta method,
without proof, is as follows:


Tosolvethedifferentialequation


dy
dx

=f(x,y)giventhe
initial conditiony=y 0 atx=x 0 for a range of values of
x=x 0 (h)xn:


  1. Identify x 0 , y 0 and h, and values of x 1 ,x 2 ,
    x 3 ,....

  2. Evaluatek 1 =f(xn,yn)starting withn= 0

  3. Evaluatek 2 =f


(
xn+

h
2

,yn+

h
2

k 1

)


  1. Evaluatek 3 =f


(
xn+

h
2

,yn+

h
2

k 2

)


  1. Evaluatek 4 =f(xn+h,yn+hk 3 )

  2. Use the values determined from steps 2 to 5 to
    evaluate:


yn+ 1 =yn+

h
6

{k 1 + 2 k 2 + 2 k 3 +k 4 }


  1. Repeat steps 2 to 6 forn=1, 2, 3,...


Thus, step 1 is given, and steps 2 to 5 are intermediate
steps leading to step 6. It is usually most convenient to
construct a table of values.
The Runge-Kutta method is demonstrated in the follow-
ing worked problems.


Problem 7. Use the Runge-Kutta method to solve
the differential equation:
dy
dx

=y−x

in the range 0(0.1)0.5, given the initial conditions
that atx=0,y= 2.

Using the above procedure:


  1. x 0 =0,y 0 =2 and sinceh=0.1, and the range is
    fromx=0tox=0.5, thenx 1 = 0. 1 ,x 2 = 0. 2 ,x 3 =
    0. 3 ,x 4 = 0. 4 ,andx 5 = 0. 5
    Letn=0 to determiney 1 :

  2. k 1 =f(x 0 ,y 0 )=f( 0 , 2 );
    since


dy
dx

=y−x, f( 0 , 2 )= 2 − 0 = 2


  1. k 2 =f


(
x 0 +

h
2

,y 0 +

h
2

k 1

)

=f

(
0 +

0. 1
2

, 2 +

0. 1
2

( 2 )

)

=f( 0. 05 , 2. 1 )= 2. 1 − 0. 05 =2.05


  1. k 3 =f


(
x 0 +

h
2

,y 0 +

h
2

k 2

)

=f

(
0 +

0. 1
2

, 2 +

0. 1
2

( 2. 05 )

)

=f( 0. 05 , 2. 1025 )

= 2. 1025 − 0. 05 =2.0525


  1. k 4 = f(x 0 +h,y 0 +hk 3 )


= f( 0 + 0. 1 , 2 + 0. 1 ( 2. 0525 ))

= f( 0. 1 , 2. 20525 )

= 2. 20525 − 0. 1 =2.10525


  1. yn+ 1 =yn+


h
6

{k 1 + 2 k 2 + 2 k 3 +k 4 } and when
n=0:

y 1 =y 0 +

h
6

{k 1 + 2 k 2 + 2 k 3 +k 4 }

= 2 +

0. 1
6

{ 2 + 2 ( 2. 05 )+ 2 ( 2. 0525 )

+ 2. 10525 }

= 2 +

0. 1
6

{ 12. 31025 }=2.205171

A table of values may be constructed as shown in
Table 49.15. The working has been shown for the first
two rows.
Free download pdf