
Gaussian Quadrature James Keesling 1 Quadrature Using Points with Unequal Spacing In Newton-Cotes Integration we used points that were equally spaced. However, there was no need for the points to have any special spacing. If we wish to estimate the integral Z b f(x) dx a and have any set of points fx0; x1; : : : ; xng, then we can estimate the integral by the formula Z b f(x) dx ≈ A0 · f(x0) + A1 · f(x1) + ··· + An · f(xn): a We can solve for the constants fA0;A1;:::;Ang by making the formula exact for the functions f(x) = 1; x; x2; x3; : : : ; xn. This will give us n + 1 equations that we can use to solve for the constants fA0;A1;A2;:::;Ang . In Gaussian Quadrature we use the interval [−1; 1] as the standard and the points fx0; x1; : : : ; xng will all be contained in this interval. There is a matrix equation for the normalized constants fa0; a1; : : : ; ang. 2 2 n3 1 x0 x0 ··· x0 2 n 61 x1 x1 ··· x1 7 6 2 n7 61 x2 x ··· x 7 M = Vandermonde([x0; x1; : : : ; xn]) = 6 2 2 7 6. 7 4. ··· . 5 2 n 1 xn xn ··· xn T Let M be the transpose of M. Let A be the column vector with entries ai. Let B be a column vector with entries Z 1 i+1 i 1 − (−1) bi = x dx = : −1 i + 1 Then we get M T · A = B and solving for A we get the following. −1 A = M T · B 1 2 Choosing the Points We now have flexibility to choose the points fx0; x1; : : : ; xng in a way that will make the estimate of the integral even more accurate. The theory behind the choice of points involves the Legendre polynomials. Let us denote these polynomials by fPn(x) j n = 0; 1; 2;::: g. These polynomials have the following properties. (1) Pn(x) has degree n. (2) If i 6= j, then Z 1 Pi(x) · Pj(x) dx = 0: −1 2 n (3) The vector span of fP0(x);P1(x);:::;Pn(x)g is the same as that of f1; x; x ; : : : ; x g. (4) For each n Z 1 2 2 Pn (x) dx = : −1 2n + 1 R 1 Property (3) implies that −1 Pn(x) · P (x) dx = 0 for any polynomial P (x) of degree less than n. Here are the first few Legendre polynomials. P0(x) = 1 P1(x) = x 1 P (x) = (3x2 − 1) 2 2 1 P (x) = (5x3 − 3x) 3 2 1 P (x) = (35x4 − 30x2 + 3) 4 8 1 P (x) = (63x5 − 70x3 + 15x) 5 8 1 P (x) = (231x6 − 315x4 + 105x2 − 5) 6 16 1 P (x) = (429x7 − 693x5 + 315x3 − 35x) 6 16 . There is a simple formula that gives these polynomials. 1 dn P (x) = · (x2 − 1)n n 2n · n! dxn 2 The roots of these polynomials are all real and distinct. They are contained in the inter- val [−1; 1]. The points used in Gaussian Quadrature are the roots of Pn+1, fx0; x1; : : : ; xng. Because of the properties of the Legendre polynomials, it turns out that if P (x) is any poly- nomial of degree k up to 2n + 1, then the Gaussian Quadrature estimate of the integral of P (x) is exact. We now prove this fact. Theorem 2.1. Suppose that fx0; x1; x2; : : : ; xng are the roots of the Legendre polynomial of degree n + 1. Suppose that fa0; a1; : : : ; ang are the normalized coefficients for Gaussian Quadrature for these points. Then for any interval [a; b], n Z b b − a X b − a a + b P (x) dx = a · f · x + : 2 i 2 i 2 a i=0 Proof. We will give the proof just for the interval [−1; 1]. Adapting the proof to a general interval just requires a careful change of variables. Let Pn+1(x) be the Legendre polynomial with its roots fx0; x1; : : : ; xng. Assume that P (x) has degree ≤ 2n + 1. Let P (x) = Q(x) · Pn+1(x) + R(x) be the quotient and remainder. Then the degree of Q(x) is ≤ n and the degree of R(x) also has degree ≤ n. Consider the integral Z 1 Z 1 P (x) dx = Q(x) · Pn+1(x) + R(x) dx: −1 −1 Since the degree of Q(x) is less than that of Pn+1(x) we will have Z 1 Q(x) · Pn+1(x) dx = 0: −1 So, we get the following. Z 1 Z 1 P (x) dx = Pn+1(x) · Q(x) + R(x) dx −1 −1 Z 1 = R(x) dx −1 On the other hand we have these equalities. n Z 1 X R(x) dx = R(xi) −1 i=0 n X = Pn+1(xi) · Q(xi) + R(xi) i=0 The first equality is because the degree of R(x) is less than the number of points used in the quadrature formula. The second equality is because the points xi were chosen to be the zeros of Pn+1. So, we have shown that the quadrature formula is exact for polynomials of degree ≤ 2n + 1. 3 3 Implementation of Gaussian Quadrature For a given Legendre polynomial Pn+1(x), finding the roots is not such an easy task. So, the way this is usually done is to determine these values fx0; x1; : : : ; xng for a certain value of n and determine the coefficients fa0; a1; : : : ; ang. Then store these values and call them from memory or embed the values in a program implementing Gaussian Quadrature. Here are the xi and ai values for n = 9. x4 = −0:14887434 x5 = 0:14887434 x3 = −0:43339539 x6 = 0:43339539 x2 = −0:67940957 x7 = 0:67940957 x1 = −0:86506337 x8 = 0:86506337 x0 = −0:97390653 x9 = 0:97390653 The coefficients are the following. a4 = a5 = :29552422 a3 = a6 = :26926672 a2 = a7 = :21908636 a1 = a8 = :14945135 a0 = a9 = :06667134 If we used the exact values of these points and weights, then the Gaussian Quadrature formula would be exact for polynomials of degree ≤ 19. In the next section we implement a program with fewer points just for convenience. 4 TI-89 Program for Gaussian Quadrature Here is a program with eight points, n = 7. The points and their weights are given below. Be careful to enter the values correctly. Obviously, the program will not give good estimates if the numbers are not correct. 4 x0 = −:9602898564975363 a0 = :1012285362903706 x1 = −:7966664774136267 a1 = :2223810344533744 x2 = −:5255324099163290 a2 = :3137066458778874 x3 = −:1834346424956498 a3 = :3626837833783621 x4 = :1834346424956498 a4 = :3626837833783621 x5 = :5255324099163290 a5 = :3137066458778874 x6 = :7966664774136267 a6 = :2223810344533744 x7 = :9602898564975363 a7 = :1012285362903706 :gaussq(f,a,b) :Prgm :[-.9602898564975363, -.7966664774136267, -.5255324099163290, -.1834346424956498, .1834346424956498, .5255324099163290, .7966664774136267, .9602898564975363] ! points :[.1012285362903706, .2223810344533744, 3137066458778874, .3626837833783621, .3626837833783621, .3137066458778874, .2223810344533744, .1012285362903706] ! weights :0 ! p :For i,1,8 :p + (b-a)/2*weights[1,i]*f j (x=(b-a)/2*points[1,i] + (b+a)/2) ! p :EndFor :EndPrgm The variable f is the function with assumed variable x. The inputs a and b are the left and right endpoints of the interval of integration, respectively. The value of the integral is stored in the variable p. This program will give the exact integral for polynomials up to degree fifteen except for round-off error. So, to test the program compute the following integral. Z 1 1 x15 dx = = :0625 0 16 5.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages5 Page
-
File Size-