Beruflich Dokumente
Kultur Dokumente
solution
Runge-Kutta Methods
Euler’s Method: Example
Obtain a solution between x = 0 to x = 4
with a step size of 0.5 for: dy
2 x 12 x 2 20 x 8.5
3
dx
Initial conditions are: x = 0 to y = 1
Solution:
y (0.5) y (0 ) f (0,1).(0.5)
1.0 8.5 x0.5 5.25
y (1.0 ) y (0.5) f (0.5,5.25).(0.5)
5.25 ( 2(0.5)3 12(0.5) 2 20(0.5) 8.5).(0.5) 5.875
y ( 2.0 ) y (1.0 ) f (1.0,5.875).(0.5)
5.25 ( 2(1.0 )3 12(1.0 ) 2 20(1.0 ) 8.5).(0.5) 5.125
Euler’s Method: Example
• Although the computation captures the general trend
solution, the error is considerable.
• This error can be reduced by using a smaller step size.
Improvements of Euler’s method
• A fundamental source of error in Euler’s
method is that the derivative at the beginning
of the interval is assumed to apply across the
entire interval.
a1 a2 1
1
a 2 p1 A value is assumed for one of the
2 unknowns to solve for the other
1 three.
a2 q11
2
Runge-Kutta Methods
1 1
a1 a2 1, a 2 p1 , a2 q11
2 2
y
a
Slope: 0.5(k1+k2)
x
xi xi+h
y
Runge-Kutta Methods
• Midpoint Method:
Uses Euler’s method to predict
a value of y at the midpoint of f(xi+h/2,yi+k1h/2)
f(xi,yi)
the interval: x
xi xi+h/2
a
Slope: k2
x
Chapter 25 xi xi+h
Runge-Kutta Methods y
• Ralston’s Method:
f(xi+ 3/4 h,
f(xi,yi) yi+3/4k1h)
xi xi+3/4h
x
y
a
Slope:
(1/3k1+2/3k2)
Chapter 25
xi xi+h x
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
f ( x, y ) 4e 0.8 x
0.5 y
Chapter 25