# Integration ## Newton-Cotes methods A related problem to interpolation is when we need to calculate the integral of a function $$I = \int_{x_1}^{x_N} f(x) dx$$ given values of the function at a discrete set of points $x_1\dots x_N$, which we'll write as $f_i\equiv f(x_i)$. For simplicity here we'll assume that the spacing between points on the grid is constant $x_{i+1}-x_i = \Delta x$, but it's straighforward to generalize to non-uniform sampling if you need to. To estimate the value of the integral, we need to model how the function behaves in each interval $x_i