Numerical Methods3
Numerical Methods3
Wegstein Method
Wegstein Method
Wegstein Method
NUMERICAL INTEGRATION
• EULERS ALGORITHM
• RUNGE KUTTA (4th ORDER)
EULERS ALGORITHM
Non-linear function
We need to know, where are we starting from that is initial conditions for x. Usually
this is at time equal to zero
EULERS ALGORITHM - 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 Euler’s method. Assume a step size of
h 240 seconds.
EULERS ALGORITHM - Example
Step 1:
d
2.2067 10 12 4 81 10 8
dt
f t , 2.2067 10 12 4 81 10 8
i 1 i f ti , i h
1 0 f t 0 , 0 h
1200 f 0,1200 240
1200 2.2067 10 12 1200 4 81 10 8 240
1200 4.5579 240
106 .09 K
is the approximate temperature at t t1 t0 h 0 240 240
1
240 1 106.09K
EULERS ALGORITHM - Example
480 2 110.32 K
EULERS ALGORITHM - Example
For dy
f ( x, y ), y (0) y0
dx
Runge Kutta 4th order method is given by
1
yi 1 yi k1 2k 2 2k3 k 4 h
6
where
k1 f xi , yi
1 1
k2 f xi h, yi k1h
2 2
1 1
k3 f xi h, yi k 2 h
2 2
k4 f xi h, yi k3h
Runge-Kutta 4th Order Method-Example
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 81 108
1
i 1 i k1 2k 2 2k 3 k 4 h
6
Runge-Kutta 4th Order Method-Example
t t1 t0 h 0 240 240
240 1 675.65K
Runge-Kutta 4th Order Method-Example
i 1, t1 240,1 675.65K
k1 f t1 , 1 f 240,675.65 2.2067 10 12 675.654 81108 0.44199
1 1 1 1
k 2 f t1 h, 1 k1h f 240 240, 675.65 0.44199240
2 2 2 2
f 360,622.61 2.2067 10 12 622.614 81 108 0.31372
1 1 1 1
k3 f t1 h,1 k 2 h f 240 240,675.65 0.31372240
2 2 2 2
f 360, 638.00 2.2067 10 12 638.00 4 81108 0.34775
k 4 f t1 h, 1 k3h f 240 240 ,675.65 0.34775240
f 480,592.19 2.2067 10 12 592.19 4 81108 0.25351
Runge-Kutta 4th Order Method-Example
1
2 1 k1 2k 2 2k3 k4 h
6
1
675.65 0.44199 2 0.31372 2 0.34775 0.25351240
6
1
675.65 2.0184240
6
594.91K
2 is the approximate temperature at
480 2 594.91K
Runge-Kutta 4th Order Method-Example
Effect of step size
Table 1. Temperature at 480 seconds as a function of step size, h