Runge-Kutta 4th Order Method for Ordinary Differential ...
Chapter 08.04 Runge-Kutta 4th Order Method for Ordinary Differential Equations
After reading this chapter, you should be able to 1. develop Runge-Kutta 4th order method for solving ordinary differential equations,
2. find the effect size of step size has on the solution, 3. know the formulas for other versions of the Runge-Kutta 4th order method
What is the Runge-Kutta 4th order method?
Runge-Kutta 4th order method is a numerical technique used to solve ordinary differential equation of the form
dy dx
=
f (x, y), y(0) =
y0
So only first order ordinary differential equations can be solved by using the Runge-Kutta 4th
order method. In other sections, we have discussed how Euler and Runge-Kutta methods are
used to solve higher order ordinary differential equations or coupled (simultaneous)
differential equations.
How does one write a first order differential equation in the above form?
Example 1
Rewrite
dy + 2 y = 1.3e-x , y(0) = 5
dx
in
dy dx
=
f (x, y),
y(0) =
y0
form.
08.04.1
08.04.2
Chapter 08.04
Solution
dy + 2 y = 1.3e-x , y(0) = 5
dx
dy = 1.3e-x - 2 y, y(0) = 5
dx In this case
f (x, y) = 1.3e-x - 2 y
Example 2
Rewrite
e y dy + x2 y 2 = 2sin(3x), y(0) = 5
dx
in
dy dx
=
f (x, y),
y(0) =
y0
form.
Solution
e y dy + x2 y 2 = 2sin(3x), y(0) = 5
dx
dy = 2sin(3x) - x2 y 2 , y(0) = 5
dx
ey
In this case
f (x, y) = 2sin(3x) - x2 y 2
ey
The Runge-Kutta 4th order method is based on the following
( ) yi+1 = yi + a1k1 + a2k2 + a3k3 + a4k4 h
(1)
where knowing the value of y = yi at xi , we can find the value of y = yi+1 at xi+1 , and
h = xi+1 - xi
Equation (1) is equated to the first five terms of Taylor series
( ) ( ) ( ) yi+1
=
yi
+
dy dx
xi , yi
xi+1 - xi
+
1 2!
d2y dx 2
xi , yi
xi+1 - xi
2
+
1 3!
d3y dx3
xi , yi
xi+1 - xi
3
(2)
( ) +
1 4!
d4y dx 4
xi , yi
xi+1 - xi
4
Knowing that
dy dx
=
f (x, y)
and
xi+1
- xi
=h
yi+1
=
yi
+
f
(xi ,
yi )h +
1 2!
f
' (xi ,
yi )h2
+
1 3!
f
( ) '' xi , yi h3
+
1 4!
f
(''' xi ,
yi )h4
(3)
Based on equating Equation (2) and Equation (3), one of the popular solutions used is
yi+1
=
yi
+
1 6
(k1
+
2k2
+
2k3
+
k4
)h
(4)
Runge-Kutta 4th Order Method
k1 = f (xi , yi )
k2
=
f
xi
+
1 2
h,
yi
+
1 2
k1h
k3
=
f
xi
+
1 2 h, yi
+
1 2
k2
h
k4 = f (xi + h, yi + k3h)
08.04.3
(5a)
(5b) (5c) (5d)
Example 3
A ball at 1200 K is allowed to cool down in air at an ambient temperature of 300 K. 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?108 , (0) = 1200 K
dt where is in K and t in seconds. Find the temperature at t = 480 seconds using RungeKutta 4th order method. Assume a step size of h = 240 seconds. Solution
( ) d = -2.2067 ?10-12 4 - 81?108
dt
( ) f (t, ) = -2.2067 ?10-12 4 - 81?108
i+1
=
i
+
1 6
(k1
+
2k2
+
2k3
+
k4
)h
For i = 0 , t0 = 0 , 0 = 1200K
k1 = f (t0 ,0 ) = f (0,1200)
( ) = -2.2067 ?10-12 12004 - 81?108
= -4.5579
k2
=
f
t0
+
1 2
h,
0
+
1 2
k1h
= f 0 + 1 (240),1200 + 1 (- 4.5579)? 240
2
2
= f (120,653.05)
( ) = -2.2067 ?10-12 653.054 - 81?108
= -0.38347
k3
=
f
t
0
+
1 2
h,
0
+
1 2
k
2
h
= f 0 + 1 (240),1200 + 1 (- 0.38347)? 240
2
2
= f (120,1154.0)
08.04.4
Chapter 08.04
( ) = -2.2067 ?10-12 1154.04 - 81?108
= -3.8954
k4 = f (t0 + h,0 + k3h) = f (0 + 240,1200 + (- 3.894)? 240) = f (240,265.10)
( ) = -2.2067 ?10-12 265.104 - 81?108
= 0.0069750
1
=
0
+
1 6
(k1
+
2k2
+
2k3
+
k4 )h
= 1200 + 1 (- 4.5579 + 2(- 0.38347) + 2(- 3.8954) + (0.069750))240
6
= 1200 + (- 2.1848)? 240
= 675.65 K
1 is the approximate temperature at
t = t1
= t0 + h
= 0 + 240 = 240
1 = (240)
675.65 K
For i = 1,t1 = 240,1 = 675.65 K
k1 = f (t1,1 ) = f (240,675.65)
( ) = -2.2067 ?10-12 675.654 - 81?108
= -0.44199
k2
=
f
t1
+
1 2
h,1
+
1 2
k1h
= f 240 + 1 (240),675.65 + 1 (- 0.44199)240
2
2
= f (360,622.61)
( ) = -2.2067 ?10-12 622.614 - 81?108
= -0.31372
k3
=
f
t1
+
1 2
h,1
+
1 2
k
2h
= f 240 + 1 (240),675.65 + 1 (- 0.31372)? 240
2
2
= f (360,638.00)
( ) = -2.2067 ?10-12 638.004 - 81?108
Runge-Kutta 4th Order Method
08.04.5
= -0.34775
k4 = f (t1 + h,1 + k3h) = f (240 + 240,675.65 + (- 0.34775)? 240) = f (480,592.19)
( ) = 2.2067 ?10-12 592.194 - 81?108
= -0.25351
2
= 1
+
1 6
(k1
+ 2k2
+ 2k3
+
k4 )h
= 675.65 + 1 (- 0.44199 + 2(- 0.31372) + 2(- 0.34775) + (- 0.25351))? 240
6
= 675.65 + 1 (- 2.0184)? 240
6
= 594.91K
2 is the approximate temperature at t = t2 = t1 + h = 240 + 240 = 480
2 = (480)
594.91K
Figure 1 compares the exact solution with the numerical solution using the Runge-Kutta 4th order method with different step sizes.
1600
Temperature, (K)
1200 800 400
h=120
Exact h=240
0 0
-400
h=480
200
400
600
Time,t(sec)
Figure 1 Comparison of Runge-Kutta 4th order method with exact solution for different step sizes.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- subnetting questions with answers
- elg 240 mean well
- welcome to cs 240
- 120 240 vac single split phase multi wire branch circuits
- ideal for times microwave
- standard specification for chromium and chromium nickel
- variations in 8th and 9th vs 10th and 11th edition questions
- runge kutta 4th order method for ordinary differential
- 59 240 physical chemistry question set 13 lecture 13
- ipc 220 240 socket lga 1151 th core i cpu