Math 450 Midterm 2 1. Suppose f (0) = 3, f (1) = 1 and f (3) = 9. Using a divided dierence table, nd the Newton form of the degree 2 polynomial P that interpolates f at these points. Solution. The divided dierence table is 0 3 −2 1 1 2 4 3 9 so P (x) = 3 − 2(x − 0) + 2(x − 0)(x − 1) is the Newton form of P . 1 2. Let P (x) = 2 + 3(x − 1) + 4(x − 1)(x − 2) + 5(x − 1)(x − 2)(x − 3). Using either the Newton form given or the nested form of P , write a pseudocode to compute P (4) with a single for loop. Solution. A loop for the Newton form is y = 2, r = 1 for i = 1 : 3 r = r(4 − i) y = y + (i + 2)r end A loop for the nested form is y=5 for i = 3 : 1 y = y(4 − i) + (i + 1) end 2 3. Let f (x) = ex be interpolated1 at points x0 , x1 , x2 , x3 , x4 in [−1, 1]. i) When the xi 's are equally spaced, give an upper bound for |f (x) − P (x)|. e = 640 : notice |f (5) (ξ)| ≤ e and recall An upper bound is |f (x) − P (x)| ≤ e(1/2) 4·5 Q4 5 i=0 |x − xi | ≤ (1/2) 4! where 1/2 is the spacing between nodes. 5 Solution. ii) Do the same as in part i) when the xi 's are Chebyshev nodes. e An upper bound is |f (x) − P (x)| ≤ e25! = 1920 : notice |f (5) (ξ)| ≤ e and recall −4 when xi 's are Chebyshev nodes in [−1, 1]. i=0 |x − xi | ≤ 2 −4 Solution. Q4 1 Recall: when f is interpolated by a degree |f (x) − P (x)| = ≤n polynomial n |f (n+1) (ξ)| Y |x − xi |, (n + 1)! i=0 3 P at distinct points x 0 ≤ x ≤ xn . x0 , x1 , . . . , xn , 4. Show the approximation f 0 (x) ≈ Solution. 1 [f (x 4h + 3h) − f (x − h)] has error O(h). Write 1 f (x + 3h) = f (x) + f 0 (x)(3h) + f 00 (x)(3h)2 + . . . 2 1 f (x − h) = f (x) + f 0 (x)(−h) + f 00 (x)(−h)2 + . . . , 2 subtract and divide by 4h to get f (x + 3h) − f (x − h) = f 0 (x) + f 00 (x)h + . . . = f 0 (x) + f 00 (ξ)h. 4h 4 5. Let P (x) = c0 + c1 x + c2 x2 . Write a linear system corresponding to the equations P (0) = 1, P (1) = 2, P (−1) = 2 and P (2) = 0, and explain why there is no solution for the unknown ci 's. Solution. The linear system is 1 0 0 1 1 1 1 c0 2 1 −1 1 c1 = 2 . c2 1 2 4 0 The rst equation shows c0 = 1, so the second and third equations show that c1 +c2 = 1 = c2 − c1 , so that c1 = 0 and c2 = 1. But then the fourth equation is 0 = c0 + 2c1 + 4c2 = 5, which is false. The linear system is overdetermined: there are 4 independent equations, but only 3 unknowns. 5