Sonin's identity The following identity attributed to N.Y. Sonin states the following:
Suppose $f\in C^2[a,b]$. Let $\rho(x)=\frac12-\{x\}$, where $\{x\}$ is the fractional part of $x$, and $\sigma(x)=\int^x_0\rho(t)\,dt$. Then
$$
\sum_{a< n\leq b}f(n)=\int^b_a f(t)\,dt +\rho(b-)f(b)-\rho(a)f(a)-\big(\sigma(b)f'(b)-\sigma(a)f'(a)\big) +\int^b_a\sigma(t)\,f''(t)\,dt
$$
where summation runs over all integers between $a$ and $b$.
This looks like integration by parts and Abel summation kind of thing. I tried to apply Riemann-Stieltjes formula directly but this did not quite work. Hints (or a sketch of proof) would be appreciated.
 A: Here is another approach to this identity:

*

*First, notice that $\rho$ is a $1$-periodic function, and that $\rho'(t)=-1$ for $x\in [k,k-1)$, $k\in\mathbb{Z}$. For $k\leq \alpha<b\leq k+1$, use integration by parts twice (once with $u=f(t)$ and $dv=\rho'(t)\,dt$; and another with
$u=f'(t)$ and $dv=\sigma'(t)\,dt=\rho(t)\,dt$) to get

$$
\begin{align}
-\int^\beta_\alpha f(t)\,dt &= \int^\beta_\alpha f(t)\rho'(t)\,dt\\
&=\rho(\beta-)f(\beta)-\rho(\alpha)f(\alpha)-\int^\beta_\alpha \rho(t)\,f'(t)\,dt\\
&=\rho(\beta-)f(\beta)-\rho(\alpha)f(\alpha)-\big(\sigma(\beta)f'(\beta)-\sigma(\alpha)f(\alpha)-\int^\beta_\alpha \sigma(t)\,f''(t)\,dt\big)
\end{align}
$$
The use of a left limit in $\rho(\beta-)$ comes form Lebesgue's integration by parts formula.

*

*Applying this formula to each subintervals $[k,k+1]\subset(a,b]$ with $k\in\mathbb{Z}$, and the potentially the fractional intervals $(a,\lfloor a\rfloor +1]$, and $[\lfloor b\rfloor,b]$, and

*adding   over integer intervals and then the potentially fractional intervals the desired result will follow. (Some terms will vanish in the integer interval cases).


A: \begin{align}
\int_a^b \sigma(t) f''(t) \, dt &= [\sigma(t) f'(t)]_a^b - \int_a^b \rho(t) f'(t) \, dt \\&= [\sigma(t) f'(t)]_a^b - [\rho(t) f'(t)]_{a+}^{b-} + \int_{(a,b)} f(t) \, d\rho(t) .
\end{align}
Also if $a < x < b$, then
$$ \lfloor x\rfloor = - \lfloor a \rfloor + \sum_{a<n<b} H(x-n) $$
where
$$ H(x) = I_{x \ge 0} .$$
So
$$ \rho(t) = \tfrac12 - x + \lfloor x\rfloor = \tfrac12 - \lfloor a \rfloor - x + \sum_{a < n < b} H(x-n). $$
Finally, if $a<n<b$, then
$$ \int_a^b f(t) \, dH(t-n) = f(n) .$$
