Integrals over complicated functions often have to be calculated numerically. Integration is also the elementary step in solving equations of motion. An integral over an infinite interval may have to be transformed into an integral over an infinite interval first. A definite integral can be approximated numerically as the weighted average over a finite number of function values.
Specific sets of quadrature points and quadrature weights are known as “integral rules”. Newton-Cotes rules use equidistant points and are easy to apply. Accuracy can be improved by dividing the integration range into sub-intervals and applying composite Newton-Cotes rules. Extrapolation methods reduce the error almost to machine precision but need many function evaluations. Equidistant sample points are convenient but not the best choice. Clenshaw-Curtis expressions use non uniform sample points and a rapidly converging Chebyshev expansion. Gaussian integration fully optimizes the sample points with the help of orthogonal polynomials.