TITLE: Improper Integral $\int\limits_0^\frac{1}{2}x^n\cot(\pi x)\,dx$
QUESTION [9 upvotes]: What is the closed form of the following integral for every $n\in\mathbb{N}$?
$$\int_0^\frac{1}{2}x^n\cot(\pi x)\,dx$$
By Mathematica we see that
$$\int_0^\frac{1}{2}x\cot(\pi x)\,dx=\frac{\log(2)}{2\pi}$$
$$\int_0^\frac{1}{2}x^2\cot(\pi x)\,dx=\frac{\pi^2\log(4)-7\zeta(3)}{8\pi^3}.$$
If there not exist a closed form, how one can prove these two formulas?

REPLY [10 votes]: Your integral can be related to derivatives of the Hurwitz Zeta function. 
But, an interesting tidbit is that Ramanujan derived the formula:
$\displaystyle 1/2\int_{0}^{x}u^{n}\cot(u/2)du$
$\displaystyle=\cos(\frac{\pi n}{2})n!\zeta(n+1)-\sum_{k=0}^{n}(-1)^{\frac{k(k+1)}{2}}\frac{\Gamma(n+1)}{\Gamma(n+1-k)}x^{n-k}Cl_{k+1}(x)$
Where $Cl_{k+1}(x)$ is the Clausen function:
$\displaystyle Cl_{n}(x)=\Re [Li_{n}(e^{-ix})], \;\ \text{n odd} \;\ or \;\ -\Im [Li_{n}(e^{-ix})], \;\ \text{n even}$
Where $Li_{n}(e^{-ix})$ is the polylogarithm. 
For instance, $Li_{1}(e^{-i/2})=-\ln(1-e^{-i/2})=-\ln(2\sin(1/4))-(\frac{\pi}{2}-\frac{1}{4})i$
$\Re[Li_{2}(e^{ix})]=\frac{x^{2}}{4}-\frac{\pi x}{2}+\frac{\pi^{2}}{6}$.
So, for $x=-1/2$, we get $\frac{\pi^{2}}{6}+\frac{\pi}{4}+\frac{1}{16}$
A simple sub can whittle this more into your form. 
EDIT:
If I may add another very useful identity.  where p(x) is a polynomial like $x^{2}$ for instance. 
$\displaystyle \int_{a}^{b}p(x)\cot(nx)dx=2\sum_{k=1}^{\infty}\int_{a}^{b}\sin(2nkx)dx$.
provided $\sin(nx)\neq 0 \;\ \forall x \in [a,b]$
Let's do an example.  Say we want $\displaystyle \int_{0}^{\frac{1}{2}}x^{2}\cot(\pi x)dx=2\sum_{k=1}^{\infty}\int_{0}^{\frac{1}{2}}x^{2}\sin(2\pi kx)dx$
Integrating the right side results in the sums:
$\displaystyle-\frac{1}{4\pi}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k}+\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k^{3}}-\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{1}{k^{3}}=\frac{\ln(2)}{4\pi}-\frac{1}{\pi^{3}}\cdot \frac{3}{8}\zeta(3)-\frac{1}{2\pi^{3}}\zeta(3)=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$
Thus, $\displaystyle \int_{0}^{1/2}x^{2}\cot(\pi x)dx=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$