Introduction Derivation Examples Summary Test TRAPEZIUM RULE NUMERICAL METHODS 3 INU0114/514 (M ATHS 1) Dr Adrian Jannetta MIMA CMath FRAS Trapezium Rule 1 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Background of complex shapes. Kepler used the equivalent of a method later called Simpson’s Rule to calculate the volume of wine barrels. Mathematicians now use definite integration to calculate quantities such as distance, area, volume, mass, electric charge and others. You will have already seen that the definite integral Z b f (x) dx a Johannes Kepler (1571 — 1630) Several mathematicians, including Johannes Kepler, discovered approximate methods for calculating areas and volumes Trapezium Rule can found by doing indefinite integration and then substituting the limits. But in some cases this is not possible. Methods of numerical (or approximate) integration exist and don’t rely rely on indefinite integration to find the value of the integral. 2 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Numerical Integration Definite integrals of the form Z b f (x) dx a represent the area beneath the curve by y = f (x) on a graph. Numerical integration is useful when: • We can’t find the indefinite integral of f (x). • We have data in the form of samples or measurements (e.g. of electric current at a given time points). Numerical methods divide the region under the curve into regular regions whose area can be calculated and summed. • Trapezium rule (partitions the region using trapezoids). • Simpson’s rule (replaces sections of the curve with quadratic curves). In this presentation we will examine the Trapezium rule. Simpson’s Rule will come next time! Trapezium Rule 3 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test The Trapezium Rule A trapezium is a four sided polygon with two parallel sides. q p The area of a trapezium is equal to h2 (p + q). h Consider the function y = f (x). We want to find the area beneath the curve which is bounded by the lines x = a, x = b and the x-axis. y y4 y2 y = f (x) y3 y1 y0 h x0 a x1 x2 x3 x4 x b We can approximate the area beneath the curve by covering it with trapezia of width h as shown above. The x-values are regularly spaced across the interval. The y-values (called ordinates) can be calculated using y = f (x). Trapezium Rule 4 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test y y2 y4 y = f (x) y3 y1 y0 h x0 a x1 x2 x3 x4 x b In the picture the total area beneath the curve is being approximated by the combined area of four trapezia. Area = h h h h (y0 + y1 ) + (y1 + y2 ) + (y2 + y3 ) + (y3 + y4 ) 2 2 2 2 Factorise and collect the like-terms together: Area = Z Area = h (y0 + y1 + y1 + y2 + y2 + y3 + y3 + y4 ) 2 f (x) dx = h (y0 + 2y1 + 2y2 + 2y3 + y4 ) 2 b a Using more strips should approximate the area much more closely. Trapezium Rule 5 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test The general case of dividing the interval into n strips of width h leads to the following expression for the approximate area beneath the curve: Z f (x) dx = 21 (y0 + y1 )h + 12 (y1 + y2 )h + . . . + 21 (yn−2 + yn−1 )h + 12 (yn−1 + yn )h which can be factorised and simplified to give Z b h f (x) dx = (y0 + 2y1 + . . . + 2yn−1 + yn ) 2 a Or more compactly Z b f (x) dx = a h y0 + 2(y1 + . . . + yn−1 ) + yn 2 ,h= b−a n This is the trapezium rule. An easier version of this formula to remember is: Z b f (x) dx = a h F + L + 2(everything else) 2 ,h= b−a n where ‘F’ and ‘L’ are first the first ordinates. Trapezium Rule 6 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Area under a curve Trapezium Rule Use the trapezium rule with 4 strips to calculate the area beneath the curve y = x2 bounded by the lines x = 1, x = 4 and the x-axis. In this case we have a = 1, b = 4 and n = 4. The strip width is h = 4−1 4 = 3 4 Construct a table of values to calculate the values of y: Z x 1 1.75 2.5 3.25 4 y 1 3.0625 6.25 10.5625 16 4 x2 dx 1 ≈ ≈ Z ≈ 4 x2 dx 1 ≈ 3 4 2 3 8 3 8 F + L + 2(everything else) [1 + 16 + 2(3.0625 + 6.25 + 10.5625)] × 56.75 21.28125 So the area beneath the curve is 21.28 units2 (to 2 decimal places). Trapezium Rule 7 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Area under a curve In the previous example we can compare the exact answer to to the Trapezium rule estimate by evaluating the definite integral Z 4 x2 dx = 1 x3 3 4 = 21 1 y The trapezium rule produced a slight overestimate of the actual area. y = x2 8 6 This could have been anticipated. Consider the shape of the curve and the shape of the trapezia on a graph. 4 2 The dashed line is the straight edge at the top of the trapezium; you can see that area of each trapezium is slightly greater than the area under the curve. Trapezium Rule x 1 8 / 13 2 3 Adrian Jannetta Introduction Derivation Examples Summary Test Area under a curve Trapezium Rule p Use the trapezium rule with 4 ordinates to calculate the area beneath the curve y = sin θ bounded by the axis and the lines θ = 0 and θ = π/2. Give your answer to four decimal places. The use of 4 ordinates means using 3 strips. We have a = 0 and b = π/2 and h = π/2−0 3 Construct a table of values using y = Z p 0 π 6 π 3 π 2 y 0 0.70711 0.93060 1 sin θ dθ ≈ ≈ π/2 0 p sin θ 0 ≈ Z π 6. θ π/2 p = sin θ dθ ≈ h F + L + 2(everything else) 2 π 12 π 12 [0 + 2(0.70711 + 0.93060) + 1] × 4.27542 1.11930 The estimated area is 1.1193 units2 . Trapezium Rule 9 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Area under a curve Is the answer we obtained an underestimate or overestimate of the true area? We can answer this by examining the graph of the function. y 1 y= π 6 π 3 π 2 p sin θ θ The curve is convex to the trapezia; the trapezia have an area less than the area beneath the curve, so the method gave a slight underestimate of the true answer. As always, a more accurate answer could be obtained by using more strips. Trapezium Rule 10 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Using data points Numerical integration methods can be used with data points or measurements — useful when the underlying function is not known. Trapezium rule with data points Calculate the value of the integral t 0 5 10 15 20 Z 50 v dt from the following data: 0 25 30 35 40 45 50 v 5.3 17.6 32.4 44.8 59.1 71.9 86.1 99.7 112.5 126.6 140.1 In this case the measurements can simply be substituted into the Trapezium rule formula. Clearly the interval width is h = 5. Z 50 h F + L + 2(everything else) v dt ≈ 2 0 ≈ Z Trapezium Rule ≈ 50 v dt 0 ≈ 5 2 5 2 [5.3 + 2(17.6 + 32.4 + . . . + 126.5) + 140.1] × [145.4 + 2 (650.7)] 3617 11 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Summary The trapezium rule is a method for calculating the approximate value of definite integrals. This might be essential when: • The integration is too difficult or impossible to carry out. • The function is only specified in the form of data points. In either case the formula for evaluating the integral is: Z b f (x) dx = a h y0 + 2(y1 + . . . + yn−1 ) + yn 2 ...or this easier to remember version: Zb h F + L + 2(everything else) f (x) dx = 2 a where h = b−a . n The trapezium rule estimate can always be improved by using more strips (so larger n or smaller h). Trapezium Rule 12 / 13 Adrian Jannetta Introduction Derivation Examples Summary Test Test yourself... You should be able to solve the following problems using the trapezium rule if you have understood these notes. 1 2 3 Use h = 0.5 to evaluate Z 3 (x2 + 1) dx 1 Find the exact value of the integral and hence find the percentage error in the estimate in (1). Z − π2 cos x dx to 4 decimal places. Use four strips to evaluate π 2 4 Does the value you found in (3) under or over estimate the true value? Answers: 43 1 10.75 (or 4 ) 25 32 2 Exact value (using integration) is 3 . Percentage error is 32 % (≈ 0.78%) 3 1.8961 (to 4 decimal places) 4 It’s an underestimate; sketch the graph of cos x and the trapezia to verify this. Trapezium Rule 13 / 13 Adrian Jannetta
© Copyright 2026 Paperzz