Vous êtes sur la page 1sur 22

TH

Presented by
M.Saravanakumar
The solution of a differential equation using higher
order derivatives of the Taylor expansion is not
practical.
Since for only the simplest functions, these higher
orders are complicated. Also there is no simple
algorithm which can be developed.
This is because each series expansion is unique.
However we have methods which use only 1
st
order
derivates while simulating higher order(producing
equivalent results).
These one step methods are called Runge-Kutta
methods.
Approximation of the second, third and fourth
order (retaining h
2
, h
3
, h
4
respectively in the Taylor
expansion) require estimation at 2, 3 , 4 pts
respectively in the interval (x
i
,x
i+1
).
The Runge-Kutta methods have algorithms of the
form,
where is the increment function.
The increment function is a suitably chosen
approximation to on the interval
( ) h y x h y y
i i i i
, ,
1
| + =
+
|
( ) y x f ,
Fourth Order Runge-Kutta Method
The fourth order Runge-Kutta (RK-4) method is derived by applying the Simpsons
1/3 or Simpsons 3/8 rule to integrating over the interval . The
formula of RK-4 based on the Simpsons 1/3 is written as




) , ( ' t y f y =
] , [
1 + n n
t t
( )
) , (
)
2
, (
)
2
, (
) , ( where
2 2
6
1
3 4
2 2
1
3
1 2
1
2
1
4 3 2 1 1
h t k y hf k
h
t k y hf k
h
t k y hf k
t y hf k
k k k k y y
n n
n n
n n
n n
n n
+ + =
+ + =
+ + =
=
+ + + + =
+
The 4th Order Runge-Kutta
This is a fourth order function that solves
an initial value problems using a four step
program to get an estimate of the Taylor
series through the fourth order.
This will result in a local error of O(Dh
5
)
and a global error of O(Dh
4
)
4
th
-order
Runge-Kutta Method
x
i
x
i
+h/2 x
i
+h
f
1

f
2

f
3

f
4

( )
4 3 2 1
2 2
6
1
f f f f f + + + =
f
Runge-Kutta Method
(4
th
Order) Example

Consider Exact Solution


The initial condition is:
The step size is:

2
x y
dx
dy
=
x 2
2 2 e x x y + + =
( ) 1 0 = y
1 . 0 = Ah
The 4
th
Order Runge-Kutta
The example of a single step:
( ) | | ( ) ( )
( )
( )
( ) | | ( )
| | 104829 . 1 2 2
6
1
109499 . 0 104988 . 1 , 1 . 0 1 . 0 ,
104988 . 0 2 / . 1 , 05 . 0 1 . 0
2
1
,
2
1
10475 . 0 05 . 1 , 05 . 0 1 . 0
2
1
,
2
1
1 . 0 0 1 1 . 0 1 , 0 1 . 0 ,
4 3 2 1 n 1 n
3 4
2 2 3
1 2
2
1
= + + + + =
= = + A + A =
= + =
(

|
.
|

\
|
+ A + A =
= =
(

|
.
|

\
|
+ A + A =
= = = A =
+
k k k k y y
f k y h x f h k
k f k y h x f h k
f k y h x f h k
f y x f h k
Runge-Kutta Method (4
th
Order)
Example
The values for the 4
th
order Runge-Kutta method
x y f(x,y) k
1
f
2
k
2
f
3
k
3
f
4
k
4 Exact
0 1 1 0.1 1.0475 0.10475 1.049875 0.104988 1.094988 0.109499 1
0.1 1.104829 1.094829 0.109483 1.13707 0.113707 1.139182 0.113918 1.178747 0.117875 1.104829
0.2 1.218597 1.178597 0.11786 1.215027 0.121503 1.216848 0.121685 1.250282 0.125028 1.218597
0.3 1.340141 1.250141 0.125014 1.280148 0.128015 1.281648 0.128165 1.308306 0.130831 1.340141
0.4 1.468175 1.308175 0.130817 1.331084 0.133108 1.332229 0.133223 1.351398 0.13514 1.468175
0.5 1.601278 1.351278 0.135128 1.366342 0.136634 1.367095 0.13671 1.377988 0.137799 1.601279
0.6 1.73788 1.37788 0.137788 1.384274 0.138427 1.384594 0.138459 1.38634 0.138634 1.737881
0.7 1.876246 1.386246 0.138625 1.383059 0.138306 1.382899 0.13829 1.374536 0.137454 1.876247
0.8 2.014458 1.374458 0.137446 1.360681 0.136068 1.359992 0.135999 1.340457 0.134046 2.014459
0.9 2.150396 1.340396 0.13404 1.314915 0.131492 1.313641 0.131364 1.28176 0.128176 2.150397
1 2.281717 1.281717 0.128172 1.243303 0.12433 1.241382 0.124138 1.195855 0.119586 2.281718
Runge-Kutta Method (4
th
Order)
Example
A comparison between the 2
nd
order and
the 4
th
order Runge-Kutta methods show a
slight difference.
Runge Kutta Comparison
-10
-8
-6
-4
-2
0
2
4
0 1 2 3 4
X Value
Y

V
a
l
u
e
Exact
2nd order
4th order
Error of the Methods
0.00
2.00
4.00
6.00
8.00
10.00
0 1 2 3 4 5
X Value
A
b
s
o
l
u
t
e

|
E
r
r
o
r
|
Error 2nd order method
Error 4th order method
Example-1
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
1200 0 , 10 81 10 2067 . 2
8 4 12
= =

u u
u

Find the temperature at
480 = t seconds using Runge-Kutta 4
th
order method.
240 = h
seconds.
( )
8 4 12
10 81 10 2067 . 2 u =
u

dt
d
( ) ( )
8 4 12
10 81 10 2067 . 2 , u = u

t f
Assume a step size of
( )h k k k k
i i 4 3 2 1 1
2 2
6
1
+ + + + =
+
u u
Solution
Step 1:
1200 ) 0 ( , 0 , 0
0 0
= = = = u u t i
( ) ( ) ( ) 5579 . 4 10 81 1200 10 2067 . 2 1200 , 0 ,
8 4 12
0 1
= = = =

f t f k
o
u
( ) ( )
( ) ( ) 38347 . 0 10 81 05 . 653 10 2067 . 2 05 . 653 , 120
240 5579 . 4
2
1
1200 , 240
2
1
0
2
1
,
2
1
8 4 12
1 0 0 2
= = =
|
.
|

\
|
+ + = |
.
|

\
|
+ + =

f
f h k h t f k u
( ) ( )
( ) ( ) 8954 . 3 10 81 0 . 1154 10 2067 . 2 0 . 1154 , 120
240 38347 . 0
2
1
1200 , 240
2
1
0
2
1
,
2
1
8 4 12
2 0 0 3
= = =
|
.
|

\
|
+ + =
|
.
|

\
|
+ + =

f
f h k h t f k u
( ) ( ) ( ) ( )
( ) ( ) 0069750 . 0 10 81 10 . 265 10 2067 . 2 10 . 265 , 240
240 984 . 3 1200 , 240 0 ,
8 4 12
3 0 0 4
= = =
+ + = + + =

f
f h k h t f k u
Solution Cont
1
u is the approximate temperature at
240 240 0
0 1
= + = + = = h t t t
( ) K 65 . 675 240
1
= ~u u
( )
( ) ( ) ( ) ( )
( )
K
h k k k k
65 . 675
240 1848 . 2
6
1
1200
240 069750 . 0 8954 . 3 2 38347 . 0 2 5579 . 4
6
1
1200
2 2
6
1
4 3 2 1 0 1
=
+ =
+ + + + =
+ + + + =u u
Solution Cont
Step 2:
K t i 65 . 675 , 240 , 1
1 1
= = = u
( ) ( ) ( ) 44199 . 0 10 81 65 . 675 10 2067 . 2 65 . 675 , 240 ,
8 4 12
1 1 1
= = = =

f t f k u
( ) ( )
( ) ( ) 31372 . 0 10 81 61 . 622 10 2067 . 2 61 . 622 , 360
240 44199 . 0
2
1
65 . 675 , 240
2
1
240
2
1
,
2
1
8 4 12
1 1 1 2
= = =
|
.
|

\
|
+ + = |
.
|

\
|
+ + =

f
f h k h t f k u
( ) ( )
( ) ( ) 34775 . 0 10 81 00 . 638 10 2067 . 2 00 . 638 , 360
240 31372 . 0
2
1
65 . 675 , 240
2
1
240
2
1
,
2
1
8 4 12
2 1 1 3
= = =
|
.
|

\
|
+ + = |
.
|

\
|
+ + =

f
f h k h t f k u
( ) ( ) ( ) ( )
( ) ( ) 25351 . 0 10 81 19 . 592 10 2067 . 2 19 . 592 , 480
240 34775 . 0 65 . 675 , 240 240 ,
8 4 12
3 1 1 4
= = =
+ + = + + =

f
f h k h t f k u
Solution Cont
u
2
is the approximate temperature at
480 240 240
1 2
= + = + = h t t
( ) K 91 . 594 480
2
= ~u u
( )
( ) ( ) ( ) ( )
( )
K
h k k k k
91 . 594
240 0184 . 2
6
1
65 . 675
240 25351 . 0 34775 . 0 2 31372 . 0 2 44199 . 0
6
1
65 . 675
2 2
6
1
4 3 2 1 1 2
=
+ =
+ + + + =
+ + + + =u u
Solution Cont
The exact solution of the ordinary differential equation is given by the
solution of a non-linear equation as
( ) 9282 . 2 10 22067 . 0 00333 . 0 tan 8519 . 1
300
300
ln 92593 . 0
3 1
= u
+ u
u

t
The solution to this nonlinear equation at t=480 seconds is
K 57 . 647 ) 480 ( = u
Comparison with exact results
Figure . Comparison of Runge-Kutta 4th order method with exact solution
-400
0
400
800
1200
1600
0 200 400 600
Time,t(sec)
T
e
m
p
e
r
a
t
u
r
e
,
h=120
Exact
h=240
h=480

(
K
)
Step size, h u (480) E
t
|
t
|%
480
240
120
60
30
90.278
594.91
646.16
647.54
647.57
737.85
52.660
1.4122
0.033626
0.00086900
113.94
8.1319
0.21807
0.0051926
0.00013419
Effect of step size
Table 1. Temperature at 480 seconds as a function of step size, h
K 57 . 647 ) 480 ( = u (exact)
Effects of step size on Runge-Kutta 4
th
Order
Method
Figure . Effect of step size in Runge-Kutta 4th order method
-200
0
200
400
600
800
0 100 200 300 400 500
Step size, h
T
e
m
p
e
r
a
t
u
r
e
,

(
4
8
0
)
Summary
Runge Kutta methods generate an accurate solution
without the need to calculate high order derivatives.
Second order RK have local truncation error of order
O(h
3
) and global truncation error of order O(h
2
).
Higher order RK have better local and global
truncation errors.
N function evaluations are needed in the N
th
order RK
method.
THANK YOU

Vous aimerez peut-être aussi