Docsity

Runge 4th Order Method - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Runge 4th Order Method - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Runge 4

th

Order Method

Runge-Kutta 4

th

Order Method

f ( x , y ), y ( 0 ) y 0

dx

dy

where

y (^) i 1 yi^ ( k^12 k 2 2 k 3 k 4 ) h

6

1

  • = + + + +

i i

k f x , y

1

 

  

k (^) 2 = f xi + h yi + k 1 h 2

1 , 2

1

 

  

k (^) 3 = f xi + h yi + k 2 h 2

1 , 2

1

k f ( x h y k h )

4 i i 3

For

Runge Kutta 4 th (^) order method is given by

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

( ) ( ) K

dt

d

  1. 2067 10 81 10 , 0 1200

12 4 8 =− × θ − × θ =

θ (^) −

Find the temperature at t^ =^480 seconds using Runge-Kutta 4th^ order method.

h = 240 seconds.

12 4 8 =− 2. 2067 × 10 θ − 81 × 10

θ (^) −

dt

d

( ) ( )

12 4 8 , θ =− 2. 2067 × 10 θ − 81 × 10

− f t

Assume a step size of

i 1 i^ ( k^12 k 2 2 k 3 k 4 ) h 6

1 θ+ =θ + + + +

Solution

Step 1: 0 , 0 , ( 0 ) 1200

i = t 0 = θ 0 =θ =

12 4 8 1 =^0 = =− × − × =−

− k f t θ o f

( ) ( )

  1. 5579240 2

1 240 , 1200 2

1 0 2

1 , 2

1

12 4 8

2 0 0 1

= =− × − × = −

 

  

 = + + − 

  

 = + +

− f

k f t h θ kh f

( ) ( )

  1. 38347240 2

1 240 , 1200 2

1 0 2

1 , 2

1

12 4 8

3 0 0 2

= = × − × = −

 

  

 = + + − 

  

 = + +

− f

k f t h θ k h f

12 4 8

4 0 0 3

= = × − × =

−

f
k f t h θ k h f

Solution Cont

Step 2: i^ =^1 ,^ t 1 =^240 ,θ 1 =^675.^65 K

12 4 8 1 =^11 = =− × − × =−

− k f t θ f

( ) ( )

  1. 44199 240 2

1 240 , 675. 65 2

1 240 2

1 , 2

1

12 4 8

2 1 1 1

= =− × − × = −

 

  

 = + + − 

  

 = + +

− f

k f t h θ kh f

( ) ( )

  1. 31372 240 2

1 240 , 675. 65 2

1 240 2

1 , 2

1

12 4 8

3 1 1 2

= = × − × = −

 

  

 = + + − 

  

 = + +

− f

k f t h θ k h f

( ) ( ( ) ( ) )

, 240 240 , 675. 65 0. 34775240

12 4 8

4 1 1 3

= = × − × = −

= + + = + + −

− f

k f t h θ k h f

Solution Cont

θ 2 is the approximate temperature at

t 2 = t 1 + h = 240 + 240 = 480

θ ( 480 ) ≈θ 2 = 594. 91 K

K
k k k k h

2 1 1 2 3 4

Comparison with exact results

0

400

800

1200

1600

0 200 400 600

Time,t(sec)

Temperature,

h=

Exact

h=

h=

θ(K)

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

Step size, h θ (480) E t

t

Effect of step size

θ( 480 ) = 647. 57 K

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

(exact)

Comparison of Euler and Runge-Kutta

Methods

0

200

400

600

800

1000

1200

1400

0 100 200 300 400 500

Time, t(sec)

Temperature,

θ(K)

Exact

4th order

Heun

Euler

Figure 3. Comparison of Runge-Kutta methods of 1st, 2nd, and 4th order.