Source
Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree
Some integrals, like or , have no elementary antiderivative. Numerical integration approximates instead. The Trapezoidal Rule replaces the curve on each small subinterval by a straight line, so the area becomes a sum of trapeziums. Using parabolas instead gives the more accurate Simpson's Rule.
Setting Up
Split into equal subintervals:
The trapezium over has area . Adding them, every inside value is counted twice.
Formula
Coefficient pattern: . Any works.
Steps
Work through it in this order:
- Choose and compute
- Tabulate and for to
- Apply the formula
- If an exact value is known, relative error
Worked Example
with , :
| 0 | ||
| 1 | ||
| 2 | ||
| 3 | ||
| 4 |
Exact value , so the relative error is about . is slightly too big because is concave up, so each chord lies above the curve.
Second Example
with :
| 0 | ||
| 1 | ||
| 2 | ||
| 3 | ||
| 4 |
The Trapezoidal Rule is exact for linear functions.