I am trying to understand why the presence for the $x-\lfloor x\rfloor -\frac{1}{2}$ is needed in the Euler Maclaurin summation formula. I have curated three different sources for the formula's derivation. I came across three different types of explanations. None of these sources has to do with deriving it from the perspective of Bernoulli polynomials, but instead stem from numerical analysis side of things. Each of the derivations are from books and I have typed out the relevant section as well as provided a url link for them.
In the book Statistical Physics for students of science and Engineering by Reed and Roy, pp.33-34, under "Euler Maclaurin summation" in search box, his presentation goes as follows:
Let $f(x)$ denote the function any function which is defined over some interval for $x\geq 0,$ and which has continuous derivatives existing up to an arbitrary order over this interval. For such a function we have
$f(p)-f(n)=\int_{n}^{p} f'(x)dx. $ $(n=0,1,\dots,p) $ $(*)$
where $f'(x)$ is the first derivative of the function. By simple addition of $(*)$ takes the form $(p+1)f(p)- \sum_{n=0}^{p} f(n)=\sum_{n=0}^{p} \int_{n}^{p} f'(x)dx. $ $(**)$ If we now split up each integral in the sum $(**)$ into a sum of integrals of the form $\int_{0}^{p} = \int_{0}^{1} + \int_{1}^{2} + \int_{2}^{3} + \dots \int_{p-1}^{p}$ $(***)$
where we have suppressed the argument $f'(x)dx$ of each integral. we find that the r.h.s of $(**)$ can be written as $\sum_{n=0}^{p} \int_{n}^{p} f'(x)dx = 1 \int_{0}^{1} + 2 \int_{1}^{2} + 3 \int_{2}^{3} + \dots p \int_{p-1}^{p} = \sum_{k=0}^{p-1} (k+1) \int_{k}^{k+1} f'(x)dx$ $(****)$
The sum of the integral on the r.h.s $(****)$ can be recognized as the following integral in terms of the truncated function $\lfloor x\rfloor$, which denotes the algebraically largest integer which does not exceed $x$,
$\sum_{k=0}^{p-1} (k+1) \int_{k}^{k+1} f'(x)dx=\int_{0}^{p} (\lfloor x\rfloor + 1)f'(x)dx$.$(*****)$
If we now introduce a new function $\phi(x)$ by means of $\lfloor x\rfloor + 1 = \phi(x) + x + \frac{1}{2}$ $(******)$ and combine $(**)$ and $(****)$ through $(******)$, we can find that we can express the sum of $\sum_{n=0}^{p} f_{n} = f_{0} +f_{1} + \dots + f_{p} = (p+1)f(p)- \int_{0}^{p} (\phi(x) + x + \frac{1}{2})f'(x)dx...$ after some algebraic manipulation and integration by parts steps, the authors arrives at the Euler Maclaurin Summation formula.
Question 1: I don't understand how Reed and Roy go from steps $(****)$ to $(*****)$, how did they went from $k+1$ to $\lfloor x\rfloor + 1$ and then to $(******)$ where they get the $\phi(x) + x + \frac{1}{2}$ function.
In deriving the E-U formula from the trapezoid rule for numerical integration, as presented in the text Applied Discrete Structure by K.D.Joshi, pp.317-318, under "Euler Maclaurin summation" in search box,. he give an explanations as to why the function $x-\lfloor x\rfloor -\frac{1}{2}$ is needed:
Because our ultimate interest is in establishing sums of the form $\sum_{k=1}^{n}f(k)$ in terms of $\int_{1}^{n} f(x,)dx$ and the latter equals $\sum_{k=1}^{n-1} \int_{k}^{k+1} f(x)dx,$ we may confine ourselves to the case where $[a,b]$ is of the form $[k,k+1],$ where $k$ is a positive integer. Now suppose we have a function $\psi_{1}$ which is differentiable on $[k,k+1],$ and for which $\psi_{1}(k)=-\frac{1}{2}$ and $\psi_{1}(k+1)=\frac{1}{2}.$ Then $\frac{1}{2}(f(k)+f(k+1).$ which is the area of the trapezium, is precisely $f(k+1)\psi_{1}(k+1) - f(k) \psi_{1}(k).$ If further we choose $\psi_{1}$ such that $\psi'_{1}(x)=1$ for $x \in [k,k+1].$ then $\int_{k}^{k+1}f(x)dx$ is the same as $\int_{k}^{k+1}f(x)\psi'_{1}(x)dx$ and integrating by parts, we get $\int_{k}^{k+1}f(x)dx- \frac{1}{2}[f(k)+f(k+1)]=-\int_{k}^{k+1}f'(x)\psi_{1}(x)dx.$ $(1)$
This give us an expression for the error in the trapezoidal approximation, in terms of a definite integral. The function $\psi_{1}$ is uniquely determined by its derivative (which is identically 1) and its value at $k$ (which is $-\frac{1}{2}$). In fact $\psi_{1}(x)=x-k-\frac{1}{2}$ for $x\in [k,k+1].$ If we can now let $k$ vary, we encounter a minor difficulty. The functions $\psi_{1}$ for two adjacent intervals, say $[i,i+1]$ and $[i+1,i+2]$, will not have the same values at their common point $i+1.$ To correct this difficulty, we define $\psi_{1}(x)=x-k-\frac{1}{2}$ for $x\in [k,k+1),$ or equivalently, $\psi_{1}(x)=x-\lfloor x \rfloor - \frac{1}{2}$ for all $x \in \mathbb{R}.$ Then $\psi_{1}$ is a periodic function which is continuous everywhere except at integers. The graph of $\psi_{1}$ remains unaffected by this change because $\lim_{x\rightarrow k^{+}} \psi_{1}(x)=-\frac{1}{2}.$ $\lim_{x\rightarrow (k+1)^{-}} \psi_{1}(x)=\frac{1}{2},$ and $\psi'_{1}(x)=1$ for all $x\in (k,k+1)$ still hold.
Question 2 To deal with the overlapping point $i+1$ between the two intervals $[i, i+i]$ and $[i+1, i+2]$ where the function $\psi_{1}$ will not have the same value, the presence of the sawtooth function $\psi_{1}=x-\lfloor x \rfloor - \frac{1}{2}$ is needed for such correction, and it so happens that $\psi_{1}=x-\lfloor x \rfloor - \frac{1}{2}$ is continuous only at the integers. I am not sure how or why such property is relevant or important. Also, how is this related to Question 1 above. I am guessing it might have to do with either one of the following two similar properties of the greatest function:
"$\lfloor x + \frac{1}{2}\rfloor$ is the nearest integer to $x$. If two integers are equally near to $x$, it is the larger of the two. or
$-\lfloor -x + \frac{1}{2}\rfloor$ is the nearest integer to $x$. If two integers are equally near to $x$, it is the smaller of the two."
It seems that Reed and Roy never needed to take the same issues into consideration of when a function don't share the same value for an element common to two overlapping intervals at the point of his derivation where they introduced the function $\phi(x)$ by means of "$\lfloor x\rfloor + 1 = \phi(x) + x + \frac{1}{2}$." I have a feeling he does take into account, but i just am not seeing it.
Finally in the book Riemann Zeta Function by Harold M. Edwards, pp.98-99, under "Euler Maclaurin summation" in search box, he presented the formula with the explanations for the saw tooth function as follows:
Euler-Maclaurin summation is a method of computing the error in this approximation and in the analogous approximation $\sum_{n=M}^{N} f(n) ~ \int_{M}^{N} f(x)dx + \frac{1}{2}[f(M)+f(N)]$ $(1)$ for other sums.
The first step is to develop a closed formula for the error. Let $\lfloor x \rfloor$, denote as usual, the largest integer less than or equal to $x$. Then the function $\lfloor x \rfloor$ is a step function which has jumps of one at integers, so the Stieltjes measure $d(\lfloor x \rfloor)$ assigns the weight one to integers and is zero elsewhere. Hence
$\int_{M}^{N}f(M)d(\lfloor x \rfloor)=\frac{1}{2}f(M)+f(M+1)+f(M+2)+\dots +f(N-1)+\frac{1}{2}f(N)$
where the usual convention of counting half the weight at an end point is followed. Thus to make the approximation $(1)$ correct, the right side should be increased by $-\int_{M}^{N}f(x)dx+\int_{M}^{N}f(x)d(\lfloor x \rfloor)=\int_{M}^{N}f(x)d(\lfloor x \rfloor-x).$ It is more natural to describe the measure $d(\lfloor x \rfloor -x)$ as $d(\lfloor x \rfloor - x + \frac{1}{2})$ because the function $\lfloor x \rfloor - x + \frac{1}{2}$ is positive half the time and negative half the time, and because it is zero when $x$ is an integer (by the usual convention that at discontinuities the value is the average of the left-hand limit and the right hand limit).
Question 3: First I am not sure what a Stieltjes measure is but I do know what a Stieltjes integral is and so simple evaluation of Stieltjes integral. When Edwards states that "[I]t is more natural to describe the measure $d(\lfloor x \rfloor -x)$ as $d(\lfloor x \rfloor - x + \frac{1}{2})$ because the function $\lfloor x \rfloor - x + \frac{1}{2}$ is positive half the time and negative half the time, and because it is zero when $x$ is an integer." Is Edwards talking about what Joshi, from the second book quoted above, is discussing in terms of the points at which the function $\lfloor x \rfloor - x + \frac{1}{2}$ is continuous and also it's period compare to that with $\lfloor x \rfloor.$ Also, in brackets when Edwards says that "at discontinuities the value is the average of the left-hand limit and the right hand limit." Does he mean the same as when Joshi states: "Then $\psi_{1}$ is a periodic function which is continuous everywhere except at integers. The graph of $\psi_{1}$ remains unaffected by this change because $\lim_{x\rightarrow k^{+}} \psi_{1}(x)=-\frac{1}{2}.$ $\lim_{x\rightarrow (k+1)^{-}} \psi_{1}(x)=\frac{1}{2},$ and $\psi'_{1}(x)=1$ for all $x\in (k,k+1)$ still hold." when describing the left hand and right hand limits of the sawtooth function $\lfloor x \rfloor - x + \frac{1}{2}$
Thank you in advance.