Approximating sums using integrals