Runge-Kutta Methods: Order 2 and 4 for Numerical Solutions of Differential Equations - Pro, Assignments of Computer Science

An overview of runge-kutta methods for solving initial value problems of differential equations. It covers methods of orders 2 and 4, including the modified euler method, midpoint method, minimum bound to the error method, heun's method, and the runge-kutta-fehlberg method. The general form of these methods, their error analysis, and the number of function evaluations required.

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-fpd
koofers-user-fpd 🇺🇸

8 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 340 Introduction to Scientific Computing
Section 6.3: Runge-Kutta Methods
April 14 & 16, 2005
NOTE: All of the following methods generate numerical solutions to the initial value problem
dy
dx =f(x, y)y(x0) = y0
1 Runge-Kutta Methods of Order 2
Method 1 (Runge-Kutta Methods of Order 2 (RK2))
General Form
yi+1 =yi+ak1+bk2
k1=hf(xi, yi)
k2=hf(xi+αh, yi+βk1)
where a+b= 1,αb =1
2and βb =1
2, which has global error O(h2).
NOTE: This method requires two function evaluations, one to determine k1and one to determine k2.
1.1 Modified Euler Method (RK2)
Where a=1
2, b =1
2, α = 1, β = 1, i.e.
yi+1 =yi+h
2f(xi, yi) + h
2f(xi+h, yi+hf(xi, yi))
1.2 Midpoint Method (RK2)
Where a= 0, b = 1, α =1
2, β =1
2, i.e.
yi+1 =yi+h f µxi+h
2, yi+h
2f(xi, yi)
1.3 Minimum Bound to the Error Method (RK2)
Where a=1
3, b =2
3, α =3
4, β =3
4, i.e.
yi+1 =yi+h
3f(xi, yi) + 2
3h f µxi+3
4h, yi+3
4hf(xi, yi)
1.4 Heun’s Method (RK2)
Where a=1
4, b =3
4, α =2
3, β =2
3, i.e.
yi+1 =yi+h
4f(xi, yi) + 3
4h f µxi+2
3h, yi+2
3hf(xi, yi)
pf3

Partial preview of the text

Download Runge-Kutta Methods: Order 2 and 4 for Numerical Solutions of Differential Equations - Pro and more Assignments Computer Science in PDF only on Docsity!

CS 340 – Introduction to Scientific Computing Section 6.3: Runge-Kutta Methods April 14 & 16, 2005

NOTE: All of the following methods generate numerical solutions to the initial value problem

dy dx

= f (x, y) y(x 0 ) = y 0

1 Runge-Kutta Methods of Order 2

Method 1 (Runge-Kutta Methods of Order 2 (RK2))

General Form

yi+1 = yi + ak 1 + bk 2 k 1 = hf (xi, yi) k 2 = hf (xi + αh, yi + βk 1 )

where a + b = 1, αb = 12 and βb = 12 , which has global error O(h^2 ).

NOTE: This method requires two function evaluations, one to determine k 1 and one to determine k 2.

1.1 Modified Euler Method (RK2)

Where a = 12 , b = 12 , α = 1, β = 1, i.e.

yi+1 = yi + h 2

f (xi, yi) + h 2

f (xi + h, yi + hf (xi, yi))

1.2 Midpoint Method (RK2)

Where a = 0, b = 1, α = 12 , β = 12 , i.e.

yi+1 = yi + h f

( xi + h 2

, yi + h 2

f (xi, yi)

)

1.3 Minimum Bound to the Error Method (RK2)

Where a = 13 , b = 23 , α = 34 , β = 34 , i.e.

yi+1 = yi + h 3 f (xi, yi) +^23 h f

( xi +^34 h, yi +^34 hf (xi, yi)

)

1.4 Heun’s Method (RK2)

Where a = 14 , b = 34 , α = 23 , β = 23 , i.e.

yi+1 = yi +

h 4 f^ (xi, yi) +

4 h f

( xi +

3 h, yi^ +

3 hf^ (xi, yi)

)

2 Runge-Kutta Order Four (RK4)

Method 2 (RK4)

k 1 = h f (xi, yi) k 2 = h f

( xi + h 2

, yi +^1 2

k 1

)

k 3 = h f

( xi + h 2

, yi +^1 2

k 2

)

k 4 = h f (xi + h, yi + k 3 ) yi+1 = yi +^16 (k 1 + 2k 2 + 2k 3 + k 4 )

which has local truncation error O(h^4 ).

NOTE: This method requires four function evaluations, one to determine each ki , for i = 1, 2 , 3 , 4.

3 Function Evaluations in Higher Order Runge-Kutta Methods

The main computational effort in applying the Runge-Kutta methos is the evaluation of f. There is a relationship between the number of evaluations per step and the order of the local truncation error that indicates that methods of order less than five, with smaller step size, are used in preference to the higher-order methods using a larger step size.

Evaluations per step 2 3 4 5 ≤ n ≤ 7 8 ≤ n ≤ 9 10 ≤ n Best possible local truncation error O(h^2 ) O(h^3 ) O(h^4 ) O(hn−^1 ) O(hn−^2 ) O(hn−^3 )

NOTE: This was taken from the text, Numerical Analysis, 7th^ Edition, by Burden & Faires, Brooks/Cole, 2001, p.270.

4 Adaptive Methods: Runge-Kutta-Fehlberg (RKF)

This method is analogous to the adaptive quadrature methods of chapter five (Adaptive Simpson’s (^13) Method is what we studied). Essentially, you want to choose your step size, h, as large as possible yet insure that your answer is correct within a certain tolerance.

One method to do this is to calculate your ˆyi+1 value with one h 1 , then repeat your procedure using h 2 = h 1 /2 (doing two iterations) to get yi+1. If |yi+1 − yˆi+1| < tol then use your better approximation, yi+1, otherwise, continue to halve your h’s until this condition is met. But note, if you’re using an RK method, this requires four function evaluations to get ˆyi+1 and six new function evaluations (one each for k 2 , k 3 , and k 4 at each iteration) to get yi+1, or ten in total.

(x_(i+1), y_(i+1))^

(x_i,y_i)

(x_i + h/2, y_(i+h/2)) x

y (^) = with original h stepsize = with h/2 step size

(x_(i+1), y_(i+1))

E