NUMERICAL METHODS FOR FIRST ORDER DIFFERENTIAL EQUATIONS 469
I
- Obtain a numerical solution of the differential
equation
1
x
dy
dx
+ 2 y= 1
using the Euler-Cauchy method in the range
x=0(0.2)1.0, given the initial conditions that
x=0 wheny= 1.
[see Table 49.14]
Table 49.14
xy y′
01 0
0.2 0.99 −0.196
0.4 0.958336 −0.3666688
0.6 0.875468851 −0.450562623
0.8 0.784755575 −0.45560892
1.0 0.700467925
49.5 The Runge-Kutta method
The Runge-Kutta method for solving first order dif-
ferential equations is widely used and provides a
high degree of accuracy. Again, as with the two
previous methods, 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 step procedure for the Runge-Kutta
method, without proof, is as follows:
To solve the differential equation
dy
dx
=f(x,y)given
the initial conditiony=y 0 atx=x 0 for a range of
values ofx=x 0 (h)xn:
- Identify x 0 , y 0 and h, and values of x 1 ,x 2 ,
x 3 ,.... - Evaluatek 1 =f(xn,yn) starting withn= 0
- Evaluatek 2 =f
(
xn+
h
2
,yn+
h
2
k 1
)
- Evaluatek 3 =f
(
xn+
h
2
,yn+
h
2
k 2
)
- Evaluatek 4 =f(xn+h,yn+hk 3 )
6. 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 }
- 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
following 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 condi-
tions 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
3.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
4.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
5.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