Numerical Analysis Midterm II: Sample Exam Solutions - MATH 128A (Spring 2008), Exams of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Exam; Professor: Gu; Class: Numerical Analysis; Subject: Mathematics; University: University of California - Berkeley; Term: Spring 2008;

Typology: Exams

2010/2011

Uploaded on 05/23/2011

koofers-user-xf4
koofers-user-xf4 🇺🇸

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Prof. Ming Gu, 861 Evans, tel: 2-3145
http://www.math.berkeley.edu/mgu/MA128A2008S/
Math128A: Numerical Analysis Sample
Midterm II
This is a closed book, closed notes exam. You need to justify every one of your
answers. Completely correct answers given without justification will receive little
credit. Do as much as you can. Partial solutions will get partial credit. Look over
the whole exam to find problems that you can do quickly. You need not simplify your
answers unless you are specifically asked to do so.
Problem Maximum Score Your Score
1 4
2 24
3 24
4 24
5 24
Total 100
1. (10 Points)
Your Name:
Your SID:
Your GSI:
pf3
pf4
pf5
pf8

Partial preview of the text

Download Numerical Analysis Midterm II: Sample Exam Solutions - MATH 128A (Spring 2008) and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Prof. Ming Gu, 861 Evans, tel: 2- Email: [email protected] http://www.math.berkeley.edu/∼mgu/MA128A2008S/

Math128A: Numerical Analysis Sample

Midterm II

This is a closed book, closed notes exam. You need to justify every one of your answers. Completely correct answers given without justification will receive little credit. Do as much as you can. Partial solutions will get partial credit. Look over the whole exam to find problems that you can do quickly. You need not simplify your answers unless you are specifically asked to do so.

Problem Maximum Score Your Score

Total 100

  1. (10 Points)

Your Name:

Your SID:

Your GSI:

Math128A: Numerical Analysis Sample Midterm II 2

  1. Boole’s Rule for numerical integration on the interval [a, b] is given by

I 4 (x) =

2 h 45

(7f (a) + 32f (a + h) + 12f (a + 2h) + 32f (a + 3h) + 7f (b)).

(a) Show that the degree of precision of this formula is 5. (b) Develop the Composite Boole’s Rule for integration on [a, b].

Math128A: Numerical Analysis Sample Midterm II 4

  1. Suppose that L = lim h→ 0 f (h) and L − f (h) = c 6 h^6 + c 9 h^9 + · · ·.

Find a combination of f (h) and f (h/2) that is a much better estimate of L.

Math128A: Numerical Analysis Sample Midterm II 5

  1. Consider the initial value problem y′(t) = f (t, y) = t ∗ y + 1 for t ∈ [0, 1] and y(0) = 1.

(a) Show that f (t, y) satisfies the Lipschitz condition for 0 ≤ t ≤ 1 and −∞ < y < ∞. (b) For h = 0.2, find an approximation to y(h) using the Euler’s method.

(3) f (x) = sin(x)/x. We approximate by natural spline at x = − 1 , 0 , 1. f (−1) = sin(−1)/(−1) = sin(1), f (1) = sin(1)/1 = sin(1). To find f (0) we take the limit limx→ 0 sin(x)/x = cos(0)/1 = 1 by L’Hopital’s rule. So our points are f (−1) = f (1) = sin(1), f (0) = 1. Now we find the natural spline P. We have eight variables: on [− 1 , 0] we have P (x) = a(x + 1)^3 + b(x + 1)^2 + c(x + 1) + d, while on [0, 1] we have P (x) = qx^3 + rx^2 + sx + t. Since the spline must match the value of f at the given points, we have P (−1) = d = sin(1), P (0) = a+b+c+d = t = 1, P (1) = q+r+s+t = sin(1). P ′(x) is 3a(x + 1)^2 + 2b(x + 1) + c on [− 1 , 0] and 3qx^2 + 2rx + s on [0, 1]. For the first derivative to be continuous at 0, we must have 3a + 2b + c = s. P ′′(x) is 6a(x + 1) + 2b on [− 1 , 0] and 6qx + 2r on [0, 1]. For the second derivative to be continuous at 0, we must have 6a + 2b = 2r. Finally, the natural spline condition is that the second derivative should be zero at the endpoints. This gives 2b = 0, 6q + 2r = 0. Putting all this together we have d = sin(1), t = 1, b = 0 a + c = 1 − sin(1) q + r + s = sin(1) − 1, so a + c + q + r + s = 0. 3 a + c = s 6 a = 2r, a = r/ 3 6 q + 2r = 0, so q = −r/3. Then s = r + c, r/3 + c − r/3 + r + r + c = 0 = 2c + 2r, and c = −r, implying s = 0. We then have r/ 3 − r = − 2 r/3 = 1 − sin(1), for r = −^32 (1 − sin(1)). So we can write down P as follows: P (x) = −^12 (1 − sin(1))(x + 1)^3 + 32 (1 − sin(1))(x + 1) + sin(1) on [− 1 , 0] and P (x) = 12 (1 − sin(1))x^3 − 32 (1 − sin(1))x^2 + 1 on [0, 1]. (4) L = limh→ 0 f (h) and L − f (h) = c 6 h^6 + c 9 h^9 + ... We consider L−f (h/2). This is c 6 (h/2)^6 +c 9 (h/2)^9. .. = c 6 h^6 /64+c 9 h^9 /512. To cancel the lowest order term, we compute (L − f (h)) − 64(L − f (h/2)) = c 9 h^9 − (c 9 /8)h^9. Then − 63 L − f (h) + 64f (h/2) = (7/8)c 9 h^9. Solving for L we find L = (64f (h/2) − f (h) − (7/8)c 9 h^9 )/63, so L − (^6463 f (h/2) − 631 f (h)) = − 721 c 9 h^9. This is order h^9 instead of h^6 , and so is more accurate than the original estimate. (5) We have f (0) = 0, f (0.1) = 0.01, f (0.2) = 0.04.

A second-order method must give the exact solution on quadratic polyno- mials. Therefore the second-order approximation to the derivative of f using these three points must be equal to the derivative of the quadratic passing through these points. We compute this quadratic with Lagrange polynomials: P (x) = 0L 0 +

  1. 01 L 1 + 0. 04 L 2 = 0. (^01) (0. 1 x−(0)(0x−^0 .. 1 2)− 0 .2) + 0. (^04) (0. 2 −x(0)(0x−^0. 2 .1)− 0 .1).

This is P = − 0. 01 x

(^2) − 0. 2 x

  1. 01 + 0.^04

x^2 − 0. 1 x

  1. 02 , which is equal to^ −(x

(^2) − 0. 2 x) +

2(x^2 − 0. 1 x) = x^2. So our second-order approximation to f ′(x) at x = 0 is the derivative of x^2 at 0, which is 0.