# Closed form of $\int_{\frac{\pi}{4}}^{\frac{3\pi}{4}}\frac{\lfloor|\tan x|\rfloor}{|\tan x|}dx$?

I am trying to find a closed form for the integral $$I=\int_{\frac{\pi}{4}}^{\frac{3\pi}{4}}\frac{\lfloor|\tan x|\rfloor}{|\tan x|}dx$$ So far, my reasoning is thus: write, by symmetry through $x=\pi/2$, $$I=2\sum_{n=1}^{\infty}n\int_{\arctan n}^{\arctan (n+1)}\frac{dx}{|\tan x|}=2\sum_{n=1}^{\infty}n\ln\frac{\sin\arctan(n+1)}{\sin\arctan n}$$ Using $\sin{\arctan {x}}=\frac{x}{\sqrt{1+x^{2}}}$, we get: $$I=2\sum_{n=1}^{\infty}n\ln(\frac{(n+1)\sqrt{1+n^2}}{n\sqrt{1+(n+1)^2}})=\sum_{n=1}^{\infty}n\ln\frac{(n+1)^2(1+n^2)}{n^2(1+(n+1)^2)}=\sum_{n=1}^{\infty}n\ln(1+\frac{2n+1}{n^2(n+1)^2})$$ Expanding the logarithm into an infinite series we get $$I=\sum_{n=1}^{\infty}\sum_{m=1}^{\infty}\frac{(-1)^{m+1}(2n+1)^m}{mn^{2m-1}(n+1)^{2m}}$$ Here I am a bit stuck.. Does anyone have any suggestions to go further?

Thank you.

EDIT: keeping in mind the nice answer below, applying summation by parts to $$I_N=2\sum_{n=1}^{N}n\ln\frac{\sin\arctan(n+1)}{\sin\arctan n}=2\sum_{n=1}^{N}n(\ln\sin\arctan(n+1)-\ln\sin\arctan n)$$ gives $$I_N=2((N+1)\ln\sin\arctan(N+1)+\frac{\ln 2}{2}-\sum_{n=1}^{N}\ln\sin\arctan(n+1))$$ hence: $$I-\ln2=-\sum_{n=2}^{\infty}\ln\frac{n^2}{1+n^2}=\sum_{n=2}^{\infty}\ln\frac{1+n^2}{n^2}=\sum_{n=2}^\infty\sum_{m=1}^\infty\frac{(-1)^{m+1}}{mn^{2m}}= \sum_{m=1}^\infty\frac{(-1)^{m+1}}{m}\sum_{n=2}^\infty n^{-2m}=\sum_{m=1}^\infty\frac{(-1)^{m+1}(\zeta(2m)-1)}{m}$$

EDIT 2: Coming back to $$\sum_{n=2}^{\infty}\ln(1+\frac{1}{n^2})=\ln(\prod_{n=2}^{\infty}(1+\frac{1}{n^2}))=\ln(\prod_{n=2}^{\infty}(1-\frac{i^2}{n^2}))=\ln(\prod_{n=1}^{\infty}(1-\frac{i^2}{n^2}))-\ln2$$
$$=\ln(\frac{\sin(i\pi)}{i\pi})-\ln2=\ln\frac{\sinh\pi}{\pi}-\ln2$$ hence $I=\ln\frac{\sinh\pi}{\pi}$

• Here is an equivalent formulation of $I$, which suggests that an explicit formula might not exist: For every $n\geqslant1$, let $x_n=1+\frac1{n^2}$, then for every $N\geqslant1$, $$\sum_{n=1}^Nn\ln\frac{(n+1)^2(1+n^2)}{n^2(1+(n+1)^2)}=\sum_{n=1}^Nn{}{}{}{}{}{}\ln\frac{x_n}{x_{n+1}}=\sum_{n=1}^N\ln x_n-N\ln x_{N+1}$$ hence $$I=\sum_{n=1}^\infty\ln x_n=\ln\left(\prod_{n=1}^\infty\frac{n^2+1}{n^2}\right).$$ – Did May 14 '16 at 21:38
• Yes indeed, but i think this has a closed form (see edit 2) – Noe Blassel May 14 '16 at 21:54
• Indeed, I was unduly pessimistic: dlmf.nist.gov/4.36#E1 – Did May 14 '16 at 21:56

Maybe we are lucky. We may notice that: $$1+\frac{2n+1}{n^2(n+1)^2} = 1+\frac{1}{n^2}-\frac{1}{(n+1)^2}$$ and the roots of the polynomial $x^2(x+1)^2+2x+1$ are given by $$\alpha = \frac{1}{2}\left(-1-\sqrt{2}-\sqrt{2\sqrt{2}-1}\right),$$ $$\beta = \frac{1}{2}\left(-1-\sqrt{2}+\sqrt{2\sqrt{2}-1}\right),$$ $$\gamma = \frac{1}{2}\left(-1+\sqrt{2}-i\sqrt{2\sqrt{2}+1}\right),$$ $$\delta = \frac{1}{2}\left(-1+\sqrt{2}+i\sqrt{2\sqrt{2}+1}\right),$$ so: $$\sum_{n=1}^{N}\log\left(1+\frac{2n+1}{n^2(n+1)^2}\right)=\log\prod_{n=1}^{N}\frac{(n-\alpha)(n-\beta)(n-\gamma)(n-\delta)}{n^2(n+1)^2}$$ can be written in terms of: $$\log\prod_{n=1}^{N}\frac{n-\alpha}{n} = \log\frac{\Gamma(N+1-\alpha)}{\Gamma(N+1)\Gamma(1-\alpha)}$$ and through summation by parts the problem boils down to computing:

$$\sum_{N\geq 1}\log\frac{\Gamma(N+1-\alpha)\Gamma(N+1-\beta)\Gamma(N+1-\gamma)\Gamma(N+1-\delta)}{(N+1)^2\Gamma(N+1)^4\Gamma(1-\alpha)\Gamma(1-\beta)\Gamma(1-\gamma)\Gamma(1-\delta)}\tag{1}$$

where: $$\log\Gamma(z+1)=-\gamma z+\sum_{n\geq 1}\left(\frac{z}{n}-\log\left(1+\frac{z}{n}\right)\right)$$ probably leads to a massive simplification of $(1)$, or at least the chance to write $(1)$ as a simple integral by exploiting the identities: $$\log(m)=\int_{0}^{+\infty}\frac{e^{-x}-e^{-mx}}{x}\,dx,\qquad \log\left(1-\frac{\nu}{n}\right)=\int_{0}^{+\infty}\frac{1-e^{\nu x}}{x e^{nx}}\,dx.$$

However, by Did's comment we simply have:

$$\log\prod_{n\geq 1}\left(1+\frac{1}{n^2}\right) = \color{red}{\log\frac{\sinh \pi}{\pi}}$$

through the Weierstrass product for the $\sinh$ function.

\begin{align} I &=\int_{\frac{\pi}{4}}^{\frac{3\pi}{4}}\frac{\lfloor\left|\tan{\left(x\right)}\right|\rfloor}{\left|\tan{\left(x\right)}\right|}\,\mathrm{d}x\\ &=\int_{-\frac{\pi}{4}}^{\frac{\pi}{4}}\frac{\lfloor\left|\cot{\left(y\right)}\right|\rfloor}{\left|\cot{\left(y\right)}\right|}\,\mathrm{d}y;~~~\small{\left[x-\frac{\pi}{2}=y\right]}\\ &=2\int_{0}^{\frac{\pi}{4}}\frac{\lfloor\left|\cot{\left(y\right)}\right|\rfloor}{\left|\cot{\left(y\right)}\right|}\,\mathrm{d}y\\ &=2\int_{0}^{\frac{\pi}{4}}\frac{\lfloor\cot{\left(y\right)}\rfloor}{\cot{\left(y\right)}}\,\mathrm{d}y\\ &=2\int_{1}^{\infty}\frac{\lfloor t\rfloor}{t\left(1+t^{2}\right)}\,\mathrm{d}t;~~~\small{\left[\cot{\left(y\right)}=t\right]}\\ &=2\sum_{n=1}^{\infty}\int_{n}^{n+1}\frac{\lfloor t\rfloor}{t\left(1+t^{2}\right)}\,\mathrm{d}t\\ &=2\sum_{n=1}^{\infty}\int_{n}^{n+1}\frac{n}{t\left(1+t^{2}\right)}\,\mathrm{d}t\\ &=2\sum_{n=1}^{\infty}n\int_{n}^{n+1}\frac{\mathrm{d}t}{t\left(1+t^{2}\right)}\\ &=2\sum_{n=1}^{\infty}n\int_{n}^{n+1}\left[\frac{1}{t}-\frac{t}{1+t^{2}}\right]\,\mathrm{d}t\\ &=\sum_{n=1}^{\infty}n\left[\ln{\left(\frac{t^{2}}{1+t^{2}}\right)}\right]_{n}^{n+1}\\ &=\ln{\left(2\right)}-\sum_{n=2}^{\infty}\ln{\left(\frac{n^{2}}{1+n^{2}}\right)}\\ &=\ln{\left(2\right)}-\ln{\left(\prod_{n=2}^{\infty}\frac{n^{2}}{1+n^{2}}\right)}\\ &=\ln{\left(2\right)}-\ln{\left(2\pi\operatorname{csch}{\left(\pi\right)}\right)}\\ &=\ln{\left(\frac{\operatorname{sinh}{\left(\pi\right)}}{\pi}\right)}.\blacksquare\\ \end{align}

• A lot more efficient. Thank you. – Noe Blassel May 14 '16 at 22:08