CHAPTER 01.03: SOURCES OF ERROR : Truncation Error: Example: Integration
In this segment we're going to take an example of truncation error. So we have truncation error, we're going to take an example of it, and the example which we're going to take is of integration.
Let's suppose somebody told you to integrate x squared from 3 to 9. And if we were going to do exact integration, we already know this is x cubed divided by 3, lower limit 3, upper case . . . upper limit 9, and this value here turns out to be 9 cubed minus 3 cubed divided by 3, and that is 234. Now the approximate way of calculating the area under the curve from 3 to 9 for x squared, I'm going to show it here. So we are trying to find the approximate value of the integral going from 3 to 9 of x cubed dx. Now the value which I told you about, the exact value, which is 234, is basically obtained from drawing infinite rectangles going from 3 to 9, whether you're using LRAM, left-hand Riemann sum, or trapezoids, or any of that nature, you will have to use an infinite number of those to calculate the value of 234, which we got as the exact value. Now in order to calculate the approximate value, this is 3, and this is 9. One might go ahead and say that, hey, what I'm going to do is I'm going to take the midpoint here, which is 6, take the rectangle right there, calculate the area of this rectangle here, then I go ahead and go here, draw this rectangle here, and I calculate this area here. So I calculate this area and I calculate this area, and that will give me the value of the approximate value of the integral going from 3 to 9. So in this case, what you are finding out is that the truncation error is being created because we are choosing only two rectangles going from 3 to 9 to represent the area under the curve. The value of 234 which I obtained for the exact value beforehand, can be done by using this principle of choosing rectangles, but the number of rectangles which you'll have to choose will be from 3 to 9. As we know that in numerical methods, we don't have the luxury of doing that, we can only choose a finite number of rectangles. In this case, the area of the first rectangle which I get is the value of the function at 3 times the width of that rectangle, which is 6 minus 3, plus the value of the function at 6 times the width of the rectangle, which is 9 minus 6, and what is the value of the function at 3? The value is . . . the function is x squared . . . the function is x squared, so the value of the function at x squared is 3 squared times 6 minus 3, plus 6 squared times 9 minus 6. And this value here turns out to be 27, and this value here turns out to be 108, and the number turns out to be 135. So by choosing two rectangles going from 3 to 9 here, you are able to calculate the value of the integral going from . . . of x squared going from 3 to 9 to be approximately equal to 135. That is this value here. So there's a certain amount of truncation error which has been created by this approximate value of the integral. We already know the exact value is how much? So our truncation error will be defined as exact value minus the approximate value which we are getting. The exact value is 234, which you obtained by using your knowledge of integral calculus class, and the approximate value which I have obtained, which was obtained by using the LRAM, which is the left Riemann sum, or simply the two rectangles which we drew, and this number here turns out to be 99. So that's a huge amount of truncation error which has been created. And the reason why we have a truncation error is because this approximate value which we calculated was calculated by simply approximating the area under the curve by two rectangles. So as part of your homework, what I would like you to do is this particular problem, to see whether you are able to reduce the amount of truncation error by maybe choosing four rectangles, as opposed to two rectangles which I showed you. So this is our function x squared going from 0 to some number. So let's suppose this is 3, and this is 9. In the previous example, we took the midpoint between 3 and 9, and drew two rectangles. Now what I'm going to do is, I want to use four rectangles, so I will choose this to be 4.5, and this will be 7.5, those are the five points which I will choose going from 3 to 9, or basically getting four rectangles, and then what I will do is I will do this rectangle here, then I will do this rectangle here, then I will do this rectangle here, and then I will do this rectangle here. So in that case I get area of this rectangle, area of the second rectangle, area of the third rectangle, area of the fourth rectangle. Now what I would like you to do is go ahead and calculate the area of these four rectangles, and see if your truncation error turns out to be less than 99. And that's your homework. And that's the end of this segment. |