Section 5.7 Numerical Integration Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: a Trapezoidal Rule: b Approximation by constant functions (zero degree polynomials) a b Approximation by linear functions (1st degree polynomials) Simpson’s Rule: a b Approximation by parabolas (2nd degree polynomials) Riemann Sum: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n n f ( x ) x i 1 i x f ( x0 ) f ( x1 ) f ( x2 ) ......... f ( xn1 ) f ( xn ) Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n n 1 f ( xi1 ) f ( xi ) x i 1 2 Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n n 1 f ( xi1 ) f ( xi ) x i 1 2 x f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( x2 ) ......... f ( xn1 ) f ( xn1 ) f ( xn ) 2 Trapezoidal Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n n 1 f ( xi1 ) f ( xi ) x i 1 2 x f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( x2 ) ......... f ( xn1 ) f ( xn1 ) f ( xn ) 2 x f ( x0 ) 2 f ( x1 ) 2 f ( x2 ) ......... 2 f ( xn1 ) f ( xn ) 2 Ex. 1: Use the trapezoidal rule to approximate the definite integral 3 0 x3 dx with n = 6. Simpson’s Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n x f ( x0 ) 4 f ( x1 ) 2 f ( x2 ) 4 f ( x3 ) 2 f ( x4 ) .......... 4 f ( xn1 ) f ( xn ) 3 Simpson’s Rule: For a regular partition of an interval [a, b] with n subintervals, each of b ba width x , the definite integral f ( x) dx is approximated by: a n x f ( x0 ) 4 f ( x1 ) 2 f ( x2 ) 4 f ( x3 ) 2 f ( x4 ) .......... 4 f ( xn1 ) f ( xn ) 3 Note: n must be an even integer. Ex. 2: Use Simpson’s Rule to approximate the definite integral 51 3 x dx with n = 6. Comparing the trapezoidal rule and Simpson’s rule: Note that the formulas are very similar in construction and differ mainly in the coefficients used in the summation: b a b a f ( x)dx x f x0 2 f x1 2 f x2 2 f x3 2 f x4 ... 2 f xn1 f xn 2 f ( x)dx x f x0 4 f x1 2 f x2 4 f x3 2 f x4 ... 4 f xn1 f xn 3 Simpson’s Rule is usually much more accurate. Your calculator’s fnInt feature uses a method known as Gaussian Quadrature that is more accurate and dependable than either the Trapezoidal Rule or Simpson’s Rule for problems where the function to be integrated is known. Ex. 3: Use the trapezoidal rule to approximate the definite integral of the function y = f(x) over the interval [2, 5] when the function values are as given in the table. x 2.0 2.75 3.5 4.25 5.0 y 15.2 17.1 18.6 19.2 20.4 Ex. 4: A town wants to drain and fill a small polluted swamp. The swamp averages 5 ft. deep. About how many cubic yards of dirt will it take to fill the area after the swamp is drained? (Use Simpson’s Rule.) Note that the restriction for Simpson’s Rule that requires an even number of subintervals is equivalent to requiring an odd number of measurements of the function. Ex. 4: The swamp averages 5 ft. deep. Question: Use the Trapezoidal Rule and Simpson’s Rule to 3 1 dx using n = 8. estimate 1 x Solution: Trapezoidal Rule: 2 8 1 2 1 1 1 1 1 1 1 1 2 2 2 2 2 2 1.25 1.5 1.75 2 2.25 2.5 2.75 3 2 1 ≈ 1.103210678 Simpson’s Rule: 2 8 1 4 3 1 1 1 1 1 1 1 1 1 2 4 2 4 2 4 1.25 1.5 1.75 2 2.25 2.5 2.75 3 ≈ 1.098725349 The actual answer is ln 3 ≈ 1.098612289, so Simpson’s Rule was far more accurate.