The Comparison of the Trapezoid Rule and the Gaussian Quadrature

The Comparison of the Trapezoid Rule and the Gaussian Quadrature

The Comparison of the Trapezoid Rule and the Gaussian Quadrature Margo Rothstein Georgia College and State University May 3, 2018 1 Abstract This paper provides a detailed exploration of the comparison of the Gaussian Quadrature and the Trapezoid Rule. They are both numerical methods that are used to approximate integrals. The Gaussian Quadrature is a much better approximation method than the Trapezoid Rule. We will prove and demonstrate the approximating power of both rules, and provide some practical applications of the rules as well. 2 Introduction Integration is the calculation of the the theorem states the following: area under the curve a function f(x). The integral of f produces a family of an- Z b tiderivatives F (x)+c that is used to calculate f(x)dx = F (b) − F (a): the area, denoted by, a Z f(x)dx: There are many methods developed to find F (x) that will produce the exact area. These A definite integral calculates the area under methods include integration by parts, par- the curve of a function f(x) on a specific in- tial fraction decomposition, change of vari- terval [a; b], denoted by, ables, and trig substitution. However, there are some functions that can not be inte- Z b grated exactly. They must be approximated. f(x)dx: We will discuss two approximation methods a in numerical analysis called the Trapezoid The Fundamental Theorem of Calculus is Rule and the Gaussian Quadrature. The how a definite integral should be calculated; definition of a Quadrature rule for nodes 1 x1 < x2 < x − 3 < ··· < xn is n Z b X f(x)dx ≈ cif(xi): a i=1 A closed quadrature rule means that f(x) is evaluated at the endpoints. An open quadrature rule is when f(x) is not evalu- ated at the endpoints. 3 Trapezoid Rule The Trapezoid Rule is a closed rule will format the area of the trapezoid so Quadrature rule where f(x) is only evalu- that it matches the definition. Note the fol- ated at the endpoints a and b on the inter- lowing: val [a; b]. Visually on a graph, we see the Z b f(a) + f(b) line that passes through points (a; f(a)) and f(x)dx = (b − a) 2 (b; f(b)), which forms a trapezoid with the a (b − a) x-axis. Thus, the area under the curve can = (f(a) + f(b)) be approximated by the area a Trapezoid, as 2 (b − a) (b − a) shown in Figure 1. = f(a) + f(b) 2 2 Figure 1 = c1f(a) + c2f(b) 2 y X = cif(xi): i=1 f(b) The area of a Trapezoid is now in the form of a Quadrature Rule with n = 2. Note that (b−a) c1 = c2 = 2 . That is, the coefficients f(a) are always that same. Since the Trapezoid Rule takes the area under a linear function, the value of the summation is exact only for polynomials of degree ≤ 1. For every poly- a b x nomial of degree > 1, the Trapezoid Rule will over- or under- approximate. Consider the Lagrange Polynomial interpolation for 2 points (x ; f(x )) and (x ; f(x )). The area of a Trapezoid is, 0 0 1 1 (x − x1) (x − x0) 00 Z b f(a) + f(b) P1(x) = f(x0) + f(x1) + Of (cx) f(x)dx = (b − a): x0 − x1 x1 − x0 a 2 00 where Of (cx) is the error term from the Since the Trapezoid Rule is a Quadrature approximation and cx depends continuously 2 on x0 and x1. For a linear function f(x) = tions, we will see how the coefficients and kx + C for some constants k and C, the nodes of the Gaussian Quadrature are spe- second derivative f 00(x) = 0. Therefore, cially chosen to produce high accuracy for whenever f(x) is a linear function, the er- higher degree polynomials. First, we will ex- ror will be zero and thus the approximation plore some underlying information about the will be exact. In the next couple of sec- Legendre Polynomials. 4 The Gaussian Quadrature 4.1 Legendre Polynomials Before we learn about the Gaussian why the property of orthogonal functions is Quadrature, we need to understand the Leg- valuable for the Gaussian Quadrature. endre Polynomials. The Legendre Poly- nomials are a set of nonzero polynomials Theorem (1): If fp1; p2; :::; png is a set of nonzero orthogonal polynomials on the S = fP1(x);P2(x);P3(x) ::: g that are or- thogonal on the interval [−1; 1]. By the def- closed interval [a; b] where the degree of inition of orthogonal, every pi = i for i 2 f1; 2; :::; ng, then every p has i distinct roots on the interval (a; b). ( i Z 1 = 0 if i 6= j Pi(x)Pj(x)dx = By Theorem (1), every P (x) 2 S has i dis- 6= 0 if i = j: i −1 tinct roots on [−1; 1]. We will refer back to The next Theorem will help us understand these roots in the following section. 4.2 Gaussian Quadrature Recall that the Trapezoid Rule is exactly nomials. Z 1 accurate for polynomials of degree ≤ 1. Sup- 1dx = c1 + c2; pose we wanted to develop a Quadrature rule −1 that is accurate for polynomials of a much Z 1 higher degree. Hence, we want a linear com- xdx = c1(x1) + c2(x2); ∗ −1 bination of values f(xi ) that is either ex- Z 1 actly or very close to the actual value of the 2 2 2 integral. Say that we want to integrate a x dx = c1(x1) + c2(x2) ; −1 polynomial function P (x) on [−1; 1] where i Z 1 n = 2. 3 3 3 x dx = c1(x1) + c2(x2) : −1 Z 1 2 X Since we have four unknowns c1, c2, x1, and P (x)dx = ciP (xi) = c1P (x1)+c2P (x2): x2, and 4 equations, we have a solvable sys- −1 i=1 tem. When this system is solved, we obtain q 1 q 1 Consider the integrals of the first four poly- c1 = c2 = 1, x1 = 3 and x2 = − 3 . Note 3 q q 1 1 nd a given n, the Gaussian Quadrature is exact that 3 and − 3 are the roots of the 2 degree Legendre polynomial. When we ex- up to polynomials of degree 2n − 1. Clearly, tend this example to the general nth case, this is a much more accurate method than th the Trapezoid Rule. Table 1 gives the roots we obtain that each xi is a root of the i Legendre polynomial. and coefficients up to n = 4. R 1 −1 dx = c1 + c2 + ::: +cn = 2 R 1 −1 xdx = c1x1 + c2x2 + ::: +cnxn = 0 Table 1 ::: n xi ci R 1 2n−2 2n−2 2n−2 1 x dx = c1x1 + ::: +cnxn = 2 p 1 −1 3 (−1)2n−1 1 − p−1 1 2n−1 2n−1 3 q 3 5 R 1 2n−1 2n−1 2n−1 3 − x dx = c1x + ::: +cnx = 5 9 −1 1 n 8 2n 0 1 − (−1) 9 2n 2n q 3 5 5 9 q p p We have that the Gaussian Quadrature 15+2 30 90−5 30 4 − 35 180 is a linear combination of the function f(x) q p p th 15−2 30 90+5 30 evaluated at the roots of the n Legendre − 35 180 th q p p polynomial. In the n case shown, we can 15−2 30 90+5 30 35 180 see that the degree of the last polynomial in q p p 15+2 30 90−5 30 the series of equations is 2n − 1. Hence, for 35 180 5 Comparison of Applications We will look at a simple example that Now, we show the result from the Gaussian will demonstrate the accuracy of the Gaus- Quadrature with two points. sian Quadrature and the Trapezoid Rule. r r Consider the integral of f(x) = x2 from Z 1 1 1 1 1 2 x2dx = ( )2 + (− )2 = + = : [−1; 1]. The exact value of this integral can −1 3 3 3 3 3 be found by the standard integration rule for polynomials. We see that the Gaussian Quadrature pro- duced the exact answer, while the Trapezoid Z 1 3 Rule was off by 4 . 2 x 1 1 −1 2 3 x dx = j−1 = − ( ) = : −1 3 3 3 3 Consider the integral of a function f(x) The next integral is the result from using the on [a; b] 6= [−1; 1]. The integral is not Trapezoid Rule. given on [−1; 1], and therefore the Gaussian Quadrature cannot be applied directly to it. Z 1 2 (1 − (−1)) 2 2 We must use a substitution for x in order x dx = ((−1) +(1) ) = (1)(2) =to 2 normalize: the function onto [−1; 1]. Let −1 2 4 a = k1t1 + k2 and b = k1t2 + k2, where t1 interval is half of [−1; 1]. and t are the upper and lower bounds of the 2 Z 1 Z 1 1 1 1 interval we want to normalized [a; b] to. In tan−1(x)dx = tan−1( t + ) dt 0 −1 2 2 2 this particular case, [t1; t2] = [−1; 1]; that is, 1 1 r1 1 1 1 r1 1 t1 = −1 and t2 = 1. Note that adding and = (tan−1( ( )) + ) + (tan−1( (− )) + ) 2 2 3 2 2 2 3 2 subtracting a and b yield the following: p p 1 3 + 3 1 − 3 + 3 = (tan−1( )) + (tan−1( )) 2 6 2 6 a + b = −k + k + k + k = 2k , 1 2 1 2 2 ≈ 0:4380: a − b = −k1 + k2 − k1 − k2 = −2k1.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us