NUMERICAL METHODS FOR FIRST ORDER DIFFERENTIAL EQUATIONS 471
I
Table 49.16
Euler’s Euler-Cauchy Runge-Kutta
method method method Exact value
x y y y y=x+ 1 +ex
0 2 2 2 2
0.1 2.2 2.205 2.205171 2.205170918
0.2 2.41 2.421025 2.421403 2.421402758
0.3 2.631 2.649232625 2.649859 2.649858808
0.4 2.8641 2.89090205 2.891824 2.891824698
0.5 3.11051 3.147446765 3.148720 3.148721271
It is seen from Table 49.16 thatthe Runge-Kutta
method is exact, correct to 5 decimal places.
Problem 8. Obtain a numerical solution of
the differential equation:
dy
dx
=3(1+x)−yin
the range 1.0(0.2)2.0, using the Runge-Kutta
method, given the initial conditions thatx=1.0
wheny=4.0
Using the above procedure:
1.x 0 = 1 .0,y 0 = 4 .0 and since h= 0 .2, and the
range is fromx=1.0 tox=2.0, thenx 1 = 1 .2,
x 2 = 1 .4,x 3 = 1 .6,x 4 = 1 .8, andx 5 = 2. 0
Letn=0 to determiney 1 :
- k 1 =f(x 0 ,y 0 )=f(1.0, 4.0); since
dy
dx
=3(1+x)−y,
f(1.0, 4.0)=3(1+ 1 .0)− 4. 0 =2.0
3.k 2 =f
(
x 0 +
h
2
,y 0 +
h
2
k 1
)
=f
(
1. 0 +
0. 2
2
,4. 0 +
0. 2
2
(2)
)
=f(1.1, 4.2)=3(1+ 1 .1)− 4. 2 =2.1
4.k 3 =f
(
x 0 +
h
2
,y 0 +
h
2
k 2
)
=f
(
1. 0 +
0. 2
2
,4. 0 +
0. 2
2
(2.1)
)
=f( 1 .1, 4. 21 )
=3(1+ 1 .1)− 4. 21 =2.09
5.k 4 =f(x 0 +h,y 0 +hk 3 )
=f(1. 0 + 0 .2, 4. 1 + 0 .2(2.09))
=f(1.2, 4.418)
=3(1+ 1 .2)− 4. 418 =2.182
6.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 }
= 4. 0 +
0. 2
6
{ 2. 0 +2(2.1)+2(2.09)+ 2. 182 }
= 4. 0 +
0. 2
6
{ 12. 562 }=4.418733
A table of values is compiled in Table 49.17. The
working has been shown for the first two rows.
Letn=1 to determiney 2 :
- k 1 =f(x 1 ,y 1 )=f(1.2, 4.418733); since
dy
dx
=3(1+x)−y, f(1.2, 4.418733)
=3(1+ 1 .2)− 4. 418733 =2.181267
3.k 2 =f
(
x 1 +
h
2
,y 1 +
h
2
k 1
)
=f
(
1. 2 +
0. 2
2
,4. 418733 +
0. 2
2
(2.181267)
)
=f( 1 .3, 4. 636860 )
=3(1+ 1 .3)− 4. 636860 =2.263140