0% found this document useful (0 votes)
179 views16 pages

Runge 4 Order Method: Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

The document describes the 4th order Runge-Kutta method for solving ordinary differential equations numerically. It provides the equations for the 4th order RK method and applies it to solve the differential equation for cooling of a ball, comparing the numerical solution to the exact solution. It shows that decreasing the step size h improves the accuracy of the numerical solution and that the 4th order RK method is more accurate than lower order methods like Euler's method.

Uploaded by

jesantNM
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)
179 views16 pages

Runge 4 Order Method: Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

The document describes the 4th order Runge-Kutta method for solving ordinary differential equations numerically. It provides the equations for the 4th order RK method and applies it to solve the differential equation for cooling of a ball, comparing the numerical solution to the exact solution. It shows that decreasing the step size h improves the accuracy of the numerical solution and that the 4th order RK method is more accurate than lower order methods like Euler's method.

Uploaded by

jesantNM
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/ 16

1/10/2010 http://numericalmethods.eng.usf.

edu 1
Runge 4
th
Order Method
Major: All Engineering Majors
Authors: Autar Kaw, Charlie Barker
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
Runge-Kutta 4
th
Order Method
http://numericalmethods.eng.usf.edu
http://numericalmethods.eng.usf.edu 3
Runge-Kutta 4
th
Order Method
where
( )h k k k k y y
i i 4 3 2 1 1
2 2
6
1
+ + + + =
+
( )
i i
y x f k ,
1
=

+ + = h k y h x f k
i i 1 2
2
1
,
2
1

+ + = h k y h x f k
i i 2 3
2
1
,
2
1
( ) h k y h x f k
i i 3 4
, + + =
For
0
) 0 ( ), , ( y y y x f
dx
dy
= =
Runge Kutta 4
th
order method is given by
http://numericalmethods.eng.usf.edu 4
How to write Ordinary Differential
Equation
Example
( ) 5 0 , 3 . 1 2 = = +

y e y
dx
dy
x
isrewrittenas
( ) 5 0 , 2 3 . 1 = =

y y e
dx
dy
x
Inthiscase
( ) y e y x f
x
2 3 . 1 , =

How does one write a first order differential equation in the form of
( ) y x f
dx
dy
, =
http://numericalmethods.eng.usf.edu 5
Example
A ball at 1200K is allowedto cool downinair at anambient temperature
of 300K. Assuming heat is lost only due to radiation, the differential
equationfor thetemperatureof theball isgivenby
( ) ( ) K
dt
d
1200 0 , 10 81 10 2067 . 2
8 4 12
= =


Findthetemperatureat 480 = t
secondsusingRunge-Kutta4
th
order method.
240 = h
seconds.
( )
8 4 12
10 81 10 2067 . 2 =


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

t f
Assume a step size of
( )h k k k k
i i 4 3 2 1 1
2 2
6
1
+ + + + =
+

http://numericalmethods.eng.usf.edu 6
Solution
Step1:
1200 ) 0 ( , 0 , 0
0 0
= = = = t i
( ) ( ) ( ) 5579 . 4 10 81 1200 10 2067 . 2 1200 , 0 ,
8 4 12
0 1
= = = =

f t f k
o

( ) ( )
( ) ( ) 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
( ) ( )
( ) ( ) 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
( ) ( ) ( ) ( )
( ) ( ) 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
http://numericalmethods.eng.usf.edu 7
Solution Cont
1
is the approximate temperature at
240 240 0
0 1
= + = + = = h t t t
( ) K 65 . 675 240
1
=
( )
( ) ( ) ( ) ( )
( )
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
=
+ =
+ + + + =
+ + + + =
http://numericalmethods.eng.usf.edu 8
Solution Cont
Step 2:
K t i 65 . 675 , 240 , 1
1 1
= = =
( ) ( ) ( ) 44199 . 0 10 81 65 . 675 10 2067 . 2 65 . 675 , 240 ,
8 4 12
1 1 1
= = = =

f t f k
( ) ( )
( ) ( ) 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
( ) ( )
( ) ( ) 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
( ) ( ) ( ) ( )
( ) ( ) 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
http://numericalmethods.eng.usf.edu 9
Solution Cont

2
is the approximate temperature at
480 240 240
1 2
= + = + = h t t
( ) K 91 . 594 480
2
=
( )
( ) ( ) ( ) ( )
( )
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
=
+ =
+ + + + =
+ + + + =
http://numericalmethods.eng.usf.edu 10
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
=
+


t
The solution to this nonlinear equation at t=480 seconds is
K 57 . 647 ) 480 ( =
http://numericalmethods.eng.usf.edu 11
Comparison with exact results
Figure 1. 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 (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
http://numericalmethods.eng.usf.edu 12
Effect of step size
Table1. Temperature at 480 seconds as a function of stepsize, h
K 57 . 647 ) 480 ( = (exact)
http://numericalmethods.eng.usf.edu 13
Effects of step size on Runge-
Kutta 4
th
Order Method
Figure 2. 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
)
http://numericalmethods.eng.usf.edu 14
Comparison of Euler and Runge-
Kutta Methods
Figure 3. Comparison of Runge-Kutta methods of 1st, 2nd, and 4th order.
0
200
400
600
800
1000
1200
1400
0 100 200 300 400 500
Ti me, t(sec)
T
e
m
p
e
r
a
t
u
r
e
,

(
K
)
Exact
4th order
Heun
Euler
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit
http://numericalmethods.eng.usf.edu/topics/runge_kutt
a_4th_method.html
THE END
http://numericalmethods.eng.usf.edu

You might also like