Docsity

Numerical Analysis - Homework 11 Solutions | MATH 128A, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Math 128A, Spring 2007
Homework 11 Solution
1. Compute the local truncation error for the 3-Point Adams-Bashforth method.
Solution:
Recall that we obtained AB-3 by finding constants A,B, and Cso that
the approximation
y(tn+1)−y(tn) = Ztn+1
tn
y0(t)dt ≈Ay0(tn) + By0(tn−1) + Cy0(tn−2)
was exact for y0(t) a polynomial of degree ≤2. We can use this to compute
the local truncation error:
If p2(t) is the interpolation of y0(t) at tn,tn−1, and tn−2, then we may
write
y0(t) = p2(t) + e2(t)
and thus
Ztn+1
tn
y0(t)dt =Ay0(tn) + By0(tn−1) + Cy0(tn−2) + Ztn+1
tn
e2(t)dt
Using the Newton form for the error term, namely,
e2(t) = y0[tn−2, tn−1, tn, t](t−tn−2)(t−tn−1)(t−tn)
We can apply the mean value theorem and integrate to get
Ztn+1
tn
e2(t)dt =y0[tn−2, tn−1, tn,¯
ξ]h4
4
and then apply a theorem from class to get
Ztn+1
tn
e2(t)dt =y5(ξ)
4!
h4
4
putting this all together, we have
y(tn+1)−y(tn) = Ay0(tn) + B y0(tn−1) + Cy0(tn−2) + y5(ξ)
4·4! h4
In particular, if y(tk) = ykfor k=n, n −1, n −2, then
y(tn+1)−yn+1 =y5(ξ)
4·4! h4
so we have found the local truncation error.
1
pf3

Partial preview of the text

Download Numerical Analysis - Homework 11 Solutions | MATH 128A and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Math 128A, Spring 2007

Homework 11 Solution

  1. Compute the local truncation error for the 3-Point Adams-Bashforth method. Solution: Recall that we obtained AB-3 by finding constants A, B, and C so that the approximation

y(tn+1) − y(tn) =

∫ (^) tn+

tn

y′(t)dt ≈ Ay′(tn) + By′(tn− 1 ) + Cy′(tn− 2 )

was exact for y′(t) a polynomial of degree ≤ 2. We can use this to compute the local truncation error: If p 2 (t) is the interpolation of y′(t) at tn, tn− 1 , and tn− 2 , then we may write y′(t) = p 2 (t) + e 2 (t) and thus ∫ (^) tn+

tn

y′(t)dt = Ay′(tn) + By′(tn− 1 ) + Cy′(tn− 2 ) +

∫ (^) tn+

tn

e 2 (t)dt

Using the Newton form for the error term, namely,

e 2 (t) = y′[tn− 2 , tn− 1 , tn, t](t − tn− 2 )(t − tn− 1 )(t − tn)

We can apply the mean value theorem and integrate to get ∫ (^) tn+

tn

e 2 (t)dt = y′[tn− 2 , tn− 1 , tn, ξ¯] h^4 4

and then apply a theorem from class to get ∫ (^) tn+

tn

e 2 (t)dt =

y^5 (ξ) 4!

h^4 4

putting this all together, we have

y(tn+1) − y(tn) = Ay′(tn) + By′(tn− 1 ) + Cy′(tn− 2 ) + y^5 (ξ) 4 · 4!

h^4

In particular, if y(tk) = yk for k = n, n − 1 , n − 2, then

y(tn+1) − yn+1 =

y^5 (ξ) 4 · 4!

h^4

so we have found the local truncation error.

  1. Derive the midpoint method and assess its stability.

Solution: Applying the fundamental solution of calculus followed by the midpoint rule approximation,

y(tn+1) − y(tn− 1 ) =

∫ (^) tn+

tn− 1

y′(t)dt ≈ 2 hy′(tn)

which leads to the multistep scheme

yn+1 = yn− 1 + 2hf (tn, yn)

If we specialize this scheme to the ODE y′^ = λy, it becomes

yn+1 = yn− 1 + 2hλyn

This finite difference equation has characteristic polynomial

r^2 − 2 hλr − 1

with roots hλ ±

(hλ)^2 + 1 and hence general solution

yn = C 1 (hλ +

(hλ)^2 + 1)n^ + C 2 (hλ −

(hλ)^2 + 1)n

Since some of the solutions diverge for any hλ 6 = 0, this method is unstable.

  1. Apply Backward Euler with step size h = 0.5 to approximate a solution to y′^ = − 5 y + 6 cos(x) + 4 sin(x) y(0) = 1 on the interval [0, 10]. Solution: We need to solve the update rule

yn+1 = yn + (− 5 yn+1 + 6 cos(tn+1) + 4 sin(tn+1))

for yn + 1, i.e.:

yn+1 =

[yn + 6 cos(tn+1) + 4 sin(tn+1)]