0% found this document useful (0 votes)
52 views26 pages

Runge-Kutta Presentation

Uploaded by

ayomide.adekoya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views26 pages

Runge-Kutta Presentation

Uploaded by

ayomide.adekoya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

www.covenantuniversity.edu.

ng

Raising a new Generation of Leaders

ICE518: COMPUTATIONAL MATHEMATICS AND


QUEUING THEORY

By GROUP 8

NUMERICAL DIFFERENTIATION AND SOLUTION OF ODEs:


THE RUNGE-KUTTA METHOD
OUTLINE
• Overview of Runge-Kutta method.

• Worked Examples.

• MATLAB Code and Results

2
RUNGE-KUTTA METHOD: THE OVERVIEW
• The task is to find the value of the unknown function y
at a given point x.
• The Runge-Kutta method finds the approximate value
of y for a given x. Only first-order ordinary
differential equations can be solved by using the
Runge Kutta 4th order method.
• The Runge–Kutta method is a step-by-step process
where results are tabulated for a range of values of x.

3
RUNGE-KUTTA METHOD
• The Runge–Kutta method is a step-by-step process
where results are tabulated for a range of values of x.

• Runge-Kutta methods achieve the accuracy of a


Taylor series without requiring the calculation of
higher derivates. Many variations exist but all can be
cast in the generalized form of the equation in eq (1):

4
SOLUTION PROCEDURE
The seven-step procedure for the Runge–Kutta method, without proof,
is as follows:
𝑑𝑦
• To solve the differential equation = f (x, y) given the initial
𝑑𝑥
condition
y = y0 at x = x0 for a range of values of x = x0(h)xn ------------ (1):

5
1. Identify x0, y0 and h, and values of x1, x2, x3…..
2. Evaluate k1 = f (xn, yn) starting with n = 0
ℎ ℎ
3. Evaluate k2 = f (xn + , yn+ k1)
2 2
ℎ ℎ
4. Evaluate k3 = f (xn + , yn+ k2)
2 2
5. Evaluate k4 = f (xn + h, yn+hk3)
6. Use the values determined from steps 2 to 5 to

evaluate: yn+1 = yn + {k1 + 2k2 + 2k3 + k4}
6
7. Repeat steps 2 to 6 for n = 1, 2, 3, …

6
• 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.

7
Worked Example
• Example: Use the Runge-Kutta method to solve the differential
equation:
𝑑𝑦
=𝑦 −𝑥
𝑑𝑥
in the range 0(0.1)0.5, given initial conditions that at x = 0, y = 2
Using the procedure given in the slide 6:
1. x0 = 0, y0 = 2 and since h = 0.1, and the range is from x = 0 to
x = 0.5, then x1=0.1, x2 = 0.2, x3 = 0.3, x4 = 0.4, and x5 = 0.5

8
Using the procedure given in the slide 4:
1. x0 = 0, y0 = 2 and since h = 0.1, and the range
is from x = 0 to x = 0.5, then x1=0.1, x2 = 0.2, x3 =
0.3, x4 = 0.4, and x5 = 0.5

9
𝑑𝑦
k1= f (x0, y0) = f (0, 2); since = 𝒚 − 𝒙,
𝑑𝑥
f (0,2) = 2 − 0 = 2
ℎ ℎ
k2 = f (x0 + , y0 + k1)
2 2
0.1 0.1
= f (0 + , 2 + (2) )
2 2
= f (0.05, 2.1) = 2.1 − 0.05 = 2.05

Assignment model
10
ℎ ℎ
k3 = f (x0 + , y0 + k2)
2 2
0.1 0.1
= f (0 + , 2 + (2.05))
2 2
= f (0.05, 2.1025)
= 2.1025 − 0.05 = 2.0525
k4 = f (x0 + h, y0 + hk3)
= f (0 + 0.1, 2 + 0.1(2.0525))
= f (0.1, 2.20525)
=Assignment
2.20525 −model
0.1 = 2.10525
11

6. yn+1 = yn + {k1
+ 2k2 + 2k3 + k4} and
6
when n = 0:

y1 = y0 + {k1 + 2k2 + 2k3 + k4}
6
0.1
= 2 + {2 + 2(2.05)+ 2(2.0525) +
6
2.10525}
= 2 + 0.1 6 {12.31025} = 2.205171

12
A table of values may be constructed as shown in Table 1. The
working has been shown for the first two rows. Let n = 1 to
determine y2:
2. k1 = f (x1, y1) = f (0.1, 2.205171); since
𝑑𝑦
= y − x, f (0.1, 2.205171)
𝑑𝑥
= 2.205171 − 0.1 = 2.105171
ℎ ℎ
3. k2 = f (x1 + , y1 + k1)
2 2
0.1 0.1
=f (0.1 + , 2.205171+ (2.105171) )
2 2
= f (0.15, 2.31042955)
= 2.31042955 − 0.15 = 2.160430

13
ℎ ℎ
4. k3 = f (x1 + , y1 + k2 )
2 2
0.1 0.1
= f (0.1 + , 2.205171 + (2.160430))
2 2
= f (0.15, 2.3131925) = 2.3131925 − 0.15
= 2.163193
5. k4 = f (x1 + h, y1 + hk3)
= f (0.1 + 0.1, 2.205171 + 0.1(2.163193))
= f (0.2, 2.421490)
= 2.421490− 0.2 = 2.221490

6. yn+1 = yn + {k1 + 2k2 + 2k3 + k4} and when n = 1:
6

14

y2 = y1 + {k1 + 2k2 + 2k3 + k4}
6
= 2.205171+ 0.1 6 {2.105171+2(2.160430) +
2(2.163193) + 2.221490}
0.1
= 2.205171 + {12.973907} = 2.421403
6
This completes the third row of Table 1. In a
similar manner y3, y4 and y5 can be calculated
and the results are as shown in Table 1.
Column reduction
15
TABLE 1
n xn k1 k2 k3 k4 yn

0 0 2

1 0.1 2.0 2.05 2.0525 2.10525 2.205171

2 0.2 2.105171 2.160430 2/163193 2.221490 2.421403

3 0.3 2.221403 2.282473 2.285527 2.349956 2.649859

4 0.4 2.349859 2.417339 2.420726 2.491932 2.891824

5 0.5 2.491824 2.566415 2.570145 2.648838 3.148720

16
MATLAB Code sample

17
MATLAB Graph Plot (y1)

18
MATLAB Graph Plot (y2)

19
MATLAB Complete Graph

20
Exercise
• Obtain a numerical solution of the differential
𝑑𝑦
equation: =3(1+x) − y in the range
𝑑𝑥
1.0(0.2)2.0, using the Runge–Kutta method,
given the initial conditions that x =1.0 when y
=4.

21
TABLE 2
n xn k1 k2 k3 k4 yn

0 1.0 4.0

1 1.2 2.0 2.1 2.09 A 4.418733

2 1.4 B C 2.254953 2.330276 D

3 E 2.329676 2.396708 F 2.451675 5.348817

4 1.8 G 2.506065 2.500577 2.551068 5.849335

5 2.0 2.550665 H 2.591105 2.632444 I

22
References
• “Engineering Mathematics” - John Bird, Kenneth S.
Miller
• Mathworks.com

23
THANK YOU!

24
QUESTIONS?

25
MEMBERS
‒UDO IFIOKABASI 18CK024357
‒BEYIOKU SMART 18CK024292
‒ENO KEBEKEWE 18CK024302
‒BITTOME NWOKEALISI 18CK024328
‒SAMSON EFEMENA DIVINE 18CK024351
‒SEGUN-FANU MORAYO 18CK024352
‒ONWEAGBA IFEANYI JOSHUA 18CK024344

26

You might also like