Example 2. Compare
the accuracy of the Gauss-Legendre quadrature rules for n = 2, 3, and
4 points
with the Trapezoidal rule, Simpson's Rule and Simpson's
rule for n = 2, 3, and 4 points respectively.
Illustrate the comparisons for the integral
.
Solution 2.
First, enter the formula
.
Use Mathematica to find the true value of the
integral and the "true" numerical value too.
Use the quadrature values obtained in Exercise 1.
Q2 = 1.69296344978122892
Q3 = 1.71202024520190976
Q4 = 1.71122450459948849
Compare Gauss-Legendre quadrature 2 point rule with the
Trapezoidal rule.
Compare Gauss-Legendre quadrature 3 point rule with Simpson's
rule.
Compare Gauss-Legendre quadrature 4 point rule with Simpson's
rule.
Observe that the errors for the Trapezoidal rule, Simpson's Rule
and Simpson's
rule form a decreasing sequence.
Observe that the errors for the Gauss-Legendre quadrature rules
for n = 2, 3, and 4 points form a decreasing sequence.
The ratios will determine how much smaller the error for Gauss
Legendre quadrature is.
It is interesting to determine when the composite Simpson's rule
is competitive with the three point Gauss Legendre rule,
and compare the number of function evaluations. For our function
above the following calculations are illustrative.
(c) John H. Mathews 2003