Numerical Integration Part 1
Provide a good numerical approximation for
\[\int_a^b f(x)\;dx\]
What do we want?
Small method error
We want the result to be as close to the actual value of the integral as possible.
Small rounding error
We do not want to do too many operations, so the rounding errors will not accumulate too much.
When do we want it?
Soon!
Limit the number of function evaluations.
\[p(x) = \sum_{i = 0}^n f(x_i)\ell_i(x)\]
Then
\[\int_a^b p(x)\;dx = \int_a^b \sum_{i = 0}^n f(x_i)\ell_i(x)\;dx = \sum_{i = 0}^n f(x_i)\int_a^b \ell_i(x)\;dx.\]
Define \(\displaystyle w_i = \int_a^b \ell_i(x)\;dx.\)
Then \(\displaystyle \int_a^b p(x)\;dx = \sum_{i=0}^n w_if(x_i).\)
Different choices of \(x_i\)s give different methods.
Theorem: Let \(x_0, x_1, \dots, x_n\) be distinct numbers in the interval \([a,b]\), and let \(f\in \mathcal{C}^{n+1}([a,b])\). Let \(p\) be the unique polynomial of degree at most \(n\) that interpolates the data \(\{(x_i, f(x_i))\mid i = 0, 1, \dots, n\}\). Then for each \(x \in [a,b]\), there is a \(\xi \in (a,b)\) such that \[f(x) - p(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!}\prod_{i=0}^n (x - x_i).\]
Then
\[\int_a^b f(x)\;dx - \int_a^b p(x)\;dx = \frac{1}{(n+1)!}\int_a^b {f^{(n+1)}(\xi(x))}\prod_{i=0}^n (x - x_i)\;dx.\]
Suppose \(\color{red}{f\in \mathcal{C}([a,b])}\), \(g\) is Riemann integrable on \([a,b]\), and \(g\) does not change sign on \((a,b)\). Then there exists \(\xi \in (a,b)\) such that \[\int_a^b f(x)g(x)\;dx = f(\xi)\int_a^b g(x)\;dx.\]
\[\ell_0(x) = \frac{x-x_1}{x_0 - x_1} \qquad \text{ and } \qquad \ell_1(x) = \frac{x-x_0}{x_1 - x_0}\]
\[\text{error} = \frac{1}{2}\int_a^b {\color{red}{f''(\xi(x))}}(x-x_0)(x-x_1)\;dx\]
\[\phantom{\text{error}} = \frac{1}{2}f''(\xi)\int_a^b (x-x_0)(x-x_1)\;dx\]
\[\ell_0(x) = \frac{(x-x_1)(x-x_2)}{(x_0 - x_1)(x_0-x_2)}, \quad \ell_1(x) = \frac{(x-x_0)(x-x_2)}{(x_1 - x_0)(x_1-x_2)}, \quad \text{ and } \qquad \ell_1(x) = \frac{(x-x_0)(x-x_1)}{(x_2 - x_0)(x_2 - x_1)}\]
\[\text{error} = \frac{1}{6}\int_a^b {{f'''(\xi(x))}}(x-x_0)(x-x_1)(x-x_2)\;dx\]