R-K Method
R-K Method
0-2).
1 , .
( 0 . 2 ) ,
( 0 ) =
y get y
t+Y» method,
(t Euler
Euler
log
Modificd given
(0-4)
M a t i f i e d
(0-2), y
y - y( ) =1.
Using
find y
7 method,
Euler's I m p r o v e d n
1.
y (0)
=
dy
method.
&UsingEn Euler
Improved
dx
= I using
y'=* y (0)
y'= +y,p r o b l e m s
p r o b l e m s
(1 0 - 1 1 ) :
(
given
given
the
d do
o )
(0-1)
Find
y Euler's
m e t h o d .
given
05
h =
1-1.
y (0)
=
Using
taking
(15) =y-1,
IaFindy
I. improved
Euler's
Use h=01.
12 =y+siny (0)=2.
(1)= 1 if
logy-y logx,
y O-5.
05.
if y (1)
=
i
dx f X
y(0)= 1.
0-25 to obtain y
(0-25), y (0-5).
given y (0) = 4, if h =
Solve y'=3r+y
16. 0:125.
'-;ry:y(1)=find y 2) if h =
17.
Given 2
y=-y,y (0) =2 if
method, given
18. Find y (0-2) by Improved Euler
h 0-1.
11 12. Runge-Kutta Method
differential equation
use of the previous methods to solve the
1abour
or due to
nerically is restricted due
to either slow convergence
Runge-Kutta
me,especially in Taylor-series method. But, in
S t h e derivatives of higher order are not required and we require
dy
AIM. To solve=fx, y) given y
dx (F%)= Yo .)
Proof. By Taylor series, we have,
=h S)+|mhm dx
2!
since k, =hf
=hf+ mh (f, +f)+.
higher powers of h 9)
Substituting k, kz in (7),
Ay=ahf+bhft mk' (, +) + O(k*)
=
(a+b) hf+ bmh (f,
Equating Ay from (4) and
+)+O(h) ...(10)
(10), we get
EYI
381
DifereIl
Ordinary
NumericalSolution of
Colution Qf
higher powers of h
+5) + ...9)
hftmh (
in (7),
k, k2
+1)+o')
Substituting
G,
Ay=ahf+ bhf+mh' G, +fI)+ O(h) (10)
= (a +b) hf+bmh (10), we get
get
Ay from (4) and
Equating
..(11)
atb=l
and
bm2
bm =
two equations given by (1) to solve for three
we have only
Now
unknowns
a, b, m.
a+b=1,a=l-b
and also m= 2b using (7),
From
4,h2y +2
Now Ay=y (x+ h) -y (x)
hf
y (+h)=y ()+(1-b) hf+bls x2 +25
i.e., Yn+1Y+ (1- b) hf yn)
k = hf x, y)
and
)|
Ay=K2 where h= Ar.
Second order R.K. algorithm
Third order
R.K. algorithm
kg=hf(x+h, y +2k2-k,)
and
Ay=k+4k +k)
382 algoritthm is m
mostly
ostl.
The fourth
order
Runge-Kutta
m e n t i o n e d . It
is
method
used n
otherwise
unless
problems
k =hf. )
Fourth order
k=hf R.K. algorithm
k =hfr +h, y +k)
and Ay=+24 +2kg +ka)
y(r+h)=y (x)+Ay
dy
Working Rule: To solve =f(% y),y ()=Yo
Calculate k =hflt% Yo
k=hf
This is
exactly the
So, the Modified Euler method.
ModifiedRunge-Kutta method of second
Euler method. order is
Note 2. If
fr, y) nothing but the
=f), i.e.,
Runge-Kutta method only a
function x alone, then
reduces to the fourth
k =hfto) ordc
383
Solution of Ordinary Differential Equations
Numerical
yF4r h
= the area of y=f(®) between x=Xg and x
=x+h with 2
;h Yo+k(0-1)f(005, 1405)
(01)(0-05+1-05) =0-11
(0-1)0-1+
(0-1)%, +y)=
Yi) =
n = (0-1)f(0-15, 1-170859)
0-1320859
1-170859) =
(01)(0 15+
Numerical Method. OLD=-- 000
384 h +sk=(01)f015, 1-1763848)
+k) =
= (0-10 15 + 1-1763848)
(01)f(02, 1-24298048)
=
0-1326
1326384 -0-014
khfx+h, y
= 0:144298048
1-110342+ (0-7947RId
+2k, +K) 1008
=
Solution. Here, y)
f(x, *o=0, Yo= 1, x =01, x^ =02.
=-y,
(i) Second order:
pt(0)f(005
k =hflo» Yo) (0 1)-y,)=-01 =
-009525
k=hshSotk, =(01)/(005,095)
-0-1 x0-95 =-
0095 =Ay Hityl)=(01)f(01,0.98
yYo+Ay =1 0-095 -
= 0.905 -0090475
=y (0-1) =0-905
Again starting from (0-1, 0.905) replacing (xo. Yo) by (xj, y) we get
k= (01)ft1, y) = (01)(-0905) = - 00905
lat +,+k
=(0-1) f(0-15, 0-85975)] (01)(-0-85975) = =- 0085975
Ay=k ata })
Y y (02) =y, +Ay =0-819025 and
replaace
(ii) Third order:
k=hfo Yo)=-01 =-0490A
=- 0-095
khf
(0-1)f(0-15,0-865)5)=(0-1)(-0-865) =-
00865
k=hfth, y +2k-k
(0-1)f (02,0828) = -0-0828
khf+h.Yotk|=01)f(005,095)=-0095
-hho*-01nso0s,09525) =- 0-09525
-0 cdot 08618577
(01)f(0-15, 0 8618577)
=
y ( 0 2 ) = y ,+ A y = 0 - 8 1 8 7 3 0 8 9
Third order
Fourth order
Exact vale
Second order y=e
0.91
0.90483775
0.904837413
0-905
0-1
0-823366
0-81873089
0-818730753
02 0-819025
closer to exact values.
more
values are
Fourth order
given
dy+y +xy=0, y (0)=1
Compute y(03) dx
Example 3.
order (corect to 4 deri mals
01 using RK
method of fourth
taking h =
h
k=b otk(01)r(005,095)
=-0-1 [(0-05) (095)* +0:95]=-0-0995
= 9ot =(01s(005,095025
=(0-1) -(0-05 x 0-95025+ 1)
(0-95025) 1
=-0-09953987=- 0-0995
k4=hflo+h, yo+kz)
(0-1)f(0-1,0-9005) =-0-0982
=
=1+-0:1+2(-00995) +2 (-0-0995) -
0-0982]
y(0-1)=0-9006
Solution of Ordinary Differential Equations
Numerical Solution
387
ain taking ( Yi) in place of (o» yo) repeat the process.
(0-1)f(01,0.9006
=
k =hf(1 ))=-0-0982
h
k= =(0 1)f(015,08515
= - 0-0960
* 01so15,0852
= -0-0962
=++2+2k,+k)
=0-9006+-00982+2 x(-0-0960) +2 (-00962)
y (0-2) =0-8046
+(-0-0934)]
Again, starting from (x2 ) in place of (o Yo)
f% y) =y-x
By R.K. method of 4th order
=
(0-1)f(0-65, 1-8071)
(0-65)1=0-1385
Pinods-N
= (01) [1-8071
k= hfo +h, yo +ka)=(01)f(07, 1-8764)
=(0-1) [(1-8764)- (0-7)1=0-1386
Hence, using (1),
y (0-7)=Y=17379+ [0O1378+2 (01384) +2 (0-1385) +0130.
y (0-7)=18763.
1386
To find y2 =y (0-8), we again start from (x, Y1) (0-7, 18763)
=
Now,
+ k +2k2 +2k +kl
where
k =hf. y) =(0-1) [1-8763-(0-7)]=0-1386
+y+ =(01)f(075, 1-9456)
= (0-1) [1-9456-(0-75)j=01383
(0-1)f(0-75, 1-9455)
= (0-1) [1-9455 - (0-75)]=0-1383
k=hf* +h, y +ki)
=
(0-1)f (O-8, 2-0146)
= (0-1) [2-0146-(0-8)]=0-1375
Using (2),.
y2=y (0-8) =
1-8763 + [0-1386+2 (1-1383) +2 (1-1383) +01375
2-0145
2 y (08)=20145
Example 5. Using
Runge-Kutta method
dy-
dx42 8tven y(0) =l atx= 02, 0-4.
of fourth order, sove
(MS. April 92)
Solution. =f&)= (Anna Ap. 2005)
(Anna Nov. 2004)
Here
0 , h =02, x =0-2, 7
=04. yo=1
f t Yo)=f0, 1)
=1+0 =1
k= hf o» Yo) (0-2) x1 =0-2
=
389
(1-1-01
Numerical
(0-2)L11+(0-1121+001
1-21+001
-001]|
= 0-1967213
'
(0-2)01, 1+(1967213
(0-2)f(01, 10983606)
= (0-210983606-(001 |-0
L(10983606 +(0-01)J 1967
01967
k=hfCo+ h, yotk)
= (0-2)f(02, 1-1967)
(0-2)967)*-(02?]
(1:1967+(02 189t
Ay=k+2k +2k,+4
= 6[0-2+2(0-19672)+2 (1-1967) +01891]
= 0-19598
119598.
y(0-2)=y=YotAy =
Now,
(1-19598)-(02 0-1891
k hfCa y) (02)
=
(1-19598)+ (0-27J
Ahyi* |=02/03,129059
=(02) 29055)-(03
L(1-29055)+(0-3317949
1-37528)
k= (0-2)f (0-4, y, +k,)= (0-2)f(04,
= 0-1687
Ay=+2k,+2k,+k)
(0-1793) +0-16871
101891 +2 (01795)
+2
= 0-1792
Numer
390
13751
Y, +Ay=
y (04) = simultaneous
first order differe
ren.
method for
1114. Runge-Kutta
tial equations
the
simuluneous ons dx
cquation / a.y,,
numerically
AIM. To solve
initial
conditions y(4%) =Yo» 2 (o) =z,
y, ) given the
a n d / (1.,
dx and z are dependent.
is independent
variable while y
Here, and Az in y and.
the increments Ay
Now. starting from (o» Yo» 2g)
respectively are given by formulae,
o)
k hf, (on o
ot)
k =hfi (o+h, yo +k
Ay=k+ 2 k +2k+k,) where h
=Ar
Az=,+ 21 +21 + l
y o + Ay and z =20 + Az.
Having got (. y1, Z1) we get (x7, y2, 3») by repeating the abo
algorithm once again starting from (1, y1, Z)
If we consider the second order
Runge-Kutta method, then
k= hf Mo Yo» o)
Ordinary Ditferential Equations 391
N u m e r i c aS
t olution
of
Ay=k
and
Az=l
=otn,
y +Ay,
=Jot z1=+ Az.
4,
y (01),2 (0-1) from the system of equations,
Then
E x a m p l e
6. Find
r - y given y (0) = 2, z (0) = I using Runge-Kutta method
d
dt
o ff o u r t h o r d e r .
dy =X+, =x-y?
Solution. Now
dx dx
2) =x-y
f y ,2)=X+2h&, y,
01,h=01
=0, o=2,
We use
0
k =hf; Fo»Yo =hf2 (o Yo o)
K
k2
392
-(2-084238) )
2-084238,05878); | 4=(0:1) (0-1
k=(01)f(01, -042444
= (0-1) (0-1 +0-5878)
0-06878
2-0845
[0-1+2 (0-085
+0-084238) +0-06878]=
=2+
=1+-04-(0-41525 +0-4122) x2-04244]
6
0-5868
y (0-1)=20845
andz (0-1) =0-5868&
differential equation
method for second order
11-15. Runge-Kutta
AIM. To solve y, y ), given y (T)=yo» y o)=yo.
y" =f(x,
Now, set y'=z andy"=z
Hence, differential equation reduces to
dx
and
dx are simultaneous equations
dy where f (a, y, z) =z
dx , y , 2) =f(x, y, z) given.
and =f(x, y, 2) Also y (0) and z (0) are given.
Starting from these equations, we can use the previous article and
solve the problem.
1,y (0) 0, find the value
Example 7. Given y" +xy +y=0, y (0)
= =
=0,=y (0-1)
Setting ý=z
The equation becomes,
y'=d=-xz-y
dy 1)
f (,y, z)
- - y = f t, y, 2)
given oz1,%=o=0.
By algorithm.
=0
khh o o. 2o)= (0-1)f, (0, 1,0)= (0-1) 0)
h o Yo» 2g) =(0-1)s, (0, 1,0) = (-1) (0-1)=-0-1
S o l u t i o n
of O r d i n a .
Dyerental Equations
Dyjerenlial Equ
Numerical
393
=
(01), (0-05,09975,-00499)
=(0 1) (-0-0499)- 0-00499
hf2(0-05,09975, -00499)
= -
y (0-1)=0-9950.
EXERCISE 11.4
dy
d-*y=xy
dx
(0)= 1 taking h =01.
7.
y = 5 ( 1 + ) y y ) = 1 .
=005.
S o l v e : + = y ( 1 ) =
1 for y(1-1) taking h
8. (0)=1.
0:5 given y'= '
taking h
=
x+y
(1-5), y (2)
(0-5), y (1), y
9. Find y
2xy +
'y (1) =0.
'Y(1)=0. (MS. Ap. I198
10.
Evaluate y (1-2)
and y (1-4) given y'=
dy 1+y,y (0) =0.
(0-2) 0-6 given dx
11. Find y
for r= 0-2
-y, y (0)
=
order. (0) =
1 taking h
= 0-1 by (1) second
y=x-2y, y
13. Find y (0-1). y
(0-2) given
order R.K. method.
third order and fourth
order,
R.K method given= given
14. Determine y at x=0:2 (0-2) (0-6) by
y (0) =0.
2, taking h=02.
x =02, 04, 0-6 given y (0)
=
(12).
17. Given =r+5y.y() =2, find y (1-1),y
Solve 10y=x+y, given y (0)=
1 for x =0-1 (0-1) (0-3)
18.
Solve 8y =x+y given y (0) =0-5
for x =0-1 (0-1) (0-4).
19.
r=.
20. Solve the system: =x+1, = -y for x= 0:3 (O-3) (0-9) taking
(MKU 1979)
y=0, z = 1.
taking
21. Solve: = x + , = x - y , given y (0)=0,z (0) = 1 for x = 0-0 to
h= 01.
22. Solve dy dz given y (0) = 1, z (0) = 1 for r=0 (0-2) (04
dx
23. Evaluate y (1-1),z (1-1) given=zyz,=y (1)=1/3, z (1)=l