Calculating a difficult integral For $p>0$, let
$g(x)=\begin{cases}
p\left[\dfrac{x}{p}\right]+\dfrac{p}{2}& x\ge 0,\\
-g(-x)& x<0
\end{cases}$
Try to prove that for all $x \in \mathbb{R}$
$\dfrac{p}{2\pi}\displaystyle\int_{-\infty}^{+\infty}\displaystyle\sum_{n=-[x/p]}^{[x/p]}\dfrac{\sin{\left(n+\dfrac{1}{2}\right)pt}}{\sin{\dfrac{1}{2}pt}}\cdot\dfrac{\sin{xt}}{t}dt=\dfrac{1}{2}[g(x^{+})+g(x^{-})]$.
I can usually solve similar integrals, but I cannot find the solution to this one. Your help would be appreciated. Thank you. 
 A: As an example of how to tackle the integration, take the case $x\ge0$ (note it is stated that $p>0$). I will assume that $[x]$ denotes the floor function; out of personal preference I'll use $\lfloor x \rfloor$. Most of the terms in the trigonometric sum will cancel; note:
$\displaystyle\sum _{n=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}{\frac {\sin \left(  \left( n+1/2
 \right) pt \right) }{\sin \left( 1/2\,pt \right) }}=-\sum _{n=1}^{\lfloor x/p \rfloor}{\frac {\sin \left(  \left( n-1/2 \right) pt \right) }{\sin \left( 1/2\,pt\right) }}+\sum _{n=0}^{\lfloor x/p \rfloor}{\frac {\sin \left(  \left( n+1/2 \right) pt \right) }{\sin \left( 1/2\,pt \right) }}$
$=\displaystyle-\sum _{n=0}^{\lfloor x/p \rfloor-1}{\frac {\sin \left(  \left( n+1/2 \right) pt \right) }{\sin \left( 1/2\,pt\right) }}+\sum _{n=0}^{\lfloor x/p \rfloor}{\frac {\sin \left(  \left( n+1/2 \right) pt \right) }{\sin \left( 1/2\,pt \right) }}={\frac {\sin \left(  \left( \lfloor x/p \rfloor+1/2
 \right) pt \right) }{\sin \left( 1/2\,pt \right) }}$.
Recognising this as a Dirichlet Kernel we write it as a sum of exponentials:
$\displaystyle{\frac {\sin \left(  \left( \lfloor x/p \rfloor+1/2
 \right) pt \right) }{\sin \left( 1/2\,pt \right) }}=\sum _{k=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}{{\rm e}^{-ikpt}}$,
proof: sum the right hand side as a geometric series.
The integral can then be rewritten as:
$\dfrac{p}{2\pi}\displaystyle\int_{-\infty}^{+\infty}\displaystyle\sum_{n=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}\dfrac{\sin{\left(n+\dfrac{1}{2}\right)pt}}{\sin{\dfrac{1}{2}pt}}\cdot\dfrac{\sin{xt}}{t}dt=\dfrac{p}{2}\sum _{k=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}\displaystyle\dfrac{1}{\pi}\int_{-\infty}^{+\infty}\dfrac{\sin{xt}}{t}{{\rm e}^{-ikpt}}dt$.
The Fourier transform of a $\mathbb{sinc}$ function is a $\mathbb{rect}$ function:
$\displaystyle\dfrac{1}{\pi}\int_{-\infty}^{+\infty}\dfrac{\sin{\pi t}}{\pi t}{{\rm e}^{-i2\pi ft}}dt=\cases{1&$ \left| f \right| <1/2$\cr 1/2&$ \left| f \right| =1/2$\cr 0&$ \left| f \right| >1/2$\cr}
$
proof: inverse Fourier transform the right hand side,
and so it follows from $t\rightarrow tx/\pi$, $f\rightarrow kp/(2x)$ that:
$\displaystyle\dfrac{1}{\pi}\int_{-\infty}^{+\infty}\dfrac{\sin{xt}}{t}{{\rm e}^{-ikpt}}dt=\cases{1&$ \left| k \right| <x/p$\cr 1/2&$ \left| k \right| =x/p$\cr 0&$ \left| k \right| >x/p$\cr}
$.
The integral then becomes:
$\dfrac{p}{2\pi}\displaystyle\int_{-\infty}^{+\infty}\displaystyle\sum_{n=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}\dfrac{\sin{\left(n+\dfrac{1}{2}\right)pt}}{\sin{\dfrac{1}{2}pt}}\cdot\dfrac{\sin{xt}}{t}dt=\dfrac{p}{2}\sum _{k=-\lfloor x/p \rfloor}^{\lfloor x/p \rfloor}\cases{1&$ \left| k \right| <x/p$\cr 1/2&$ \left| k \right| =x/p$\cr 0&$ \left| k \right| >x/p$\cr}$,
$\displaystyle=
\cases{p/2+p\lfloor x/p \rfloor&$x\notin \mathbb{Z}$\cr x&$ x \in \mathbb{Z}$\cr}=\dfrac{p}{2}\left(\lfloor x/p \rfloor-\lfloor -x/p \rfloor\right),x\ge0$,
where we used:
$\displaystyle \lfloor -x\rfloor=
\cases{-1-\lfloor x\rfloor&$x\notin \mathbb{Z}$\cr -x&$ x \in \mathbb{Z}$\cr},x\ge 0$.
Similar integration methods would work for $x<0$ provided we clarify what we mean by:
$\displaystyle\sum_{n=N}^{-N}$, for $N>0$.
So... is:
$\dfrac{p}{2}\left(\lfloor x/p \rfloor-\lfloor -x/p \rfloor\right)$,
the same thing as: 
$\dfrac{1}{2}[g(x^{+})+g(x^{-})]$ for $x\ge 0$?
