Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Final Exam Solutions - Numerical Analysis | Math 105, Exams of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Exam; Class: NUMERICAL ANALYSIS; Subject: Mathematics; University: University of California - Irvine; Term: Summer Session I 2003;

Typology: Exams

Pre 2010

Uploaded on 09/17/2009

koofers-user-oz4
koofers-user-oz4 🇺🇸

5

(1)

10 documents

1 / 10

Toggle sidebar

Related documents


Partial preview of the text

Download Practice Final Exam Solutions - Numerical Analysis | Math 105 and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity! Jim Lambers Math 105A Summer Session I 2003-04 Practice Final Exam Solution 1. Use the Newton divided-difference formula to compute the cubic interpolating polynomial p3(x) for the function f(x) = ex, using interpolation points x0 = 0, x1 = 1, x2 = 2, and x3 = 3. What is an upper bound for the error |p3(0.5)− f(0.5)|? Solution The divided-difference table for the given data is i xi f [xi] 0 0 1 1.718282 1 1 2.718282 1.476246 4.670774 0.8455357 2 2 7.389056 4.012853 12.69648 3 3 20.08554 It follows that p3(x) = 1 + 1.718282x+ 1.476246x(x− 1) + 0.8455357x(x− 1)(x− 2). The error in this polynomial is f(x)− p3(x) = eξ 4! x(x− 1)(x− 2)(x− 3), since f (4)(x) = ex. It follows that |p3(0.5)− f(0.5)| = ∣∣∣∣eξ4! (0.5)(0.5− 1)(0.5− 2)(0.5− 3) ∣∣∣∣ = ∣∣∣∣ eξ24 1516 ∣∣∣∣ ≤ ∣∣∣∣ e324 1516 ∣∣∣∣ ≤ 0.7845913, since the maximum of eξ on [0, 3] occurs at ξ = 3. 1 2. Find the Hermite interpolating polynomial for the following data. i xi f(xi) f ′(xi) 0 −1 0 1 1 0 1 0 2 1 4 −1 Solution We define z0 = x0, z1 = x0, z2 = x1, z3 = x1, z4 = x2, z5 = x2. The divided-difference table for the given data is i zi f [zi] 0 −1 0 1 1 −1 0 0 1 −1 2 0 1 −1 1.5 0 2 −3 3 0 1 3 −4.5 3 −7 4 1 4 −4 −1 5 1 4 It follows that the Hermite interpolating polynomial is H5(x) = (x+ 1)− (x+ 1)2x+ 1.5(x+ 1)2x2 − 3(x+ 1)2x2(x− 1). 3. Find the cubic spline interpolant s(x) for the data i xi f(xi) 0 1 −1 1 3 3 2 5 0 that satisfies free, or natural, boundary conditions. Solution The spline s(x) is a piecewise polynomial consisting of the two pieces s0(x) = a0 + b0(x− 1) + c0(x− 1)2 + d0(x− 1)3, s1(x) = a1 + b1(x− 3) + c1(x− 3)2 + d1(x− 3)3. 2 From Taylor’s Theorem, f(x0 − h) = f(x0)− f ′(x0)h+ f ′′(x0) 2 h2 − f ′′′(ξ1) 6 h3, f(x0 + 2h) = f(x0) + f ′(x0)2h+ f ′′(x0) 2 4h2 + f ′′′(ξ2) 6 8h3, where ξ1 ∈ [x0 − h, x0] and ξ2 ∈ [x0, x0 + 2h]. Substituting these Taylor expansions into the differentiation rule yields −4f(x0 − h) + 3f(x0) + f(x0 + 2h) 6h = − 2 3h [ f(x0)− f ′(x0)h+ f ′′(x0) 2 h2 − f ′′′(ξ1) 6 h3 ] + 1 2h f(x0) + 1 6h [ f(x0) + f ′(x0)2h+ f ′′(x0) 2 4h2 + f ′′′(ξ2) 6 8h3 ] = f ′(x0)− 2 3h [ f ′′(x0) 2 h2 − f ′′′(ξ1) 6 h3 ] + 1 6h [ f ′′(x0) 2 4h2 + f ′′′(ξ2) 6 8h3 ] = f ′(x0) +O(h2), since the terms of O(h) cancel. 5. Use Romberg integration to compute an approximation to∫ 1 −1 ex cos 2x dx that is sixth-order accurate. Solution We begin by using the Trapezoidal Rule, or, equivalently, the Composite Trape- zoidal Rule∫ b a f(x) dx ≈ h 2 f(a) + n−1∑ j=1 f(xj) + f(b)  , h = b− a n , xj = a+ jh, with n = 1 subintervals. Since h = (b− a)/n = (1− (−1))/1 = 2, we have R1,1 = 2 2 [f(−1) + f(1)] = −1.28429624943104. 5 Next, we apply the Composite Trapezoidal Rule with n = 2 and h = (1− (−1))/2 = 1, which yields R2,1 = 1 2 [f(−1) + 2f(0) + f(1)] = 0.35785187528448. Now, we can use Richardson Extrapolation to obtain a more accurate approximation, R2,2 = R2,1 + R2,1 −R1,1 3 = 0.90523458352299, Because the error in the Composite Trapezoidal Rule satisfies ∫ b a f(x) dx = h 2 f(a) + n−1∑ j=1 f(xj) + f(b) +K1h2 +K2h4 +K3h6 +O(h8), where the constants K1, K2 and K3 depend on the derivatives of f(x) on [a, b] and are independent of h, we can conclude that R2,1 has fourth-order accuracy. We can obtain a second approximation of fourth-order accuracy by using the Composite Trapezoidal Rule with n = 4 to obtain a third approximation of second-order accuracy. We set h = (1− (−1))/4 = 1/2, and then compute R3,1 = 0.5 2 [f(−1) + 2[f(−0.5) + f(0) + f(0.5)] + f(1)] = 0.78818484680003. Now, we can apply Richardson Extrapolation to R2,1 and R3,1 to obtain R3,2 = R3,1 + R3,1 −R2,1 3 = 0.93162917063855. It follows from the error term in the Composite Trapezoidal Rule, and the formula for Richard- son Extrapolation, that R2,2 = ∫ 1 0 e−x 2 dx+ K̃2h4 +O(h6), R2,2 = ∫ 1 0 e−x 2 dx+ K̃2 ( h 2 )4 +O(h6). Therefore, we can use Richardson Extrapolation with these two approximations to obtain a new approximation R3,3 = R3,2 + R3,2 −R2,2 24 − 1 = 0.93338880977959. Because R3,3 is a linear combination of R3,2 and R2,2 in which the terms of order h4 cancel, we can conclude that R3,3 is of sixth-order accuracy. 6 6. Use Gaussian Quadrature with n = 3 to evaluate the integral∫ 1 0 sin3 x dx. What is the degree of this quadrature rule? Solution The particular Gaussian quadrature rule that we will use consists of 3 nodes x1, x2 and x3, and 3 weights w1, w2 and w3. To determine the proper nodes and weights, we use the fact that the nodes and weights of a 3-point Gaussian rule for integrating over the interval [−1, 1] are given by i Nodes r3,i Weights c3,i 1 0.7745966692 0.5555555556 2 0.0000000000 0.8888888889 3 −0.7745966692 0.5555555556 To obtain the corresponding nodes and weights for integrating over [−1, 1], we can use the fact that in general, ∫ b a f(x) dx = ∫ 1 −1 f ( b− a 2 t+ a+ b 2 ) b− a 2 dt, as can be shown using the change of variable x = [(b− a)/2]t+ (a+ b)/2 that maps [a, b] into [−1, 1]. We then have∫ b a f(x) dx = ∫ 1 −1 f ( b− a 2 t+ a+ b 2 ) b− a 2 dt ≈ 5∑ i=1 f ( b− a 2 r3,i + a+ b 2 ) b− a 2 c3,i ≈ 5∑ i=1 f(xi)wi, where xi = b− a 2 r3,i + a+ b 2 , wi = b− a 2 c3,i, i = 1, . . . , 5. In this example, a = 0 and b = 1, so the nodes and weights for a 3-point Gaussian quadrature rule for integrating over [0, 1] are given by xi = 1 2 r3,i + 1 2 , wi = 1 2 c3,i, i = 1, . . . , 3, which yields 7
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved