"If we're trying to integrate a function $f(x)$ from $x=a$ to $x=b$, and we sample $f(x)$ to $n+1$ times (inclusive, in what's known as the closed form) in the interval, we can express the integral as\n",

"\n",

"$$\n",

"\\int_a^b f(x)dx \\Sigma_{i=0}^n w_i f_i\n",

"\\int_a^b f(x)dx = \\Sigma_{i=0}^n w_i f_i\n",

"$$\n",

"\n",

"with $f_i$ indicating $f(x_i)$. Several of the approaches we used earlier involve applying this to the multiple intervals found in our sampled data. Here are some formulas for a the contribution from a particular interval or set of intervals. If implementing them, as you break your sample up into the appropriate groups of intervals, you need to be sure add the weights correctly for points that are on the right of one region and the left of another. For example, when we add all our segments together only the boundary points are weighted by 0.5 in the trapezoidal method, and odd internal points have double the weighting in Simpson's method.\n",