Module

for

Gauss-Legendre Quadrature

   

Background. Gauss-Legendre Quadrature.  

    We wish to find the area under the curve  [Graphics:Images/GaussianQuadMod_gr_1.gif].  What method gives the best answer if only two function evaluations are to be made?  We have already seen that the trapezoidal rule is a method for finding the area under the curve that uses two function evaluations at the endpoints (-1,f[-1]),  and  (1,f[1]).  But if the graph of  y = f[x]  is concave, the error in approximation is the entire region that lies between the curve and the line segment joining the points.  If we are permitted to use the nodes  [Graphics:Images/GaussianQuadMod_gr_2.gif]  and [Graphics:Images/GaussianQuadMod_gr_3.gif]  that lie inside the interval  [-1,1],  the line through the two points  [Graphics:Images/GaussianQuadMod_gr_4.gif]  and  [Graphics:Images/GaussianQuadMod_gr_5.gif]crosses the curve, and the area under the line more closely approximates the area under the curve.  This method is attributed to Johann Carl Friedrich Gauss (1777-1855) and Adrien-Marie Legendre (1752-1833).  
    

    

[Graphics:Images/GaussianQuadMod_gr_6.gif]             [Graphics:Images/GaussianQuadMod_gr_7.gif]


    The line through [Graphics:Images/GaussianQuadMod_gr_8.gif].         The line through  [Graphics:Images/GaussianQuadMod_gr_9.gif].

    The equation of the line through the two points  [Graphics:Images/GaussianQuadMod_gr_10.gif]  and  [Graphics:Images/GaussianQuadMod_gr_11.gif]is  
    
(1)        [Graphics:Images/GaussianQuadMod_gr_12.gif],  

and the area of the trapezoid under this line is

(2)        [Graphics:Images/GaussianQuadMod_gr_13.gif].  

Notice that the trapezoidal rule  [Graphics:Images/GaussianQuadMod_gr_14.gif]  is a special case of (2).  When we choose  [Graphics:Images/GaussianQuadMod_gr_15.gif]  and  [Graphics:Images/GaussianQuadMod_gr_16.gif], and  [Graphics:Images/GaussianQuadMod_gr_17.gif],  

        [Graphics:Images/GaussianQuadMod_gr_18.gif].  

    The trapezoidal rule is

        [Graphics:Images/GaussianQuadMod_gr_19.gif],  

and it exact for straight lines  (i.e. [Graphics:Images/GaussianQuadMod_gr_20.gif]).  

    If the abscissas   [Graphics:Images/GaussianQuadMod_gr_21.gif]  and  [Graphics:Images/GaussianQuadMod_gr_22.gif] = [Graphics:Images/GaussianQuadMod_gr_23.gif],   and weights [Graphics:Images/GaussianQuadMod_gr_24.gif] are used, we have the Gauss-Legendre 2 point quadrature rule

        [Graphics:Images/GaussianQuadMod_gr_25.gif],  

which exact for cubic polynomials (i.e. [Graphics:Images/GaussianQuadMod_gr_26.gif]).  

 

Theorem (Gauss-Legendre Quadrature).  An approximation to the integral  

        [Graphics:Images/GaussianQuadMod_gr_27.gif]

is obtained by sampling  [Graphics:Images/GaussianQuadMod_gr_28.gif]  at the  [Graphics:Images/GaussianQuadMod_gr_29.gif]  unequally spaced abscissas  [Graphics:Images/GaussianQuadMod_gr_30.gif] , where the corresponding weights are  [Graphics:Images/GaussianQuadMod_gr_31.gif] .  
The abscissa's and weights for Gauss-Legendre quadrature are often expressed in decimal form.

 

n=2 Rule    [Graphics:Images/GaussianQuadMod_gr_32.gif]  
where      [Graphics:Images/GaussianQuadMod_gr_33.gif]
                [Graphics:Images/GaussianQuadMod_gr_34.gif]

 

n=3 Rule    [Graphics:Images/GaussianQuadMod_gr_35.gif]   
where      [Graphics:Images/GaussianQuadMod_gr_36.gif]
                [Graphics:Images/GaussianQuadMod_gr_37.gif]
                [Graphics:Images/GaussianQuadMod_gr_38.gif]

 

n=4 Rule    [Graphics:Images/GaussianQuadMod_gr_39.gif]  
where      [Graphics:Images/GaussianQuadMod_gr_40.gif]
                [Graphics:Images/GaussianQuadMod_gr_41.gif]
                [Graphics:Images/GaussianQuadMod_gr_42.gif]
                [Graphics:Images/GaussianQuadMod_gr_43.gif]

 

n=5 Rule    [Graphics:Images/GaussianQuadMod_gr_44.gif]  
where      [Graphics:Images/GaussianQuadMod_gr_45.gif]
                [Graphics:Images/GaussianQuadMod_gr_46.gif]
                [Graphics:Images/GaussianQuadMod_gr_47.gif]
                [Graphics:Images/GaussianQuadMod_gr_48.gif]
                [Graphics:Images/GaussianQuadMod_gr_49.gif]

Remark. For ease of reading the above list of rules has used the notation [Graphics:Images/GaussianQuadMod_gr_50.gif] and [Graphics:Images/GaussianQuadMod_gr_51.gif] instead of  [Graphics:Images/GaussianQuadMod_gr_52.gif] and [Graphics:Images/GaussianQuadMod_gr_53.gif], respectively.

 

Truth.

Proof  Gauss-Legendre Quadrature  Gauss-Legendre Quadrature  

 

Theorem (Error for Gauss-Legendre Quadrature).  The error terms for the rules n = 2, 3, 4 and 5 can be expressed as follows:

n=2 Rule    [Graphics:Images/GaussianQuadMod_gr_88.gif]

n=3 Rule    [Graphics:Images/GaussianQuadMod_gr_89.gif]

n=4 Rule    [Graphics:Images/GaussianQuadMod_gr_90.gif]

n=5 Rule    [Graphics:Images/GaussianQuadMod_gr_91.gif]

Proof  Gauss-Legendre Quadrature  Gauss-Legendre Quadrature  

 

Animations (Gauss-Legendre Quadrature  Gauss-Legendre Quadrature).  

 

Computer Programs  Gauss-Legendre Quadrature  Gauss-Legendre Quadrature  

 

Mathematica Subroutine (Gauss-Legendre Quadrature).

[Graphics:Images/GaussianQuadMod_gr_92.gif]

Example 1.  Use the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points to compute numerical approximations for   [Graphics:Images/GaussianQuadMod_gr_93.gif] .  
Solution 1.

 

Example 2.  For Example 3, compare the accuracy of the Trapezoidal Rule, Simpson's Rule, Simpson's [Graphics:Images/GaussianQuadMod_gr_134.gif] Rule and Boole's Rule, with the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points, respectively.
Solution 2.

 

Example 3.  Use the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points to compute numerical approximations for  [Graphics:Images/GaussianQuadMod_gr_169.gif] .  
Solution 3.

 

Example 4.  For Example 3, compare the accuracy of the Trapezoidal Rule, Simpson's Rule, Simpson's [Graphics:Images/GaussianQuadMod_gr_212.gif] Rule and Boole's Rule, with the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points, respectively.
Solution 4.

 

 

The shifted Gauss-Legendre rule for [a,b].   

Theorem (The Gauss-Legendre Translation).
  Suppose that the abscissas [Graphics:Images/GaussianQuadMod_gr_247.gif] and weights [Graphics:Images/GaussianQuadMod_gr_248.gif] are given for the n-point Gauss-Legendre rule over [-1,1].  To apply the rule over the interval [a,b], use the change of variable

        [Graphics:Images/GaussianQuadMod_gr_249.gif].  

Then the relationship  [Graphics:Images/GaussianQuadMod_gr_250.gif] is used to obtain the quadrature formula

        [Graphics:Images/GaussianQuadMod_gr_251.gif].

Proof  Gauss-Legendre Quadrature  Gauss-Legendre Quadrature  

 

Algorithm  (The Gauss-Legendre Translation).  To approximate the integral [Graphics:Images/GaussianQuadMod_gr_252.gif] use the change of variable [Graphics:Images/GaussianQuadMod_gr_253.gif] . Then use [Graphics:Images/GaussianQuadMod_gr_254.gif] and apply the Gauss-Legendre rules for [Graphics:Images/GaussianQuadMod_gr_255.gif].

[Graphics:Images/GaussianQuadMod_gr_256.gif]

Example 5.  Use the shifted Gauss-Legendre rules for n = 3 points to compute approximations for the integrals  
        [Graphics:Images/GaussianQuadMod_gr_257.gif] .  
Solution 5.

 

Various Scenarios and Animations for Gauss-Legendre Quadrature.

Example 6.  Let  [Graphics:Images/GaussianQuadMod_gr_276.gif]  over  [Graphics:Images/GaussianQuadMod_gr_277.gif].  Use Gauss-Legendre quadrature to approximate the value of the integral.  
Solution 6.

 

Animations (Gauss-Legendre Quadrature  Gauss-Legendre Quadrature).  

 

Old Lab Project (Gauss-Legendre Quadrature  Gauss-Legendre Quadrature).  Internet hyperlinks to an old lab project.  

 

Research Experience for Undergraduates

Gauss-Legendre Quadrature  Gauss-Legendre Quadrature  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Gauss-Legendre Quadrature

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004