Database › Mathematics › Applied mathematics › Numerical analysis
Numerical integration replaces the integrand by interpolating polynomials: the trapezoidal rule has error O(h²), Simpson's rule O(h⁴), and Gaussian quadrature with n optimally placed points is exact for polynomials of degree 2n − 1.
Explanation
The trapezoidal rule integrates straight segments; Simpson's rule fits parabolas through pairs of intervals ($N$ even) and, by symmetry, is exact for cubics. Combining trapezoidal results at $h$ and $h/2$ to cancel the $h^2$ error (Richardson extrapolation) reproduces Simpson's rule and leads to Romberg integration. For smooth periodic functions over a full period the trapezoidal rule converges exponentially.
Gauss–Legendre quadrature chooses the nodes as roots of $P_n$ and gains twice the polynomial degree for the same number of evaluations. In many dimensions Monte Carlo integration, with error $\propto N^{-1/2}$ independent of dimension, wins.
Example 1
Estimate $\int_0^1e^x\,dx$ with $h=0.5$ by the trapezoidal and Simpson rules, and compare with $e-1=1.718282$.
Solution
$f=1,\ 1.648721,\ 2.718282$. Trapezoid $0.5(0.5+1.648721+1.359141)=1.7539$ (error $+0.036$); Simpson $\frac{0.5}3(1+6.594885+2.718282)=1.71886$ (error $+0.0006$).
Example 2
Show that the two-point Gauss rule $\int_{-1}^1f\,dx\approx f(-\frac1{\sqrt3})+f(\frac1{\sqrt3})$ is exact for cubics.
Solution
For $1,x,x^2,x^3$ the exact integrals are $2,0,\frac23,0$; the rule gives $2$, $0$, $\frac13+\frac13=\frac23$, $0$. By linearity every cubic is exact.