This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Add-ons / Standard Packages / NumericalMath  /

NumericalMath`GaussianQuadrature`

The Mathematica function NIntegrate uses as one of its methods a fairly sophisticated Gauss-Kronrod-based algorithm. The package NumericalMath`GaussianQuadrature` allows you to easily study some of the theory behind ordinary Gaussian quadrature which is a little less sophisticated.
The basic idea behind Gaussian quadrature is to approximate the value if an integral as a linear combination of values of the integrand evaluated at specific points:


Since there are free parameters to be chosen (both the abscissas and the weights ) and since both integration and the sum are linear operations, we can expect to be able to make the formula correct for all polynomials of degree less than about

. In addition to knowing what the optimal abscissas and weights are, it is often desirable to know how large the error in the approximation will be. This package allows you to answer both of these questions.


Finding formulas for Gaussian quadrature.

  • This loads the package.
  • In[1]:= <<NumericalMath`GaussianQuadrature`

  • This gives the abscissas and weights for the five-point Gaussian quadrature formula on the interval (

    3, 7).
  • In[2]:= GaussianQuadratureWeights[5, -3, 7]

    Out[2]=

  • Here is the error in that formula. Unfortunately it involves the tenth derivative of

    at an unknown point so we don't really know what the error itself is.
  • In[3]:= GaussianQuadratureError[5, f, -3, 7]

    Out[3]=

  • We can see that the error decreases rapidly with the length of the interval.
  • In[4]:= GaussianQuadratureError[5, f, a, a+h]

    Out[4]=