Lecture 10
Lecture 10
Dina Sami
Runge-Kutta 4th order method is a numerical technique used to solve ordinary differential
equation of the form
𝑑𝑦
= (𝑥, 𝑦) , y (xo) = yo
𝑑𝑥
So only first order ordinary differential equations can be solved by using the Runge-Kutta
4th order method.
.تعتبر هذه الطريقة أكثر تطورا ً بالدقة من الطرق السابقة وتعود هذه الطريقة للعالمان االلمانيان رونج وكوتا
Algorithm of solution:
1- Identify 𝑥𝑜, 𝑦𝑜, 𝑎𝑛𝑑 ℎ , Where 𝒉 = 𝒙 − 𝒙𝟎 ( القيمة االبتدائية- )القيمة المطلوب عندها الحل
2- Evaluate 𝒌𝟏 = 𝑓 (𝑥𝑛 , 𝑦𝑛 )
x باعتبار هي حاصل للتغير فيh عندما تتقدم بمقدارY يعرف بصورة عامة على انه مقدار تقريبي للتغير في:𝒌
𝑑𝑦
. و
𝑑𝑥
ℎ ℎ
3- Evaluate 𝒌𝟐 = 𝑓 (𝑥𝑛 + , 𝑦𝑛 + 𝑘1 )
2 2
ℎ ℎ
4- Evaluate 𝒌𝟑 = 𝑓 (𝑥𝑛 + , 𝑦𝑛 + 𝑘2 )
2 2
5- Evaluate 𝒌𝟒 = 𝑓 (𝑥𝑛 + ℎ, 𝑦𝑛 + 𝑘3 ℎ )
𝒉
6- Evaluate 𝒚𝒏+𝟏 = 𝒚𝒏 + (𝒌𝟏 + 𝟐 𝒌𝟐 + 𝟐 𝒌𝟑 + 𝒌𝟒 )
𝟔
114
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
ℎ ℎ 0.5 0.5
k3 = f (xo + , yo + k2 ) = f (0 + , 2 + [3.510611 × ])
2 2 2 2
115
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
Ex. 3: A liquid phase reaction A→ B is carried out in a stirred vessel reactor. Feed enters
the reactor at a rate of F = 1 L/s and exits out also at the same flow rate. Both the reactant
and product have the same density. The concentration of reactant in the feed is C A0 = 1
mol/m3. The volume of the tank is V = 10 L and the concentration of A of the solution in
the tank is 1 mol/m3. The vessel may be considered perfectly mixed, so that the
concentration of A in the product stream equals that inside the tank. The rate of
consumption of A equals k CA, where k = 1 s-1. Determine the concentration of A at various
time periods from 0 to 0.2 s.
Sol:
116
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
117
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
h.w1: solve the following differential equation numerically using Runge–Kutta Method
(4th order). Find y (0.5) when 𝑦´ = 2 x + y, y (0) = 1. Take h = 0.5
H.w 2: The open loop response, that is, the speed of the motor to a voltage input of 20V, assuming a
system without damping is
dw
20 = (0.02) + (0.06) w .
dt
If the initial speed is zero (w(0) = 0) ,and using the Runge-Kutta 4th order method, what is the speed at
t = 0.8 s ? Assume a step size of h = 0.4 s .
Sol:
y0 = y (0) = 100 , t0 = 0
The number of gallons of gasoline and additive in solution in the tank at any time t is
𝑔𝑎𝑙 𝑔𝑎𝑙
𝑉(𝑡) = 2000 𝑔𝑎𝑙 + (40 − 45 ) 𝑡 (min )
𝑚𝑖𝑛 𝑚𝑖𝑛
𝑉(𝑡) = 2000 − 5𝑡
118
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
119
Numerical and Engineering Analysis – 3rd Stage M. Sc. Dina Sami
120