∫Numerical Differentiation and Integration
Gaussian Quadrature
Free nodes, orthogonal polynomials, Gauss–Legendre rules, change of interval and finite elements
Göttingen, 1814
Gauss is computing perturbations of planetary orbits — integrals that must be evaluated again and again, each function value a long hand calculation. Every saved evaluation is hours of work.
Newton–Cotes rules fix the nodes at equal spacing and choose only the weights: free parameters, so they can match polynomials of degree (one more by symmetry). Gauss sees parameters — weights and nodes — and asks whether all of them can be used. In a paper presented to the Göttingen Society in 1814, Methodus nova integralium valores per approximationem inveniendi, he shows that they can: well-placed points integrate every polynomial of degree up to exactly.
Twelve years later Jacobi explained why the magic points are what they are: the roots of orthogonal polynomials. Two centuries later, every finite-element program on Earth evaluates its element matrices at Gauss's points.
💡Gauss–Legendre quadrature
On , the -point Gauss–Legendre rule
takes as nodes the roots of the Legendre polynomial — the polynomials orthogonal on : for . With the weights from integrating the interpolant, the rule is exact for every polynomial of degree , and no -point rule can do better. The weights are all positive and sum to 2, so the rule is stable for any — unlike high-order Newton–Cotes.
Derivation
The two-point rule by hand, and the first Legendre polynomials
Two points, four conditions. Look for exact for . Symmetry suggests , , ; then the odd powers and give automatically, and
Two evaluations, exact up to degree 3 — where the trapezoid rule's two evaluations stop at degree 1.
The Legendre polynomials. Build polynomials of rising degree, each orthogonal on to all lower ones (Gram–Schmidt on , lesson 5-2, with as the inner product), scaled so :
Check one: , and because the integrand is odd. The roots of are — exactly the nodes found by hand. The roots of are and , the three-point nodes in the table.
Why the weights are positive. Let be the Lagrange basis polynomial of node (degree ). Then has degree , so the rule integrates it exactly, and is 1 at and 0 elsewhere:
| n | nodes | weights | exact up to degree |
|---|---|---|---|
| 1 | 0 | 2 | 1 |
| 2 | ±0.577350 (= ±1/√3) | 1, 1 | 3 |
| 3 | 0, ±0.774597 | 0.888889, 0.555556 | 5 |
| 5 | 0, ±0.538469, ±0.906180 | 0.568889, 0.478629, 0.236927 | 9 |
The first Gauss–Legendre rules on [−1, 1]
Why the roots of ? Take any polynomial of degree and divide it by : , with and of degree . Then by orthogonality, and at the roots of , . So integrating reduces to integrating , which any -point interpolatory rule does exactly. Choosing the nodes at the roots makes the rule exact for the part for free.
Any interval. Map to : . Nodes and weights come from
numpy.polynomial.legendre.leggauss(n), computed by the Golub–Welsch algorithm (1969) as eigenvalues of a small symmetric tridiagonal matrix — Unit 6 again.📐Gauss versus Simpson
For , with the same number of function evaluations:
- 3 evaluations: Gauss error , Simpson ;
- 5: against ;
- 9: against .
Mathematics is the queen of the sciences.
🛰Gauss points in every finite element
A finite-element stiffness matrix is an integral over each element: . Codes evaluate it with Gauss quadrature in the element's reference coordinates. For a two-node bar whose area varies linearly, the integrand is linear and one Gauss point gives the exact stiffness (30.0000 MN/m in the lab); for a quadratic taper one point is 5% off and two are exact. Choosing too few points ('reduced integration') makes elements too flexible and can admit spurious zero-energy 'hourglass' modes; too many wastes time and can lock thin elements. Choosing the number of Gauss points is a design decision every FE analyst makes, usually without knowing it.
💡Where you will use this
Structures, Geotechnics and Mechanical design: element matrices and stress recovery at Gauss points. Optimal Guidance: Gauss and Legendre pseudospectral methods for trajectory optimisation use these nodes as collocation points. Orbital Mechanics: Gauss–Legendre averaging of perturbations; Gauss's own method of orbit determination. Probability: Gauss–Hermite rules compute expectations over normal distributions with a handful of points — the basis of the unscented Kalman filter's sigma points (Unit 12).
📚Further reading
- Gene Golub and John Welsch, 'Calculation of Gauss quadrature rules', Mathematics of Computation 23(106), 221–230 (1969) — nodes and weights as an eigenvalue problem.
- Lloyd N. Trefethen, 'Is Gauss quadrature better than Clenshaw–Curtis?', SIAM Review 50(1), 67–87 (2008) — a readable comparison with experiments.
- Philip Davis and Philip Rabinowitz, Methods of Numerical Integration (2nd ed., Academic Press, 1984) — Gauss rules of every kind, with tables.
↓But there is a problem
Every rule in this unit samples along a line. In two dimensions we take products — points; in three, . A reliability engineer propagating twenty uncertain inputs through a structural model needs a twenty-dimensional integral: even three Gauss points per dimension means billion model runs.
In 1946 Stanisław Ulam, recovering from an illness in Los Angeles, passed the time playing solitaire, and wondered what fraction of games could be won. The combinatorics were hopeless. It would be far easier, he realised, to deal out a hundred games and simply count.