[Fall 2019] Midterm exam_solutions.pdf - MATH 472 Midterm...

This preview shows page 1 out of 6 pages.

Unformatted text preview: MATH 472 Midterm Exam Please ll in: 22 October 2019 Leave blank: Problem Points Out of 1 8 2 10 3 12 4 10 5 10 Total 50 First name Last name uniqname Read the following instructions carefully: • Do not turn this sheet over before the instructor tells you to do so. • Write your name at the top right of each page. • Use a pen (or pencil) with blue or black ink. Do not use red pens. • There are ve problems and you have 80 minutes. one double-sided sheet (8.5 by 11 inches) of notes/formulas in your own handwriting. No other notes or books are allowed. • You may use • You may use a calculator, but all intermediate steps in your calculations must be compre- hensible from your notes. • All results have to be justied by appropriate intermediate steps and/or arguments. You can, however, use standard formulas and results known from the lecture without derivation (unless explicitly stated otherwise). • Scrap papers will be provided. FFF Good luck! FFF Page 1 of 6 Problem 1 (8 Points) Name: (a) (3 Points) Convert the binary number (1101.01)2 to base 10. (b) (5 Points) Find the binary representation of the decimal number 176 . Solution: (a) The integer part is (1101)2 = 23 + 22 + 20 = 13. The fractional part is x = (0.01)2 . Using the shift property, we have (22 − 1)x = (01.)2 = 1. Hence, x = 13 . Therefore (1101.01)2 = 13 + 13 = 403 . (b) Note that 176 = 2 + 56 . The integer part 2 = (10)2 . As for the fractional part 56 , the algorithm discussed in class yields: 5 6 2 2· 3 1 2· 3 2 2· 3 2· .. . 2 3 1 =1+ 3 2 =0+ 3 1 =1+ 3 =1+ Hence, 56 = (0.110)2 . Therefore 176 = (10.110)2 . Page 2 of 6 Problem 2 (10 Points) Name: 1 (a) (4 Points) Show that f (x) = x − 1+x has a root in the interval [0, 1] and apply two steps of the Bisection Method (with initial interval [0, 1]) to nd an approximate root within 1/8 of a true root. (b) (2 Points) For part (a), how many steps of the Bisection Method would you need to perform to ensure that the approximate root is correct within 9 decimal places? (c) (4 Points) Find all xed points of g(x) = x2 − 14 x + 38 and for each xed point, decide whether Fixed-Point Iteration is locally convergent to it. Solution: (a) As f is continuous on [0, 1], f (0) = −1 is negative, and f (1) = 12 is positive, f has a root in the interval [0, 1] by the intermediate value theorem. We apply two steps of the Bisection Method with a0 = 0 and b0 = 1: 0 = 21 and f (c1 ) = 12 − 23 = − 16 < 0. Hence, f has a root in [ 12 , 1] and we set Step 1: c1 = a0 +b 2 1 a1 = c1 = 2 and b1 = b0 = 1. 5 1 Step 2: c2 = a1 +b = 43 and f (c2 ) = 34 − 47 = 28 > 0. Hence, f has a root in [ 21 , 34 ]. 2 The midpoint c3 = 21 ( 12 + 34 ) = 58 of the interval [ 21 , 34 ] therefore lies within 1/8 of a true root of f . 1 < 0.5 × 10−9 . So n > log9 2 ≈ (b) From the denition of 9 decimal places, we require that 2n+1 10 29.897. So we need at least 30 steps. (c) x is a xed point of g(x) if g(x) = x, i.e., x2 − 14 x + 38 = x. Equivalently, 0 = x2 − 54 x + 83 = (x − 12 )(x − 34 ). Thus, x1 = 12 and x2 = 34 are the only xed points of g . We have g 0 (x) = 2x − 14 and thus |g 0 (1/2)| = 3/4 < 1 and |g 0 (3/4)| = 5/4 > 1. Therefore, FPI converges locally to 1/2 by Theorem 1.6, but does not converge locally to 3/4. Page 3 of 6 Problem 3 (12 Points) Name: (a) (3 Points) Let f1 (x) = x3 − 1. Determine for the root r = 1 of f1 whether Newton's method (b) (c) (d) (e) converges locally linearly or quadratically, and determine the rate of convergence. (3 Points) Let f2 (x) = x3 . Determine for the root r = 0 of f2 whether Newton's method converges locally linearly or quadratically, and determine the rate of convergence. (1 Points) If any of the convergence in part (a) or part (b) is not quadratic, suggest a modication of the algorithm so that the convergence becomes quadratic. (3 Points) For part (b), apply two steps of Newton's Method with initial guess x0 = 1. (2 Points) For part (b), prove the convergence of the Newton's method for all initial guess x0 6= 0, that is, prove the linear or quadratic convergence with the rate you obtained in part (b). Solution: (a) We need to determine the multiplicity of the root r = 1. Since f10 (r) = 3r2 = 3 6= 0, r is a simple root. Theorem 1.11, Newton's method converges 00 By f1 (r) 6 = 1. locally quadratically to r with rate M = 2f10 (r) = 2·3 (b) We need to determine the multiplicity of the root r = 0. Since f20 (r) = 3r2 = 0, f200 (r) = 6r = 0, and f2000 (r) = 6 6= 0, the multiplicity of the root r is m = 3. By Theorem 1.12, we conclude that Newton's method converges locally linearly to r = 0 with rate S = m−1 = 32 . m (c) For approximating the point r = 0 in part (b) we suggest the following modication of Newton's method xk+1 := xk − 3f (xk ) . f 0 (xk ) (d) We have f20 (x) = 3x2 . We apply two steps of Newton's Method with initial guess x0 = 1: (x0 ) Step 1: x1 = x0 − ff220 (x = 1 − 31 = 23 . 0) 8 (x1 ) Step 2: x2 = x1 − ff220 (x = 32 − 3·274 = 23 − 29 = 49 . 1) 9 i) (e) Let ei = |xi − r| be the absolute error after step i. In each step i, we have xi+1 = xi − ff220 (x = (xi ) x3i 3x2i = 32 . So limi→∞ ei+1 = 23 , that is, the Newton's ei method converges linearly with rate , for all initial guess x0 6= 0. xi − = 23 xi . Therefore ei+1 ei = |xi+1 −r| |xi −r| 2 3 Page 4 of 6 Problem 4 (10 Points) Let A = Name:   1 1 . 1+δ 1 (a) (5 Points) Find the condition number cond(A) as a function of δ > 0. Remark:   a b The inverse of a matrix B = is B −1 = c d 1 ad−bc   d −b . −c a (b) (5 Points) Find magnication factor (as a function of  the error    δ > 0) for the approximate solution xa = −1 2 to the system Ax = b, where b = . 3+δ 2+δ Solution: (a) By Theorem 2.6, cond(A) = kAk∞ kA−1 k∞ . The inverse of A is given by −1 A 1 = 1 − (1 + δ)    1  1 1 −1 −δ δ = 1 . −(1 + δ) 1 + 1 − 1δ δ As kAk∞ = max(1 + 1, 1 + δ + 1) = 2 + δ and kA−1 k∞ = max( 1δ + 1δ , 1δ + 1 + 1δ ) = 2δ + 1, we obtain cond(A) = (2 + δ)( 2δ + 1) = δ + 4 + 4δ . (b) The exact solution of Ax = b is x = A−1 b = (1, 1)> . The relative forward and backward errors are kx − xa k∞ k(0, −2 − δ)> k∞ = = 2 + δ, kxk∞ k(1, 1)> k∞ k(2, 2 + δ)> − (2 + δ, 2)> k∞ δ kb − Axa k∞ = = . Relative Backward Error = kbk∞ k(2, 2 + δ)> k∞ 2+δ Relative Forward Error = Hence, the error magnication factor for xa is Error Magnication Factor = RelativeForwardError 2+δ 4 = =δ+4+ . RelativeBackwardError δ/(2 + δ) δ Page 5 of 6 Problem 5 (10 Points) Name: (a) (7 Points) Find the matrices L, U , and P in the P A = LU factorization of the matrix 6 −6 −2 8 . A=0 1 12 −4 −4 (b) (3 Points) Let A be a non-singular 1000×1000 matrix. Suppose that your computer needs exactly 1 minute to solve 500 linear systems with the same matrix A (but dierent right-hand side vectors, namely Ax = b(i) , i = 1, . . . , 500) using the LU factorization and back/forward substitution method. Estimate how many seconds the computer was working on the LU factorization alone (without the back/forward substitution part). Solution: (a) We swap the rst and third rows (so that the largest element is on the diagonal), and then 1 ): 2 − 0 1 and 3 − 21 eliminate the rst column ( 12 12 −4 −4 0 0 1 8 −→ 1 6 −6 −2 2 −4 −4 1 8 , −4 0 0 0 1 P = 0 1 0 . 1 0 0 2 ): 3 − (− 14 ) We swap the second and third rows and then eliminate the second column ( 12 1 2 0 12 −4 −4 1 −4 0 −→ 2 1 8 0 −4 0 , 8 −4 −4 − 41 0 0 1 P = 1 0 0 . 0 1 0 Now we can read o the matrices P , L and U : 0 0 1 P = 1 0 0 , 0 1 0 1 , L = 21 1 1 0 −4 1 12 −4 −4 −4 0 . U = 8 (b) For a system of dimension n = 1000, solving k = 500 systems using the LU factorization method needs approximately 32 n3 + 2kn2 operations. The LU factorization alone needs approximately 23 n3 operations. Thus, the fraction of time spent on the LU factorization is approximately 2 3 n 3 2 3 n 3 + 2kn2 = 2 10003 3 2 10003 3 + 2 · 500 · 10002 = 0.4. Thus, the computer was working approximately 0.4·60 = 24 seconds on the LU factorization. Page 6 of 6 ...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture