Summation coincides with integration? Let $a,b \in \mathbb{N}$ such that $a<b$.
Then let $f:[a,b]\rightarrow \mathbb{R}$ be a continuous function on the interval $[a,b]$.
Under what conditions the following property is satisfied :
$$\sum^{b}_{k=a} f(k) = \int^{b}_{a}f(t)dt$$
 A: I will be very surprised if there is an easy and useful criterion for this. Indeed, for any continuous function $f$, we can always modify $f$ on a small interval avoiding integer points such that the equality becomes true.
But if $a = -\infty$ and/or $b=+\infty$ are allowed, here are some striking examples:

*

*Defining $\operatorname{sinc}(x) = \frac{\sin x}{x}$ with $\operatorname{sinc}(0) = 1$, then $\operatorname{sinc}(\cdot)$ is continuous on all of $\mathbb{R}$ and
$$\sum_{n=-\infty}^{\infty} \operatorname{sinc}(n) = \pi = \int_{-\infty}^{\infty} \operatorname{sinc}(x) \, \mathrm{d}x. $$
(This is @Ty.'s example.)


*Extending the factorial to non-integral arguments by letting $x! = \Gamma(x+1)$ and defining the binomial coefficients accordingly, we have
$$\sum_{n=-\infty}^{\infty} \binom{\alpha}{n} = 2^{\alpha} = \int_{-\infty}^{\infty} \binom{\alpha}{x} \, \mathrm{d}x $$
for any $\alpha \geq 0$.
A: By the Euler-Maclaurin formula,
$$  \sum_{i=m}^n f(i) =
    \int^n_m f(x)\,\mathrm{d}x + \frac{f(n) + f(m)}{2} +
    \sum_{k=1}^{\lfloor p/2\rfloor} \frac{B_{2k}}{(2k)!} \left( f^{(2k - 1)}(n) - f^{(2k - 1)}(m) \right) - (-1)^{p} \int_m^n f^{(p)}(x)\frac{P_p(x)}{p!} \,\mathrm{d}x$$
where

*

*$m$ and $n$ are natural numbers (per  ISO 80000-2, the nonnegative integers),

*$p$ is a positive integer,

*$f$ is a $p$-times continuously differentiable on $[m,n]$ function that is either real-valued or complex-valued,

*$B_{2k}$ are Bernoulli numbers (There are two conventions for Bernoulli numbers.  Since we only use the even index Bernoulli numbers, the two conventions coincide.), and

*and $P_p$ is a periodized Bernoulli polynomial.

So, for such a collection of $f$, $m$, $n$, and $p$, the answer to your question is "When everything after the first '$+$' happens to be zero (taken together)."
For instance, of $f$ is once continuously differentiable on $[m,n]$, then we may take $p = 1$ and obtain
\begin{align*}
\sum_{i=m}^n f(i) &- \int^n_m f(x)\,\mathrm{d}x  \\
    &= \frac{f(m) + f(n)}{2} + \int_m^n f'(x) P_1(x) \,\mathrm{d}x  \\
    &= \frac{f(m) + f(n)}{2} + \int_m^n f'(x) B_1(x - \lfloor x \rfloor) \,\mathrm{d}x  \\
    &= \frac{f(m) + f(n)}{2} + \int_m^n f'(x) \left( (x - \lfloor x \rfloor) - \frac{1}{2} \right) \,\mathrm{d}x
\end{align*}
and all we require is that the object on the right is $0$.
We can get an immediately example : $f(x) = x$ for $m = -n$.  The first term is zero (because of the symmetric choice of $m$ and $n$) and the integral is zero because $f'(x) = 1$ and the integral of $P_1(x)$ is zero on $[j,j+1]$ for any integer $j$.  By a similar argument, $f(x) = -x$ for a similar choice of $m$.
Since $P_1$ is periodic, we should be able to find a periodic $f'$ that works.  For instance, $f'(x) = \sin^2(2\pi x)$ makes the integral zero (again by making it zero on every $[j,j+1]$ for any integer $j$).  Then we need to select $C$, $m$ and $n$ such that
$$  f(x) = \int \sin^2(2\pi x) \,\mathrm{d}x = \frac{x}{2} - \frac{\sin(4\pi x)}{8\pi} + C  $$
gives zero in the first term.  A choice is $m = -n$ and $C = 0$, but there are others, for instance any $C$, $m$, and $n$ satisfying $m+4C+n = 0$ work.  (So here are infinitely many examples of the sum and the integral being equal for this one choice of $f'$.)
If we keep playing around with periodic $f$s that make the integral zero and finding resulting constraints on the constant of integration (to go from $f'$ to $f$) and $m$ and $n$, we could find many more infinite families of examples.
We could then start tailoring non-periodic $f'$s that still make the integral zero and then solve for $m$, $n$ and constant of integration triples that make the sum equal the integral.
A: A necessary condition valid just for an always positive function is that it has to be not decreasing.
Indeed, If this happens :
$$\:\forall n \in [a,b]  :f(n)>\int_n^{n+1}f(x)dx \implies \sum_{k=a}^{b} f(k) > \int_a^{b+1}f(x)dx > \int_a^bf(x)dx$$
An equivalent condition can be stated for an always negative function.
