How does the trapezoidal rule work?