Ch25 Runge Kutta Method0
Ch25 Runge Kutta Method0
Ch25 Runge Kutta Method0
Ordinary Differential
Equations ODEs
Ordinary Differential
Equations
When a function involves one dependent
variable, the equation is called an ordinary
differential equation (ODE).
dy
y f (x )
dx
dy
- Non-Linear 1 order ODE
f ( x, y )
dx
Where f(x,y) is nonlinear
st
d y
dy
p ( x, y ) Q ( x, y ) y f ( x )
2
dx
dx
Higher order equations can be reduced to a system
of first order equations, by redefining a variable.
Runge-Kutta Methods
This chapter is devoted to solving ODE of the
form:
dy
f ( x, y )
dx
Eulers Method
solution
Runge-Kutta Methods
dx
Solution:
y (0.5) y (0 ) f (0,1).(0.5)
1.0 8.5 x0.5 5.25
Improvements of Eulers
method
Runge-Kutta Methods
Runge-Kutta methods achieve the accuracy of a
Taylor series approach without requiring the
calculation of higher derivatives.
y i 1 y i (x i , y i , h )h
Increment function
a1k 1 a2 k 2 L an k n
(representative slope
a ' s constants
over the interval)
k 1 f (x i , y i )
k 2 f (x i p1h , y i q11k 1h )
k 3 f (x i p 3h , y i q 21k 1h q 22 k 2 h )
M
k n f (x i p n 1h , y i q n 1k 1h q n 1,2 k 2 h L q n 1,n 1k n 1h )
p ' s and q ' s are constants
Runge-Kutta Methods
yi 1 yi (a1k1 a2 k 2 )h
k1 f ( x i , yi )
k 2 f ( xi p1h, yi q11k1h)
Runge-Kutta Methods
Three equations to evaluate the four unknown
constants are derived:
a1 a2 1
1
a 2 p1
2
1
a2 q11
2
Runge-Kutta Methods
1
1
a1 a2 1, a 2 p1 , a2 q11
2
2
Runge-Kutta Methods
Three of the most commonly used methods
are:
Huen Method with a Single Corrector
(a2=1/2)
Runge-Kutta Methods
y
Heuns Method:
Involves the
determination of two
derivatives for the
interval at the initial
point and the end point.
f(xi,yi)
xi
f(xi+h,yi+k1h)
xi+h
y
a
Slope: 0.5(k1+k2)
xi
xi+h
Runge-Kutta
Methods
Midpoint Method:
f(xi,yi)
xi
f(xi+h/2,yi+k1h/2)
x
xi+h/2
y
a
Slope: k2
Chapter 25
xi
xi+h
Runge-Kutta Methods
Ralstons Method:
f(xi,yi)
xi
f(xi+ 3/4 h,
yi+3/4k1h)
xi+3/4h
x
y
a
Slope:
(1/3k1+2/3k2)
Chapter 25
xi
xi+h
Chapter 25
22
Runge-Kutta Methods
3. Third order RK methods
Chapter 25
Runge-Kutta Methods
4. Fourth order RK methods
1
yi 1 yi (k1 2k 2 2k3 k 4 )h
6
where
k1 f ( x i , yi )
1
1
k 2 f ( xi h, yi k1h)
2
2
1
1
k3 f ( xi h, yi k 2 h)
2
2
k3 f ( xi h, yi k3h)
Chapter 25
Comparison of Runge-Kutta
Methods
Use first to fourth order RK methods to solve the
equation from x = 0 to x = 4
Initial condition y(0) = 2, exact answer of y(4) =
75.33896
f ( x , y ) 4e
0 .8 x
0.5 y
Chapter 25