AREAMEAS Computing the area of a complicated region -- An Integration Lab BRIEF ABSTRACT This lab is devoted to measuring the area of a region using several techniques (both numerical and analytical) and then to contrasting the results. GENERAL INFORMATION FileName: AREAMEAS Full title: Computing the area of a complicated region -- An Integration Lab Last Update: 6/3/96 Developers: Dave Horn, Rogers High School, 8466 W. Pahs Road, Michigan City IN 46360 USA. Aaron Klebanoff, Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute IN 47803 USA. Contact: Aaron Klebanoff, Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute IN 47803 USA. Phone: 812-877-8151. Email: Aaron.Klebanoff@rose-hulman.edu. FAX: 812-877-3198. Support: The production of this material is supported by the National Science Foundation under Division of Undergraduate Education grant DUE-9352849: Development Site for Complex, Technology-Based Problems in Calculus with Applications in Science and Engineering and the Arvin Foundation of Columbus IN. STATEMENT OF PROBLEM Below is the graph of an irregularly shaped closed region drawn to scale. Functions that generate the boundary of the region. In[2]:= ftop[x_] = Which[ x <= 4, Sqrt[x] + 10, 4 < x <= 6, 12 - 2 Sin[Pi x], 6 < x <= 8, 21 - x^2/4, 8 < x <= 10, -2.5 x + 25]; In[3]:= fbot[x_] = .1 (x - 10)^2; The Region In[4]:= Plot[{ftop[x], fbot[x]}, {x, 0, 10}, PlotRange -> {0, 15}, AspectRatio -> Automatic, GridLines -> {Table[i, {i, 0, 10}], Table[i, {i, 0, 15}]}] Out[4]= -Graphics- 1. Make a very quick - almost instantaneous reaction - estimate of its area. 2. Take a moment, no more than 1 minute, to assess the precision of your answer to Problem 1. Was you initial estimate good or bad. Why? Can you improve your estimate? Why do you feel your second estimate is an improvement? 3. Make a table of values for the vertical distance between the top and bottom of the region at x = 0, 1, 2, . . . ,10. Estimate as necessary. 4. Compare Numerical Integration Techniques. a) Explain why the midpoint rule is inappropriate to use in this problem. b) Use your data from Problem 3 and the trapezoid rule to estimate the area of the region. c) Use your data from Problem 3 and Simpson's rule to estimate the area of the region. 5. Expand the table from problem 3 to account for vertical distances at x = 0, .5, 1, 1.5, . . . , 9.5, 10. 6. Repeat Problem 4 with the expanded table from Problem 5. 7. Compare your answers from Problem 2, Problem 4 and Problem 6 and discuss your results. In which estimate(s) do you have the most faith? Why? 8. The region we are studying has been determined by 5 functions, each defined over a different domain. Ask your teacher for the functions, and then compute the exact area using definite integrals. 9. Make a table listing the percent error in each of the estimates made: (in Problem 1, Problem 2, Problem 4 and Problem 6. % relative error = ((approx value - exact value)/exact value) x 100%. This is a signed error. If the error is positive, then the approximation is too big, and if the error is negative, the approximation is too small. 10. Evaluate this exercise. Did you like it? Why or why not? How could it be improved? Why do you think the actual functions were withheld until Problem 8? KEYWORDS Area, summation, approximation, integration, midpoint rule, trapezoid rule, Simpson's Rule. TEACHER NOTES ISSUES RELATED TO THE PROBLEM Students are to find the area of an irregular closed region using the numerical techniques of integration. Then they are provided with the functions that determine the regions and are expected to check their answers by integrating. Prerequisites Notion of area, approximation, computing area with definite integrals. Students should have been introduced to numerical techniques of integration soon before this lab. Time allotment - time management This project involves quite a bit of computation. If you are concerned your students might not understand the numerical integration techniques, have them do the first few parts of Problem 4 and Problem 6 by hand. Once they get the idea, bring whatever technology you have into play. This lab could be started in class, but there is too much for the students to complete in a single sitting. Expectations This is intended to be a small group project, probably done in pairs. Future payoffs Extensions You could also estimate the area with Simpson's Rule If you have sensitive scales available, another interesting and quite different way to approximate the area is to: 1. Cut out the entire grid and weigh it. 2. Compute g/unit^2 mass density for the whole grid. 3. Carefully, cut out the region and weigh it. 4. Use the results from 2 and 3 to approximate the area. If you try this, it might work better if you can get the region copied onto heavy paper or poster board. References and Sources POSSIBLE SOLUTION(S) Solution for Problem 1 Answers will vary, but it should certainly be less than 10*14 = 140. In[5]:= AreaGuess1 = 90; Solution for Problem 2 It appears that around half of the grid, probably a little less, is enclosed. Since the entire grid has an area of 10 * 14, expect answers of 70 or less. In[6]:= AreaGuess2 = 70; Solution for Problem 3 It's worth noting that the students heights will not be exact, so the following solution should generally give slightly better answers than theirs. In[7]:= dx = 1; height[x_] = ftop[x]-fbot[x]; TableForm[Table[{i,height[i]},{i,0,10,dx}]//N] Out[9]//TableForm= 0 0. 1. 2.9 2. 5.01421 3. 6.83205 4. 8.4 5. 9.5 6. 10.4 7. 7.85 8. 4.6 9. 2.4 10. 0. Solution for Problem 4 First, the students should recognize that since we only know the function values at the end points of each sub-interval, in order to apply the midpoint, we can only use half of our data and 5 sub-intervals rather than 10. In[10]:= Clear[y, i] In[11]:= dx = 1; n = 10; y[i_] = height[i]; In[14]:= TrapRule10 = N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])] Out[14]= 57.8963 In[15]:= SimpRule10 = N[(dx/3) (4 Sum[y[2 i - 1], {i, 1, n/2}] + 2 Sum[y[2 i], {i, 1, n/2 - 1}])] Out[15]= 58.2522 Solution for Problem 5 The following Mathematica code produces the differences between the curves for x = 0 to x = 10 in steps of Dx = 0.5. These heights will be used as the bases of the trapezoids in Problem 6. In[16]:= dx = 0.5; In[17]:= TableForm[Table[{i,height[i]},{i,0,10,dx}]//N] Out[17]//TableForm= 0 0. 0.5 1.68211 1. 2.9 1.5 3.99974 2. 5.01421 2.5 5.95614 3. 6.83205 3.5 7.64583 4. 8.4 4.5 6.975 5. 9.5 5.5 11.975 6. 10.4 6.5 9.2125 7. 7.85 7.5 6.3125 8. 4.6 8.5 3.525 9. 2.4 9.5 1.225 10. 0. Here's what the grid looks like now. In[18]:= Plot[{ftop[x], fbot[x]}, {x, 0, 10}, PlotRange -> {0, 15}, AspectRatio -> Automatic, GridLines -> {Table[i, {i, 0, 10, 0.5}], Table[i, {i, 0, 15, 0.5}]}] Out[18]= -Graphics- Solution for Problem 6 In[19]:= Clear[y, i] In[20]:= dx = 0.5; n = 20; y[i_] = height[i/2]; In[23]:= TrapRule20 = N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])] Out[23]= 58.2025 In[24]:= SimpRule20 = N[(dx/3) (4 Sum[y[2 i - 1], {i, 1, n/2}] + 2 Sum[y[2 i], {i, 1, n/2 - 1}])] Out[24]= 58.3046 Here's another shot to see if higher n can improve the estimates more. In[25]:= Clear[y, i] In[26]:= dx = 0.25; n = 40; y[i_] = height[i/4]; In[29]:= TrapRule40 = N[(dx/2) (y[0] + 2 Sum[y[i], {i, 1, n-1}] + y[n])] Out[29]= 58.293 In[30]:= SimpRule40 = N[(dx/3) (4 Sum[y[2 i - 1], {i, 1, n/2}] + 2 Sum[y[2 i], {i, 1, n/2 - 1}])] Out[30]= 58.3232 Solution for Problem 7 Due to the shape of the region, both numerical methods are expected to work well with errors decreasing as n increases. We expect Simpson's rule to offer slightly better estimates since parabolas fit the boundary better than straight line segments. Solution for Problem 8 The upper boundary of the region is composed of four separate functions . These are: f1[x_] = Sqrt[x]+10 where 0 <= x < 4 f2[x_] = 12-2 Sin[Pi x] where 4 <= x < 6 f3[x_] = 21-(x^2)/4 where 6 <= x < 8 f4[x_] = -2.5 x+25 where 8 <= x <= 10 The lower boundary is the function f[x] = .1(x - 10)^2 We enter the function code. In[31]:= ftop[x_] = Which[ x <= 4, Sqrt[x] + 10, 4 < x <= 6, 12 - 2 Sin[Pi x], 6 < x <= 8, 21 - x^2/4, 8 < x <= 10, -2.5 x + 25]; In[32]:= fbot[x_] = .1 (x - 10)^2; The area of each of the four regions, and their sum, is given by the following code: In[33]:= area1 = NIntegrate[ftop[x]-fbot[x], {x, 0, 4}]; area2 = NIntegrate[ftop[x]-fbot[x], {x, 4, 6}]; area3 = NIntegrate[ftop[x]-fbot[x], {x, 6, 8}]; area4 = NIntegrate[ftop[x]-fbot[x], {x, 8, 10}]; In[37]:= area = area1 + area2 + area3 + area4 Out[37]= 58.3333 Thus, the total area is 58 1/3 = 175/3 square units. Solution for Problem 9 Answers will vary for the first two area guesses... In[38]:= PError[x_] = 100 (x - area)/x; In[39]:= EGuess1 = PError[AreaGuess1]//N; EGuess2 = PError[AreaGuess2]//N; ETrap10 = PError[TrapRule10]//N; ETrap20 = PError[TrapRule20]//N; ETrap40 = PError[TrapRule40]//N; ESimp10 = PError[SimpRule10]//N; ESimp20 = PError[SimpRule20]//N; ESimp40 = PError[SimpRule40]//N; ErrorList = {{"Guesses", "TrapRules", "SimpRules", "Errors"}, {AreaGuess1, "", "", EGuess1}, {AreaGuess2, "", "", EGuess2}, {"", "n=10", "", ETrap10}, {"", "n=20", "", ETrap20}, {"", "n=40", "", ETrap40}, {"", "", "n=10", ESimp10}, {"", "", "n=20", ESimp20}, {"", "", "n=40", ESimp40}}; In[48]:= TableForm[ErrorList] Out[48]//TableForm= Guesses TrapRules SimpRules Errors 90 35.1852 70 16.6667 n=10 -0.754917 n=20 -0.224718 n=40 -0.0691486 n=10 -0.139262 n=20 -0.0492228 n=40 -0.0173994 Solution for Problem 10 Students appreciate it when you ask, and we'd like to hear what they say too! ISSUES IN SOLUTION An interesting observation is that both the trapezoid and Simpson's rules seem to underestimate the area and converge to the area from below. If time allows, students should try increasing values of n to check if this indeed the case. If time is too limiting, it is at least pointing this out. Further, by considering how the methods would work for differently shaped regions would be enlightening.