# List of Notes - Category: Numerical (Approximate) Integration

## Left Endpoint, Right Endpoint and Midpoint Rules

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

- To calculate `int_a^bf(x)dx` we need to know antiderivative of `f(x)`. In some cases, it is difficult, or even impossible to find antiderivative. For example, `int_1^3 (sin(x))/xdx` and `int_1^2 sqrt(u^3+1)du` can't be found exactly.
- 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 `[x_(i-1),x_i]` and calculate sum of areas of `n` rectangles. Then we said that when `n->oo` then sum of areas of those rectangles is `int_a^bf(x)dx` :

## Trapezoidal Rule

We will obtain Trapezoidal rule (approximation) from averaging Right and Left Endpoint approximations: `int_a^bf(x)dx~~1/2(L_n+R_n)=1/2(sum_(i=1)^nf(x_(i-1))Delta x+sum_(i=1)^nf(x_i)Delta x)` .

Rewriting it we obtain Trapezoidal Rule: `int_a^bf(x)dx~~T_n=(Delta x)/2(f(x_0)+2f(x_1)+2f(x_2)+...+2f(x_(n-1))+f(x_n))`.

## Simpson's Rule

Idea of 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 `[a,b]` into `n` subintervals of equal length `Delta x=(b-a)/n`, and also require `n` to be even number.