Numerical integration
Numerical integration
Given a weight function $w(x)\geq 0$, seek an approximation $$ \begin{align*} I(f) := \int_{a}^{b} f(x) \,w(x) \d x \approx \sum_{i=0}^n a_i f(x_i), \qquad f\in C[a,b]. \end{align*} $$
Given a weight function $w(x)\geq 0$, seek an approximation $$ \begin{align*} I(f) := \int_{a}^{b} f(x) \,w(x) \d x \approx \sum_{i=0}^n a_i f(x_i), \qquad f\in C[a,b]. \end{align*} $$
No quadrature rule with $(n+1)$ nodes is exact on $\mathcal{P}_{2n+2}$ for numerical integration.
Let a quadrature $\int_{a}^{b} f(x)ω(x) \d x \approx \sum_{i=0}^{n} a_i f(x_i)$ for numerical integration be exact on $\mathcal{P}_{n}$ (i.e. the interpolating formula).
Then it is exact on $\mathcal{P}_{2n+1}$ iff $x_0, \ldots, x_n$ are the $(n+1)$ distinct roots of an $n$-th orthogonal polynomial with respect to the inner product $\langle f,g\rangle = \int_{a}^{b} a(x)b(x)ω(x) \d x$.
Such a quadrature is called a Gaussian quadrature.
Suppose we want to estimate $\int_{a}^{b} f(x)ω(x) \d x \approx \sum_{i=0}^{n} a_i f(x_i)$ with accuracy $ε\ll 1$.
We could choose a Gaussian quadrature of high order, but computing roots of orthogonal polynomials is difficult.
Instead, split into many sub-intervals, and apply a simple quadrature on each sub-interval.
One can show that if a quadrature exact on $\mathcal{P}_n$ is applied with step size $h$, the total error is $O(h^{n+1})$ for $f\in C^{n+1}[a,b]$.