Math 5, Fall 7 Practice Exam (Solutions). Using the points f(x), f(x h) and f(x + h) we want to derive an approximation f (x) a f(x) + a f(x h) + a f(x + h). (a) Write the linear system that you must solve to find the coefficients {a k } (do not solve). (b) If the solution to this system is a =, a h =, a h =, write the approximation h formula for f (x). (c) What is the order of accuracy for this approximation (e.g. O(h 8 )) (a) We have coefficients, so we ll write out the first 5 terms in each Taylor series, f(x) = f(x) f(x h) = f(x) hf (x) + h f (x) h f (x) + h f () (x) + O ( h 5) f(x + h) = f(x) + hf (x) + 9h f (x) + 7h f (x) + 8h f () (x) + O ( h 5). Combining these with our a coefficients, we have a f(x) + a f(x h) + a f(x + h) = f(x) [a + a + a ] + hf (x) [ a + a ] + h f (x) [a + 9a ] + h f (x) [ a + 7a ] + h f () (x) [a + 8a ] + O ( h 5). We have coefficients, and we are trying to compute f (x), so to find our coefficients we would solve the equations a + a + a = a a + a = a = a + 9a = 9 a h h (b) With those coefficients, we would plug them into our original approximation formula to obtain f (x) h f(x) + f(x h) + f(x + h). h h
(c) We analyze the left-over terms in our linear combination above: h f (x) [ a + 7a ] + h f () (x) [a + 8a ] + O ( h 5) [ h + 7 ] [ h + h f () (x) h + 8 h = h f (x) = h f (x) + 7h f () (x) + O ( h 5) = O(h). ] + O ( h 5). Let f(x) = x x + x (a) Evaluate f(), f(), f(), f() and f(). (b) Approximate f(x) dx using the composite midpoint rule with subintervals. What is (c) Approximate f(x) dx using the composite trapezoid rule with subintervals. What is (d) Approximate f(x) dx using the composite Simpson s rule with subintervals. What is (a) (b) The true integral is f() = () () + () =, f() = () () + () = + =, f() = () () + () = 8 + =, f() = () () + () = 7 7 + =, f() = () () + () = 8 + 8 =. (x x + x ) dx = ( ) x x + x x = + =. The composite midpoint rule for this integral with two subintervals is f(x) dx = f(x) dx + Hence the relative error is =. f(x) dx f() + f() = ( ) + () =.
(c) The composite trapezoid rule for this integral with two subintervals is f(x) dx+ f(x) dx [f() + f()]+ [f() + f()] = + = Hence the relative error is =. (d) The composite Simpson s rule for this integral with two subintervals is f(x) dx + f(x) dx [f() + f() + f()] + [f() + f() + f()] = [ + ( ) + () + ] = [] = Hence the relative error is =.
. Suppose that you want to approximate the integral dx + x using the composite Midpoint and composite Simpson rules over a uniform partition, = x < x <... < x n =, Imp(f) c and IS c (f). Write formulas for the minimum number of subintervals required for each method to guarantee an error below 8. [i.e. formulas of the form n >... ] We begin by writing down the error formulas for the composite Midpoint and composite Simpson rules (I ll use the version from our lecture notes, since in both cases h = (b a)/n): I(f) I c mp(f) = (b a)mh, M = max f (x), x [a,b] I(f) IS(f) c (b a) Mh =, M = max 88 f (x). x [a,b] In both cases, (b a) = ( ( )) = and h = (b a)/n = /n. So in order to proceed, we must compute both M and M. Let s start by taking the requisite derivatives of our integrand, f(x) = ( + x) : f (x) = ( + x) = ( + x), f (x) = ( + x) = f (x) = ( + x) = ( + x), f (x) = ( + x) 5 = ( + x), ( + x) 5. The absolute value of each of these will be maximized over x [, ] when the denominator is closest to zero, i.e., at x =, hence we have M = max x [,] ( + x) = ( ) =, M = max x [,] ( + x) 5 = ( ) 5 =. Inserting our values for (b a), M and M, and our formula for h, into the composite error formulas, we have I(f) I c mp(f) = ()()( ) n = n, I(f) I c S(f) = ()()( ) 88n = 5n. Our goal is for these to be below 8. Hence for the composite mipoint method, we need ( ) n < 8 / 8 8 < n n >. Similarly, for the composite Simpson method, we need 5n < 8 5 8 < n n > ( ) 8 /. 5
. Consider the quadrature rule f(x) dx ( 5 f ) + ( ) 5 f. (a) What is the degree of precision of this method (b) What is corresponding order of accuracy when this is applied in a composite rule where each subinterval has width h (c) Use this method to approximate the integral x + dx. (a) We compare the quadrature rule against the analytical integrals of the functions f {, x, x, x,... }, until these first disagree: = = = dx x dx x dx = ( ) + 5 5 ) + = ( 5 = ( 5 ) + 5 Hence the degree of precision for the method is. ( ) = 5 + 5 =, ( ) = 5 5 + 5 =, ( ) = 5 + 5 = X. (b) Based on Theorem..8 from our class lecture notes, the composite method based on this approximation will have error O ( h ). (c) In order to apply our approximation method, that is defined for the integration interval [, ], to the requested integral over the interval [, ], we must first use the change of variables, b a f(x) dx = b a f ( b a y + a + b ) dy, to convert the problem to the correct interval. For this problem, we have [a, b] = [, ], so (b a) =, (b a)/ = and (a + b)/ =, so x + dx = f (y + ) dy = We may now apply our approximation formula: y + 8 dy ( ) + ( ) 5 + 8 5 + 8 = 5 + 8 5 = 5. y + + dy = = 5 ( ) + 5 5 y + 8 dy. ( ) 5