CHAPTER 07.02: TRAPEZOIDAL RULE: Multiple Segment Rule: Part 1 of 2
In this segment, we're going to take an example for the multiple segment trapezoidal rule. We'll use the formula for the multiple segment trapezoidal rule to show how it is applied to an example. So we're going to take the example of 0.1 to 1.3, f of x . . . f of x is 5 x e to the power -2 x, dx, and we're going to use . . . use three segment, we're going to use three segment trapezoidal rule. So let's go ahead and see how we can use the formula to calculate the value of this integral by using the three segment trapezoidal rule. So we've got h, which is the width of the segment, which is b minus a, divided by n, which is 3. So this is coming from, let me write this down here so that it can refresh your memory, h is equal to b minus a, divided by n, b is 1.3, a is 0.1, and n is 3, so that gives us 0.4, so that's the width of the segment which we're going to get. Now let's go ahead and use the formula to calculate the value of the integral. So let me rewrite the formula here. We have the integral of f of x dx is approximately equal to b minus a, divided by 2 n, times the value of the function at a, plus 2 times the summation of this, these values of the function, plus the value of the function at b, okay? So b in this case, for us, so if I take the integral which is given to me, 0.1 to 1.3, 5 . . . 5 x e to the power -2 x . . . 5 x e to the power -2 x, dx. So if I call this to be the function f of x, let's suppose, so as to keep it in the contracted form, I get equal to b minus a, which is 1.3 minus 0.1, divided by 2 times 3, because n is 3, times the value of the function at a, which is 0.1, plus 2 times the summation, i is equal to 1, and this should be n minus 1 here, sorry, so n minus 1 is the upper limit, so since n is 3, this will become 2, times the value of the function at a, which is 0.1, plus i h, which is 0.4, plus the value of the function at b, which is 1.3. So basically I have to . . . what you have to understand is that when you apply the multiple segment trapezoidal rule, you have to calculate what the arguments of the functions are, where you have to calculate then. So you get 1.2 divided by 6 here, times the value of the function at 0.1, I'm deliberately showing you the intermediate steps so that you understand what's going on, plus 2 times summation, i is equal to 1 to 2, the value of the function at 0.1 plus 0.4 i, plus the value of the function at 1.3, okay? So if I expand this, I get 1.2 divided by 6, times the value of the function at 0.1, plus 2 times the value of the function of, when i is 1, I'll get 0.4 plus 0.1, which is 0.5, plus, when i is 2, I'll get 0.4 times 2 is 0.8, 0.8 plus 0.1 is 0.9, plus the value of the function at 1.3. So that's what I get as the arguments of those functions. So that's what the most important part is, to be able to successfully calculate what the arguments of the function are, that's where most of the students make the mistake in interpreting the multiple segment trapezoidal rule formula. So here now you just substitute what the function is. So that's the value of the function at 0.1, then at 0.5 it is, and then at 0.9 it is, and then at 1.3 it is 5 1.3 e to the power -2 times 1.3. So that's the value of the function at 0.1, that's the value of the function at 0.5, that's the value of the function at 0.9, and that's the value of the function at 1.3, basically by substituting it in the function itself. So from there, once you do that, you're going to get the value of the integral, which turns out to be 0.84385. So that's what you get as the value of the integral here, by using the three segment trapezoidal rule on this function. So let's go ahead and calculate what the true error is. So we already know what the exact value is. The exact value for this integral here turns out to be 0.89387, that's the exact value of the integral. This is something which you can do as a homework, by using your integral calculus knowledge to calculate that exact value of the integral. So the true error is the exact value, which is 0.89387, and the approximate value, which is given there, and the true error in this case will turn out to be 0.05002, and if I want to calculate the absolute relative true error, maybe as a percentage, that'll be the true error, which is 0.05002, divided by the exact value, which is 0.89387, times 100, and the value turns out to be 5.5959 percent. So that's the amount of true error which you are getting by using three segment trapezoidal rule. To give you a fair idea, let's go ahead and see that what kind of numbers did we get when we were trying to do the single segment trapezoidal rule, or maybe if we were going to use two segments, what kind of numbers we would get for the same integral, so as to show that as you start using more and more segments, do you get a better, or more accurate answer, as you start increasing the number of segments? |