# Category: Numerical (Approximate) Integration

## Left Endpoint, Right Endpoint and Midpoint Rules

There are two possible situation when we need numerical approximation (rule):

1. To calculate ${\int_{{a}}^{{b}}}{f{{\left({x}\right)}}}{d}{x}$ we need to know antiderivative of ${f{{\left({x}\right)}}}$. In some cases, it is difficult, or even impossible to find antiderivative. For example, ${\int_{{1}}^{{3}}}\frac{{{\sin{{\left({x}\right)}}}}}{{x}}{d}{x}$ and ${\int_{{1}}^{{2}}}\sqrt{{{{u}}^{{3}}+{1}}}{d}{u}$ can't be found exactly.
2. The function is determined from a scientific experiment through instrument readings or collected data. There may be no formula for the function.

Actually we already made approximations when we introduced Definite Integral. We approximated area under curve by dividing interval into ${n}$ subintervals, where i-th subinterval is ${\left[{x}_{{{i}-{1}}},{x}_{{i}}\right]}$ and calculate sum of areas of ${n}$ rectangles. Then we said that when ${n}\to\infty$ then sum of areas of those rectangles is ${\int_{{a}}^{{b}}}{f{{\left({x}\right)}}}{d}{x}$ :

## Trapezoidal Rule

We will obtain the trapezoidal rule (approximation) from averaging the right and left endpoint approximations: ${\int_{{a}}^{{b}}}{f{{\left({x}\right)}}}{d}{x}\approx\frac{{1}}{{2}}{\left({L}_{{n}}+{R}_{{n}}\right)}=\frac{{1}}{{2}}{\left({\sum_{{{i}={1}}}^{{n}}}{f{{\left({x}_{{{i}-{1}}}\right)}}}\Delta{x}+{\sum_{{{i}={1}}}^{{n}}}{f{{\left({x}_{{i}}\right)}}}\Delta{x}\right)}$.

## Simpson's Rule

An idea of the Simpson's rule is in following: approximate curve by parabola and then find area of parabola (it is easy to do because we know antiderivative of quadratic function).

Again we divide ${\left[{a},{b}\right]}$ into ${n}$ subintervals of equal length $\Delta{x}=\frac{{{b}-{a}}}{{n}}$, and also require ${n}$ to be even number.