Subject : The following demonstrates the Gaussian method of estimating integrals of continuous functions.
Authors : Nathan Collier, Autar Kaw, Loubna Guennoun
Date : 26 October 2005

Introduction

Gauss Quadrature rule is another method of estimating an integral. The two point Gauss Quadrature Rule is an extension of the Trapezoidal Rule approximation where the integral estimate was based on taking the area under the straight line connecting the function values at the limits of the integration interval, a and b. However, unlike the Trapezoidal Rule approximation, the two point Gauss Quadrature rule is based on evaluating the area under a straight line connecting two points on the curve that are not predetermined as a and b, but as unknowns. Thus, in the two-point Gauss Quadrature Rule, the integral is approximated as:

There are now four unknowns that must be evaluated c1, c2, x1, and x2. These are found by assuming that the formula gives exact results for integrating a general third order polynomial,

Hence,

The approximation formula would then give

Equating the last two equations gives

The constatnts a0, a1, a2, and a3 are arbitrary

Solving these equations simultaneously, we have

Hence,

This is called the two-point Gauss Quadrature Rule since two points were chosen. For n-points rules formula, it can be developed using the general form:

NOTE: Weighting factors c and function arguments x used in Gauss Quadrature Rule have already been defined for any function to be integrated from -1 to 1. To change the limits of the integral so that they are from -1 to 1, a and b are substituted into

This equation can be differentiated to give

These two equations can be substituted for x and dx, respectively, in the equation to be integrated to obtain the form that is suitable for evaluating the integral using Gauss Quadrature Rule. The following summarizes the weighting factors c and the function arguments x used in Gauss quadrature Rule up to four points.

Weighting Factors for 1-4 Points

(Subscript[C, 1, 0]) = 2.0;
(Subscript[C, 1, 1]) = 1.0;
(Subscript[C, 2, 1]) = 1.0;
(Subscript[C, 1, 2]) = 0.5555556;
(Subscript[C, 2, 2]) = 0.8888889;
(Subscript[C, 3, 2]) = 0.5555556;
(Subscript[C, 1, 3]) = 0.347854845;
(Subscript[C, 2, 3]) = 0.652145155;
(Subscript[C, 3, 3]) = 0.652145155;
(Subscript[C, 4, 3]) = 0.347854845;

Function Arguements for 1-4 Points

(Subscript[X, 1, 0]) = 0.0;
(Subscript[X, 1, 1]) = -0.5773503;
(Subscript[X, 2, 1]) = 0.5773503;
(Subscript[X, 1, 2]) = -0.774596669;
(Subscript[X, 2, 2]) = 0.0;
(Subscript[X, 3, 2]) = 0.774596669;
(Subscript[X, 1, 3]) = -0.861136312;
(Subscript[X, 2, 3]) = -0.339981044;
(Subscript[X, 3, 3]) = 0.339981044;
(Subscript[X, 4, 3]) = 0.861136312;

Inputs

The following simulation will illustrate the Gauss Quadrature Rule of integration. This section is the only section where the user may interact with the program.The user may enter any function f(x), and the lower and upper limit for the function. By entering this data, the program will calculate the exact value of the integral, followed by the results using the Gauss Quadrature Rule with 2, 3, and 4 points.

Integrand f[x] = 0

f[x_] := 300.0*x/(1.0 + Exp[x]);

Lower and upper limit of the integral, a and b respectively.

a = 0.0;
b = 10.0;

curve = 
        Plot[f[x], {x, a, b}, 
          PlotLabel -> "Entered function on given interval", 
          TextStyle -> {FontSize -> 
                11}];
General::spelll  Off;

Conversion of the Limits

The integral given above has the limits of[a,b].It needs to be converted into an integral with limits[-1,1] fnew(x) is the new function that will be used for evaluating the integral using the Gauss Quadrature rule

fnew[x_] := 
        f[(b - a)*x/2 + (b + a)/2]*(b - a)/2;

1 Point

s1 = fnew[(Subscript[X, 1, 0])]

The approximate value of the integral using one-point Gauss quadrature

(Subscript[AV, 1]) = (Subscript[C, 1, 0])*s1

2 Point

s1 = fnew[(Subscript[X, 1, 1])]
s2 = fnew[(Subscript[X, 2, 1])]

The approximate value of the integral using two-point Gauss quadrature

(Subscript[AV, 2]) = (Subscript[C, 1, 1])*s1 + (Subscript[C, 2, 1])*s2

The approximate error is:

Ea2 = (Subscript[AV, 2]) - (Subscript[AV, 1])

The absolute relative approximate error is

ea2 = Abs[Ea2/(Subscript[AV, 2])]*100

3 Point

s1 = fnew[(Subscript[X, 1, 2])]
s2 = fnew[(Subscript[X, 2, 2])]
s3 = fnew[(Subscript[X, 3, 2])]

The approximate value of the integral using three-point Gauss quadrature

(Subscript[AV, 3]) = (Subscript[C, 1, 2])*s1 + (Subscript[C, 2, 2])*s2 + (Subscript[C, 3, 2])*s3

The approximate error is:

Ea3 = (Subscript[AV, 3]) - (Subscript[AV, 2])

The absolute relative approximate error is

ea3 = Abs[Ea3/(Subscript[AV, 3])]*100

4 Point

s1 = fnew[(Subscript[X, 1, 3])]
s2 = fnew[(Subscript[X, 2, 3])]
s3 = fnew[(Subscript[X, 3, 3])]
s4 = fnew[(Subscript[X, 4, 3])]

The approximate value of the integral using four-point Gauss quadrature

(Subscript[AV, 4]) = 
      (Subscript[C, 1, 3])*s1 + (Subscript[C, 2, 3])*s2 + (Subscript[C, 3, 3])*s3 + 
        (Subscript[C, 4, 3])*s4

The approximate error is:

Ea4 = (Subscript[AV, 4]) - (Subscript[AV, 3])

The absolute relative approximate error is

ea4 = Abs[Ea4/(Subscript[AV, 4])]*100