CHAPTER 07.05: GAUSS QUADRATURE RULE: Example
In this segment, we're going to take an example of the Gauss quadrature rule. So let's suppose somebody tells you to go ahead and integrate this particular function, 0.1 to 1.3, 5 x e to the power -2 x, dx. They ask you to integrate this particular function by three-point Gauss quadrature rule, three-point Gauss quadrature rule. How do we go about finding out this integral by using the three-point Gauss quadrature rule? So the first thing which you want to do is you want to convert this integral into an integral going from -1 to +1. So how do we go about doing that? It is by using a simple formula from your integral calculus class, again, that this is exactly equal to, the value of the integral which you're going to get from here will be same as the value of the integral which you're going to get by using this integral. So if you want to convert an integral whose lower limits are from a to b to -1 to +1, the transformation which we will have to make is as follows, that the argument will be this, and there'll be a b minus a, divided by 2, which will be a multiplication factor there. And because . . . the reason why we have to go from to here is because we have to show that how can we convert this integral from a to b to integral from -1 to +1, because the coefficients and . . . the arguments and the weights which are given for the Gaussian quadrature rule are given only for integrals going from -1 to +1. So in this case, what we are finding out, we have 0.1 to 1.3, f of x dx. So in this case, it will be 1.3 minus 0.1, divided by 2, integral from -1 to +1, 1.3 minus 0.1, divided by 2, x, 1.3 plus 0.1, divided by 2, dx. So this one turns out to be 0.6, -1 to +1, the value of the function calculated at 0.6 x, plus 0.7, dx. It's very important to understand that this is the argument of the function at which you're going to calculate these function values, and there is a multiplication factor of 0.6 which you should not forget about when you are doing the Gaussian quadrature rule. Now, all it means is that what I have to do is now I have to write down what the coefficients and the arguments are for the three-point Gauss quadrature rule. So we already know that the three-point Gaussian quadrature rule for this particular function, here it is given by c1 times f of x1, plus c2 times f of x2, plus c3 times f of x3, and we are given c1 to be 0.5556, c2 is 0.8889, c3 is 0.5556 again, x1 is given as -0.7746, x2 is 0, and x3 is +0.7746. So that's from the handbook or from your book, you will see that these are the values given for the three-point Gauss quadrature rule. So let me go ahead and now go ahead and see what I can do for this 0.6, -1 to 1, f of 0.6 x plus 0.7, dx, is that I'm going to say it's 0.6 times c1, which is 0.5556, times the value of the function calculated at the first argument, which is 0.7746, plus 0.7. And then the second part will be c2, which is 0.8889, and the value of the function, again, calculated at 0.6 times 0, plus 0.7. And the third part is c3 times the value of the function at x3, so c3 is 0.5556 times the value of the function at 0.6 times 0.7746, plus 0.7. So that's what's going to give me the value of the approximate value of the integral. So in fact, what I should put down here is not the equal to sign, but the approximation sign, because I'm using a three-point Gauss quadrature rule. So if I say what this is, this is 0.6 times 0.5556 times the value of the function at 0.2352, plus 0.8889 times the value of the function at 0.7, plus 0.5556 times the value of the function at 1.165. So what it's telling you is that you've got to calculate the value of the function at 0.2352, give it a weightage of this times this, calculate the value of the function at 0.7, give it a weightage of this times 0.6, calculate the value of the function at this argument here, and the weightage will be this times this here. So you can also be sure that the values of the function which you are calculating, or the arguments of the values of the function which you are calculating are between the lower limit and the upper limit. The lower limit in this case is 0.1, and the upper limit is 1.3, and you are seeing that the arguments are between 0.1 and 1.3. If they were not, then you have made some mistake in your calculations. So that's a check to see that whether you are going along the right path here. So if I go ahead and substitute the values, I get 0.6 times 0.5556, and what I have to do is I have to calculate the value of the function at those arguments, the first argument turns out to be 0.7347, then the next weight is 0.8889, and the value of the function there turns out to be 0.8630, and the next weight is 0.5556, and the value of the function at 0.7 turns out to be 0.5668. So keep in mind that what you are supposed to do is to substitute the values of the arguments of the function in the original function, and you should be able to get these values. So for example, this 0.7347 is nothing but 5 times x, which is 0.2352, times e to the power -2 times 0.2352, so that's what this quantity right here is, so this is the value of the function at 0.352, this is the value of the function at 0.7, and this is the value of the function at 1.165, so you're just substituting those values of the argument in there, and then when you calculate this, you get 0.8942 as the value. The exact value is 0.8939 So you can very well see that how accurate your answer is. So, if you would draw a table to show that if a certain number of points, and I calculate the value here for 1, 2, and 3, and 4, I already know for 3, it is 0.8942, because that's what I calculated just now, for this one it's 1.036, this is 0.9101, and this is 0.8939. In fact, if I use the four-point Gauss quadrature rule, I get exactly the same value as the exact value right here, there's no difference between those two up to four significant digits. So you can appreciate that how accurate this Gaussian quadrature rule is. And that's the end of this example. |