Section 13.1 Riemann sums
Numerical integration problem amounts to the following: we have a function \(f\) on some interval \([a,b]\text{,}\) and we try to compute \(\int_a^b f(x)\,dx\) based on evaluating \(f\) at some points of this interval. To begin with, recall that by definition, \(\int_a^b f(x)\,dx\) is the limit of Riemann sums of \(f\text{.}\) The process of computing a Riemann sum is as follows.
- Divide \([a,b]\) into subintervals. It can be divided into \(n\) subintervals by choosing some points \(x_0 \lt x_1 \lt x_2 \lt \cdots \lt x_n\) so that \(x_0=a\) and \(x_n=b\text{.}\) The subintervals are \(I_k = [x_{k-1},x_k]\) where \(k=1, 2, \dots, n\)
- Evaluate \(f\) at some point \(s_k\) (a sample point) of each subinterval \(I_k\text{.}\)
- Compute the sum of the products \(f(s_k)(x_k-x_{k-1})\) for \(k=1,\dots,n\text{.}\) This is the Riemann sum:\begin{equation*} S = \sum_{k=1}^n f(s_k)(x_k-x_{k-1}) \end{equation*}
Therefore, a basic strategy of numeric integration consists of choosing subintervals and then choosing a point in each.
The simplest choice of subintervals is to have subintervals of equal length, meaning each has length \(h=(b-a)/n\text{,}\) which makes \(x_k = a + kh\text{.}\) We will eventually see that this choice is not as good as it seems, but it will do for now.