Download Final Exam Solutions - Numerical Analysis | MATH 128A and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity! UCB MATH 128A-2, SUMMER 2009: FINAL EXAM SOLUTIONS JUSTIN BLANCHARD 1. (a) Prove that the bisection method on [1, 2] will converge to a root of x3 − x− 1. (b) Find a bound on the absolute error in approximating this root after n iterations. (c) How many iterations are necessary to ensure the relative error is at most 2−5? (Your answer does not have to be exact.) Solution: (a) This function is continuous. Its values at the endpoints are −1 < 0 and 5 > 0. Therefore, the interval brackets a root and the bisection method will converge. (b) On the nth iteration, the root is known to lie in an interval of width 2−12n−1 . Its distance from this interval’s midpoint can be at most 1/2n . (The answer 1/2n+1 is also acceptable, depending on how the phrase “after n iterations” is interpreted.) (c) Since the root lies in [1, 2], the relative error is at most equal to the absolute error. By (b), we must use n = 5 iterations. 2. (a) Find an algebraic expression for the unique root (in R) of f(x) = x2 − 2/x. (b) Newton’s method searches for this root using the iteration pn+1 = g(pn). Find g(x). Simplify your answer. (c) Is the convergence linear? Is it at least quadratic? (d) Find the exact order of convergence. Solution: (a) x2 − 2/x = 0 ⇐⇒ x3 − 2 = 0 ⇐⇒ x = 21/3 . (b) g(x) = x− f(x)f ′(x) = x− x2−2/x 2x+2/x2 = x− x x3−2 2x3+2 = x(x3 + 4) 2(x3 + 1) (c) The convergence is at least quadratic, for either of the following reasons: 21/3 is a simple root of f(x), as f ′(21/3) = 2 · 21/3 + 2/22/3 6= 0. Alternatively, g′(21/3) = 0 after the calculation g′(x) = (4x 3+4)2(x3+1)−x(x3+4)(6x2) 22(x3+1)2 = 8(x3+1)2−6x3(x3+4) 22(x3+1)2 . (d) (This was intended to be a harder problem.) By definition, the order of convergence is α iff limn→∞ ∣∣∣pn+1−21/3pn−21/3 ∣∣∣ = λ 6= 0. If pn = x, this fraction’s numerator is g(x) − 21/3 = x 4−24/3x3+4x−2 2(x3+1) . Factor out (x − 2 1/3) as many times as possible: (x−2 1/3)3(x+21/3) 2(x3+1) . (Alternatively, Taylor-expand x 4 − 24/3x3 + 4x − 2 with center x = 21/3.) It follows that the order of convergence is 3 3. (a) Estimate y(1/2) with polynomial interpolation given the data y(0) = 1, y(1) = 2. (b) Repeat part (a) with Hermite interpolation, if y(t) is a solution to y′ = y. Solution: (a) Polynomial interpolation in this case is linear interpolation, so y(0.5) ≈ 1.5 (b) Hermite interpolation, Newton form: Date: Thursday 8/13. 1 x0 = 0 f [x0] = 1 f [x0, x1] = 1 x1 = 0 f [x1] = 1 f [x0, x1, x2] = 0 f [x1, x2] = 1 f [x0, x1, x2, x3] = 1 x2 = 1 f [x2] = 2 f [x0, x1, x2] = 1 f [x2, x3] = 2 x3 = 1 f [x3] = 2 Using the co- efficients above, we can read off the polynomial P (x) = 1+1(x−0)+0(x−0)2+1(x−0)2(x−1) = 1 + x− x2 + x3. Plugging in x = 0.5 yields 1.375 4. (a) Transform ∫ 3 −3 1 t2+1 dt to an integral of the form ∫ 1 −1 f(x) dx. (b) Find the coefficients below for the three-point Gaussian quadrature rule:∫ 1 −1 f(x) dx ≈ af ( − √ 3 5 ) + bf(0) + cf ( + √ 3 5 ) . (c) What is this rule’s degree of precision? (d) Estimate the integral from (a) using this rule. Express your answer as a fraction. Solution: (a) Let t = 3x to get ∫ 1 −1 3 9x2 + 1 dx (b) Method one: f(x) = x0 : ∫ 1 −1 x0 dx = 2 1 = +a ( 3 5 )0/2 + b+ c ( 3 5 )0/2 =⇒ a+ b+ c = 2 f(x) = x1 : ∫ 1 −1 x1 dx =0 = −a ( 3 5 )1/2 + c ( 3 5 )1/2 =⇒ a = c f(x) = x2 : ∫ 1 −1 x2 dx = 2 3 = +a ( 3 5 )2/2 + c ( 3 5 )2/2 =⇒ a = c = 5 9 =⇒ b = 8 9 Method two: Integrate Lagrange polynomials: for instance, a = ∫ 1 −1 (x−0)(x− √ 3/5) (− √ 3/5−0)(− √ 3/5− √ 3/5) dx, etc. (This strategy leads to a mess, and will not be elaborated here.) (c) Method one: It’s 5 because Gaussian quadrature achieves degree of precision 2(# nodes)− 1. Method two: Continue the tests above. The first one that fails is f(x) = x6, so the degree is 5. (d) 59 3 9(3/5)+1 + 8 9 (3) + 5 9 3 9(3/5)+1 = 2·5·3 9·32/5 + 8·3 9 = 25 3·16 + 8 3 = 153 48 = 51 16 . 5. (a) Find the local truncation error for the method wi+1 = 4wi − 3wi−1 − 2hf(ti−1, wi−1). (b) Classify this multistep method as strongly stable, weakly stable, or unstable. Solution: (a) Note: This may be clearer if written out, long-hand. Let y(t) = ∑ cn(t− ti)n. Then y′(t) = ∑ ncn(t− ti)n−1, and τi+1 = y(ti + h)− wi+1 h = −4c0h−1 + ∑ cn[1 + 3(−1)n + 2n(−1)n−1]hn−1 = 0 + 0 + 0 + 4c3h2 + . . . Thus, the local truncation error is O(h2) (b) The characteristic polynomial for this method is λ2 − 4λ + 3 = (λ − 3)(λ − 1). Since |3| > 1, the method is unstable.