



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Section 5.9, Problem 2(a): Use the Runge-Kutta method for systems to approximate the solutions of first-order differential equation
u′ 1 = u 1 − u 2 + 2, u 1 (0) = − 1 , u′ 2 = −u 1 + u 2 + 4t, u 2 (0) = 0; 0 ≤ t ≤ 1; h = 0. 1 ,
and compare the result to the actual solution
u 1 (t) = −
e^2 t^ + t^2 + 2t −
u 2 (t) =
e^2 t^ + t^2 −
Solution: For a system of two differential equations
u′ 1 = f 1 (t, u 1 , u 2 ), u 1 (a) = α 1 , u′ 2 = f 2 (t, u 1 , u 2 ), u 2 (a) = α 2 , a ≤ t ≤ b,
the fourth-order Runge-Kutta method is
k 1 , 1 = hf 1
ti, w 1 ,i, w 2 ,i
k 1 , 2 = hf 2
ti, w 1 ,i, w 2 ,i
k 2 , 1 = hf 1
ti + h 2
, w 1 ,i + k 1 , 1 2
, w 2 ,i + k 1 , 2 2
k 2 , 2 = hf 2
ti +
h 2 , w 1 ,i +
k 1 , 1 2 , w 2 ,i +
k 1 , 2 2
k 3 , 1 = hf 1
ti + h 2
, w 1 ,i + k 2 , 1 2
, w 2 ,i + k 2 , 2 2
k 3 , 2 = hf 2
ti + h 2
, w 1 ,i + k 2 , 1 2
, w 2 ,i + k 2 , 2 2
k 4 , 1 = hf 1
ti + h, w 1 ,i + k 3 , 1 , w 2 ,i + k 3 , 2
k 4 , 2 = hf 2
ti + h, w 1 ,i + k 3 , 1 , w 2 ,i + k 3 , 2
w 1 ,i+1 = w 1 ,i +
k 1 , 1 + 2k 2 , 1 + 2k 3 , 1 + k 4 , 1
w 2 ,i+1 = w 2 ,i +
k 1 , 2 + 2k 2 , 2 + 2k 3 , 2 + k 4 , 2
where u 1 (ti) ≈ w 1 ,i, u 2 (ti) ≈ w 2 ,i.
NOTE THAT THE BOOK USES THE ”i,j” NOTATION INCONSISTENTLY. COM- PARE, FOR EXAMPLE, FORMULAS (5.48)-(5.52) WITH ALGORITHM 5.7 ON PAGE
Running the code gives: N = 10, h = 1. 0000000 e − 001 , t = 1.00, w1 = − 1. 1944446208 e + 000, w2 = 4. 1944446208 e + 000, u1 = − 1. 1945280495 e + 000, u2 = 4. 1945280495 e + 000, err1 = 8. 3428635596 e − 005 , err2 = 8. 3428635596 e − 005.
Running the code with h = 0.1 and h = 0.05, gives the convergence rate of p ≈ 3. 88 for each of the two ODEs. Running the code with h = 0.01 and h = 0.005, gives the convergence rate of p ≈ 3 .99 for each of the two ODEs. This verifies that our algorithm is indeed fourth-order accurate.
Section 5.9, Problem 3(b): Use the Runge-Kutta for Systems Algorithm to approxi- mate the solution of the following higher-order differential equation
t^2 y′′^ − 2 ty′^ + 2y = t^3 log t, y(1) = 1, y′(1) = 0, 1 ≤ t ≤ 2 , with h = 0. 1 ,
and compare the result to the actual solution
y(t) =
t +
t^3 log t −
t^3. (5)
Solution: We will convert the second order differential equation (4) into a system of two first order differential equations. Let
u 1 (t) = y(t), u 2 (t) = y′(t).
Then,
u′ 1 = y′^ = u 2 ,
u′ 2 = y′′^ = t^3 log t + 2ty′^ − 2 y t^2
t^3 log t + 2tu 2 − 2 u 2 t^2
is a first order system of two differential equations with initial conditions
u 1 (1) = y(1) = 1, u 2 (1) = y′(1) = 1.
Exact solution (5) for the system above can be written as
u 1 (t) = y(t) =
t +
t^3 log t −
t^3 ,
u 2 (t) = y′(t) =
t^2 log t −
t^2.
Running the Runge-Kutta fourth-order code for systems, gives
Section 5.10, Problem 2: For the Adams-Bashforth and Adams-Moulton methods of order four, a) Show that if f = 0, then
F (ti, h, wi+1,... , wi+1−m) = 0.
b) Show that if f satisfies a Lipschitz condition with constant L, then a constant C exists with
|F (ti, h, wi+1,... , wi+1−m) − F (ti, h, vi+1,... , vi+1−m)| ≤ C
∑^ m
j=
|wi+1−j − vi+1−j |.
Solution: a) The Adams-Bashforth fourth-order method can be expressed as
wi+1 = wi + F (ti, h, wi+1, wi, wi− 1 , wi− 2 , wi− 3 ), F (ti, h, wi+1, wi, wi− 1 , wi− 2 , wi− 3 ) = h 24
55 f (ti, wi) − 59 f (ti− 1 , wi− 1 ) + 37f (ti− 2 , wi− 2 ) − 9 f (ti− 3 , wi− 3 )
If f = 0, then F (ti, h, wi+1, wi, wi− 1 , wi− 2 , wi− 3 ) = 0. X.
The Adams-Moulton fourth-order method can be expressed as
wi+1 = wi + F (ti, h, wi+1, wi, wi− 1 , wi− 2 ), F (ti, h, wi+1, wi, wi− 1 , wi− 2 ) = h 24
9 f (ti+1, wi+1) + 19f (ti, wi) − 5 f (ti− 1 , wi− 1 ) + f (ti− 2 , wi− 2 )
If f = 0, then F (ti, h, wi+1, wi, wi− 1 , wi− 2 ) = 0. X.
b) Function f satisfies a Lipschitz condition with constant L:
|f (t, w 1 ) − f (t, w 2 )| ≤ L|w 1 − w 2 |.
Thus, for the Adams-Bashforth fourth-order method, we have
h 24
∣∣[ 55 f (ti, wi) − 59 f (ti− 1 , wi− 1 ) + 37f (ti− 2 , wi− 2 ) − 9 f (ti− 3 , wi− 3 )]
55 f (ti, vi) − 59 f (ti− 1 , vi− 1 ) + 37f (ti− 2 , vi− 2 ) − 9 f (ti− 3 , vi− 3 )
55 h 24 |f (ti, wi) − f (ti, vi)| + 59 h 24 |f (ti− 1 , wi− 1 ) − f (ti− 1 , vi− 1 )|
37 h 24
|f (ti− 2 , wi− 2 ) − f (ti− 2 , vi− 2 )| + 9 h 24
|f (ti− 3 , wi− 3 ) − f (ti− 3 , vi− 3 )|
≤
55 h 24 L 1 |wi − vi| +
59 h 24 L 2 |wi− 1 − vi− 1 | +
37 h 24 L 3 |wi− 2 − vi− 2 )| +
9 h 24 L 4 |wi− 3 − vi− 3 |.
Let C = max
55 h 24
59 h 24
37 h 24
9 h 24
. Then,
|F (ti, h, wi+1, wi, wi− 1 , wi− 2 , wi− 3 ) − F (ti, h, vi+1, vi, vi− 1 , vi− 2 , vi− 3 )| ≤ C|wi − vi| + C|wi− 1 − vi− 1 | + C|wi− 2 − vi− 2 )| + C|wi− 3 − vi− 3 |
= C
j=
|wi+1−j − vi+1−j |. X
Similarly, for the Adams-Moulton fourth-order method, we have
|F (ti, h, wi+1, wi, wi− 1 , wi− 2 ) − F (ti, h, vi+1, vi, vi− 1 , vi− 2 )|
≤ C
j=
|wi+1−j − vi+1−j |. X
Section 5.10, Problem 4: Consider the differential equation
y′^ = f (t, y), a ≤ t ≤ b, y(a) = α.
a) Show that
y′(ti) = − 3 y(ti) + 4y(ti+1) − y(ti+2) 2 h
h^2 3
y′′′(ξi),
for some ξ, where ti < ξi < ti+2.
d) Analyze the following method
wi+2 = 4wi+1 − 3 wi − 2 hf (ti, wi) (8)
for consistency, stability, and convergence.
Solution: a) We want to show that
y′(ti) −
2 h
− 3 y(ti) + 4y(ti+1) − y(ti+2)
h^2 3 y′′′(ξi). (9)
Expanding y(ti+1) and y(ti+2) in Taylor’s series about ti, we obtain
y′(ti) −
2 h
− 3 y(ti) + 4y(ti+1) − y(ti+2)
= y′(ti) +
2 h
y(ti)
−
2 h
y(ti) + hy′(ti) + h^2 2
y′′(ti) + h^3 6
y′′′(ξi 1 )
2 h
y(ti) + 2hy′(ti) + 4 h^2 2
y′′(ti) + 8 h^3 6
y′′′(ξi 2 )
h^2 3
y′′′(ξi),
where ti < ξi 1 < ti+1, ti < ξi 2 < ti+2, and ti < ξi < ti+2.
d) The method is consistent if the local truncation error τi(h) → 0 as h → 0. The method in (8) has the following truncation error (in formulas below, we again expand y(ti+1) and y(ti+2) in Taylor’s series about ti, similar to part (a) ):
τi+2(h) =
y(ti+2) − 4 y(ti+1) + 3y(ti) h
=
y(ti+2) − 4 y(ti+1) + 3y(ti) h
2 h^2 3 y′′′(ξi),
and since τi+2(h) → 0 as h → 0, the method in (8) is consistent. X
For a multistep method to be stable, it has to satisfy the root condition. A multistep method is said to satisfy the root condition if all roots λi of the characteristic polynomial P (λ) (for a general form of P (λ) see equation (5.57) in the book) are such that |λi| ≤ 1, and if |λi| = 1, then λi is simple. The characteristic polynomial of the following multistep method
wi+2 − 4 wi+1 + 3wi = − 2 hf (ti, wi) (10)