This method is used to calculate a certain integral. It is an approximation of the definite integral of a function, it is usually stated as a weighted sum of function values at specified points in the domain of integration. It is named after Carl Friedrich Gauss which is a quadrature rule developed to yield an exact result of polynomials of degree 2n - 1 or less by choosing a suitable nodes and weights for i = 1,…,n.
DERIVATION
Here W(x) = 1 so the integral to be computed is
After making the linear transformation
the interval [a, b] transforms to [-1, 1] and setting.
Where
The given integral can be transformed to
In general, for computing the integral by a quadrature formula with nodes having degrees of precision 2n + 1,
Where is Legendre polynomial of degree n i.e. are the zero of the polynomial and is a constant given by
Hence,
Where
GRAPHICAL REPRESENTATION
INPUT:
A function for which the integration is to be calculated
OUTPUT:
The value of integration
PROCESS:
Step 1: [taking the inputs from the user]
Read n [the number of terms]
for i = 0 to n - 1 repeat
Read t[i]
[End of ‘for’ loop]
for i = 0 to n - 1 repeat
Read k[i]
[End of ‘for’ loop]
Step 2: [Gauss Quadrature]
Set sum<-0
for i = 0 to n - 1 repeat
Set xi ← ((4.5 + 2.5) + (4.5 - 2.5) × t[i])/2
Set fi ← f(xi)
Set c ← k[i] × fi
Set sum ← sum + c
Print t[i], xi, fi, k[i], c
[End of ‘for’ loop]
[‘f(x)’ is a function defined in step 3]
Set ig ← ((4.5 - 2.5) × sum)/2
Print ig
[End of Gauss Quadrature]
Step 3: [function f(x)]
Return exponential(x)/(x^3 - 1)
ADVANTAGES
1. Gauss quadrature gives a more accurate result.
2. It uses fewer panels to get the result, therefore fewer function evaluations and less chance of round-off errors.
3. The speed of this method is better than Newton's cotes quadrature.
DISADVANTAGES
1. The ways to compute the node points and weights are complex.
2. It is difficult to calculate the weight and integration points for high-order integration.
APPLICATIONS
1. It is a powerful technique for numerical integration which falls under the broad category of the spectral method.
2. It is used for solving different differential equations also.
Contributed by