Elio Saade
Note

Trapezoidal Rule

Topics: Numerical Methods

The Trapezoidal Rule is a numerical integration technique used to approximate the value of an indefinite integral or the area under a curve.

It consists of dividing the full integration interval [a,b][a,b] into sub-intervals, connecting the top points of each interval and summing the areas of the obtained trapezoids.

The sub-intervals do not have to be equal. In this case, the general formula is
∫abf(x)dx≈∑k=1Nf(xk−1)+f(xk)2  Δx\int_a^b f(x) dx \approx \sum_{k=1}^N \frac{f(x_{k-1})+f(x_k)}{2} \; \Delta x
In the case of equal spacing, the formula can be simplified:
∫abf(x)dx≈Δx[f(x0)+f(xN)2+∑k=1N−1f(xk)]\int_a^b f(x)dx \approx \Delta x \Bigg[ \frac{f(x_0) + f(x_N)}{2} + \sum_{k=1}^{N-1}f(x_k) \Bigg]
For a running integral, the trapezoidal formula is
In=In−1+h2[f(xn−1)+f(xn)]I_n = I_{n-1} + \frac{h}{2} \Big[f(x_{n-1}) + f(x_n) \Big]

References

Connections

Direct relationships to this note.