Section 15.1 Motivation: search for better evaluation points
What is the most accurate approximation to \(\int_{-1}^1 f(x)\,dx\) using two points of evaluations? So far we saw the trapezoidal rule, which is \(\int_{-1}^1 f(x)\,dx\approx f(-1)+f(1)\text{.}\) For example, if \(f(x)=e^x\) we have \(\int_{-1}^1 f(x)\,dx = 2.3504\) while \(f(-1)+f(1) = 3.0862\text{,}\) so the rule makes a significant error, overestimating the integral by \(0.7358\text{.}\) The concavity of the function is responsible for this error.
It turns out there is a much more accurate two-point integration rule:
For the exponential function it gives \(2.3427\text{,}\) the error of only 0.0077. This is about 100 times more accurate than the trapezoidal rule, with the same number of function evaluations.
Where does \(1/\sqrt{3}\) come from? It will take some time to develop a general theory leading to this choice, but a quick way to justify it is to consider small powers of \(x\text{:}\)
- If \(f(x)=x^0\text{,}\) then \(\int_{-1}^1 x^0\,dx = 2 = f(x_1)+f(x_2)\) holds for any choice of points \(x_1, x_2\)
- If \(f(x)=x^1\text{,}\) then \(\int_{-1}^1 x^1\,dx = 0 = f(x_1)+f(x_2)\) holds whenever the points are symmetric about 0, meaning that \(x_2=-x_1\text{.}\)
- If \(f(x)=x^2\text{,}\) then \(\int_{-1}^1 x^2\,dx = 2/3\) and \(f(x_1)+f(x_2) = 2x_1^2\text{.}\) The two things are equal when \(x_1=1/\sqrt{3}\text{.}\)
As a bonus, the rule is also accurate for \(f(x)=x^3\text{,}\) by virtue of symmetry, so its order of accuracy is 4.
There is a general method of choosing evaluation points \(x_1,\dots,x_n\) in an optimal way: they will be the roots of some special \(n\)-th degree polynomial. This method is called Gaussian integration and it is built into TI-83 calculators and many software packages, including Matlab (quadgk
command). But before we get to actual integration, we have to study the orthogonal polynomials themselves. The process of using them for integration will be covered in next chapter.