0% found this document useful (0 votes)
161 views7 pages

EEE 315: Numerical Analysis: Runge Kutta 2 Order Method

The document describes the Runge-Kutta 2nd order and 4th order methods for numerically solving differential equations. It provides the equations for the 2nd order method, which uses the average of two slopes, and the 4th order method, which uses four intermediate slopes. An example of using each method to model the cooling of a ball is shown. The 4th order method is more accurate, with results closer to the exact solution for different step sizes.

Uploaded by

miahj2001
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)
161 views7 pages

EEE 315: Numerical Analysis: Runge Kutta 2 Order Method

The document describes the Runge-Kutta 2nd order and 4th order methods for numerically solving differential equations. It provides the equations for the 2nd order method, which uses the average of two slopes, and the 4th order method, which uses four intermediate slopes. An example of using each method to model the cooling of a ball is shown. The 4th order method is more accurate, with results closer to the exact solution for different step sizes.

Uploaded by

miahj2001
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/ 7

5/3/2014

EEE 315: Numerical Analysis

United International University

Runge Kutta 2nd Order Method


 Runge Kutta thought to consider upto second derivative

terms in Taylors series


 In that case the Eulars Method will be extended to
1
yi +1 = yi + f (xi , yi )h + f (xi , yi )h 2
2!
 But finding the second derivative is sometimes difficult
 Hence they used the average of two approximate slopes as
follows:
1
1
yi+1 = yi + k1 + k 2 h
2
2

where,

k1 = f (xi , yi )
k 2 = f ( xi + h, yi + k1h )

Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Example
A ball at 1200K is allowed to cool down in air at an ambient
temperature of 300K. Assuming heat is lost only due to radiation, the
differential equation for the temperature of the ball is given by
d
= 2.2067 10 12 ( 4 81 10 8 ), (0 ) = 1200 K
dt
Find the temperature at t=480 seconds using Heuns method.
Assume a step size of h=240 seconds
d
= 2.2067 10 12 ( 4 81 108 )
dt

f (t , ) = 2.2067 10 12 4 81 10 8
1
2

1
2

i +1 = i + k1 + k 2 h
Prof. S. M. Lutful Kabir, BUET

Solution
Step 1:

i = 0, t0 = 0, 0 = (0) = 1200K
k 2 = f (t0 + h, 0 + k1h )

k1 = f (t0 , o )

= f (0 + 240,1200 + ( 4.5579)240)

= f (0,1200)

= 2.2067 10 12 12004 81108


= 4.5579
1
2

1
2

= f (240,106.09 )

= 2.2067 10 12 106.094 81 108


= 0.017595

1 = 0 + k1 + k 2 h
1
1

= 1200 + ( 4.5579 ) + (0.017595) 240


2
2

= 1200 + ( 2.2702 )240


= 655.16 K
Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Solution (contd.)
Step 2: i = 1, t1 = t 0 + h = 0 + 240 = 240,1 = 655.16K
k 2 = f (t1 + h, 1 + k1h )

k1 = f (t1 , 1 )
= f (240,655.16)

= 2.2067 1012 655.164 81108


= 0.38869
1
2

1
2

= f (240 + 240,655.16 + ( 0.38869)240)


= f (480,561.87)

= 2.2067 1012 561.87 4 81 108


= 0.20206

2 = 1 + k1 + k 2 h
1
1

= 655.16 + ( 0.38869) + ( 0.20206)240


2
2

= 655.16 + ( 0.29538)240
= 584.27 K
Prof. S. M. Lutful Kabir, BUET

Comparison with exact results

Temperature, (K)

1200
h=120

Exact
800
h=240
400

h=480

0
0

100

200

300

400

500

-400
Time, t(sec)

Figure 2. Heuns method results for different step sizes

Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Effect of step size

Table 1. Temperature at 480 seconds as a function of step size, h

Step size, h

(480)

Et

|t|%

480
240
120
60
30

393.87
584.27
651.35
649.91
648.21

1041.4
63.304
3.7762
2.3406
0.63219

160.82
9.7756
0.58313
0.36145
0.097625

(480) = 647.57 K

(exact)

Prof. S. M. Lutful Kabir, BUET

Runge-Kutta 4th Order Method


For

dy
= f ( x, y ), y (0) = y0
dx

Runge Kutta 4th order method is given by


1
yi +1 = yi + (k1 + 2k2 + 2k3 + k4 )h
6
where

k1 = f ( xi , yi )
1
1

k 2 = f xi + h, yi + k1h
2
2

1
1

k3 = f xi + h, yi + k2 h
2
2

k4 = f (xi + h, yi + k3h )
Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Example
A ball at 1200K is allowed to cool down in air at an ambient
temperature of 300K. Assuming heat is lost only due to radiation,
the differential equation for the temperature of the ball is given by
d
= 2.2067 10 12 ( 4 81 10 8 ), (0 ) = 1200 K
dt
Find the temperature at t=480 seconds using Runge-Kutta 4th order
method. Assume a step size of h=240 seconds

d
= 2.2067 10 12 4 81 10 8
dt

f (t , ) = 2.2067 10 12 4 81108
i +1 = i +

1
(k1 + 2k 2 + 2k 3 + k 4 )h
6

Prof. S. M. Lutful Kabir, BUET

Solution
Step 1:

i = 0, t 0 = 0, 0 = ( 0) = 1200

k1 = f (t0 , o ) = f (0,1200) = 2.2067 1012 12004 81108 = 4.5579

1
1
1
1

k 2 = f t0 + h, 0 + k1h = f 0 + (240),1200 + ( 4.5579 )240


2
2
2
2

= f (120,653.05) = 2.2067 10 12 653.054 81 108 = 0.38347

1
1
1
1

k3 = f t 0 + h, 0 + k 2 h = f 0 + (240),1200 + ( 0.38347)240
2
2
2
2

= f (120,1154.0 ) = 2.2067 1012 1154.0 4 81 108 = 3.8954

k 4 = f (t0 + h, 0 + k3h ) = f (0 + (240),1200 + ( 3.984)240)

= f (240,265.10) = 2.2067 1012 265.104 81108 = 0.0069750


Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Solution (cont)
1
(k1 + 2k 2 + 2k3 + k 4 )h
6
1
= 1200 + ( 4.5579 + 2( 0.38347) + 2( 3.8954) + (0.069750))240
6
1
= 1200 + ( 2.1848)240
6
= 675.65K

1 = 0 +

is the approximate temperature at

t = t1 = t0 + h = 0 + 240 = 240

(240) 1 = 675.65K
Prof. S. M. Lutful Kabir, BUET

Comparison with exact results

Temperature, (K)

1600
1200
h=120
800

Exact
h=240

400
h=480

0
0

200

400

600

-400
Time,t(sec)

Figure 1. Comparison of Runge-Kutta 4th order method with exact solution


Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

5/3/2014

Effect of step size


Table 1. Temperature at 480 seconds as a function of step size, h

Step size, h

480
240
120
60
30

(480)

Et

|t|%

90.278
737.85
113.94
594.91
52.660
8.1319
646.16
1.4122
0.21807
0.0051926
647.54
0.033626
647.57 0.00086900 0.00013419
(480) = 647.57 K

(exact)

Prof. S. M. Lutful Kabir, BUET

Thanks

Prof. S. M. Lutful Kabir, BUET

http://numericalmethods.eng.usf.edu

You might also like