Numerical Methods  

Numerical IntegrationIn this chapter we treat the numerical evaluation of definite integrals, \[ \begin{equation} I(f) = \int_{c}^{d} dx f(x). \end{equation} \]Numerical methods are used when
In the second and third case usually one employs quadrature formulas. They will be discussed in detail from chapter 6.2. onwards. Numerical integration of point wise integrandsLet us assume we know the function $f(x)$ to be integrated only on $n$ sampling points: \[ \begin{equation} [x_{i} \mid f(x_{i})] \qquad \mbox{for} \qquad i=1,\ldots,n. \end{equation} \]To simplify the problem we assume that the first and last sampling point $x_{1}$ and $x_{n}$ represent the integration limits. In this case we can replace $f(x)$ with the corresponding interpolation curve. \[ \begin{equation} \int_{x_{1}}^{x_{n}} dx f(x) \approx \int_{x_{1}}^{x_{n}} dx I(x) \end{equation} \]For a linear interpolation, the integral is the sum of the areas of trapezoids. The integration routine that sums the areas of these trapezoids is called the trapezoidal rule and is quite simple. For a cubic spline, $I(x)$: \[ \begin{equation} \int_{x_{1}}^{x_{n}} dx f(x) \approx \int_{x_{1}}^{x_{n}} dx I(x) = \sum_{i=1}^{n1} \int_{x_{i}}^{x_{i+1}} dx P^{i}(x) \end{equation} \] \[ \begin{equation} = \sum_{i=1}^{n1} \int_{x_{i}}^{x_{i+1}} dx \left[ a_{i} + b_{i}(xx_{i})+c_{i}(xx_{i})^{2}+d_{i}(xx_{i})^{3} \right]. \end{equation} \]We can easily evaluate these integrals analytically and obtain \[ \begin{equation}\label{qua1} \int_{x_{1}}^{x_{n}} dx f(x) \approx \sum_{i=1}^{n1} \left[ a_{i}(x_{i+1}x_{i}) +\frac{b_{i}}{2}(x_{i+1}x_{i})^{2} + \frac{c_{i}}{3} (x_{i+1}x_{i})^{3} + \frac{d_{i}}{4} (x_{i+1}x_{i})^{4} \right] \quad . \end{equation} \]Using a cubic spline as the interpolation function results in Simpson's rule. 