TITLE: Closed form of $\ln^n \tan x\, dx$
QUESTION [5 upvotes]: Here is an integral I am really stuck at. I am pretty sure that a general closed form of the integral:
$$\mathcal{J}=\int_0^{\pi/2} \ln^n \tan x\, {\rm d}x, \;\; n \in \mathbb{N}$$
exists. Well if $n$ is odd , then the integral is obviously zero due to symmetry. On the contrary if $n$ is even then the closed form I seek must contain the beta dirichlet function however I am unable to reach it. Setting $m=2n$ then:
$$\int_{0}^{\pi/2}\ln^m \tan x\, {\rm d}x=\int_{0}^{\infty}\frac{\ln^m u}{u^2+1}\, {\rm d}u= 2\int_{0}^{1}\frac{\ln^m u}{u^2+1}\, {\rm d}u$$
If we expand the denominator in a Taylor series, namely $1+x^2=\sum \limits_{n=0}^{\infty} (-1)^n x^n$ then the last integral is written as:
$$2\int_{0}^{1}\ln^m x \sum_{n=0}^{\infty}(-1)^n  x^n \, {\rm d}x = 2\sum_{n=0}^{\infty}(-1)^n \int_{0}^{1}x^n \ln^m x \, {\rm d}x = 2 \sum_{n=0}^{\infty}\frac{(-1)^n (-1)^m m!}{\left ( n+1 \right )^{m+1}}= 2 (-1)^m m! \sum_{n=0}^{\infty}\frac{(-1)^n}{\left ( n+1 \right )^{m+1}}$$
Apparently there is something wrong here. I used the result 
$$\int_{0}^{1}x^m \ln^n x \, {\rm d}x = \frac{(-1)^n n!}{\left ( m+1 \right )^{n+1}}$$
as presented here. 
Edit/ Update: A conjecture of mine is that the closed form actually is:
$$\int_0^{\pi/2} \ln^{m} \tan x \, {\rm d}x=2m! \beta(m+1), \;\; m \;\;{\rm even}$$
For $m=2$ matches the result $\displaystyle \int_0^{\pi/2} \ln^2 \tan x\, {\rm d}x= \frac{\pi^3}{8}$.

REPLY [5 votes]: We begin with the integral $I$ as given by
$$I_n=\int_0^{\pi/2}\log^n (\tan x)\,dx \tag 1$$
Enforcing the substitution $\tan x\to x$, $(1)$ becomes
$$I_n=\int_0^\infty \frac{\log^n x}{1+x^2}\,dx=\left.\left(\frac{d^n}{da^n}\int_0^{\infty}\frac{x^a}{1+x^2}\,dx\right)\right|_{a=0}\tag 2$$
We evaluate the integral in $(2)$ using the residue theorem.  To that end, we analyze the closed-contour integral $J$ as given by 
$$J\oint_C\frac{z^a}{1+z^2}\,dz$$
where $C$ is the classical "key-hole" contour.  From the residue theorem we have
$$\begin{align}
J&=\oint_C\frac{z^a}{1+z^2}\,dz\\\\
&=2\pi i\left(\frac{e^{i\pi a/2}}{2i}+\frac{e^{i3\pi a/2}}{-2i}\right) \\\\
&=-2i\,\pi\, e^{ia\pi}\sin(\pi a/2)
\end{align}$$
We can write $J$ as 
$$\begin{align}
J&=\left(1-e^{i2\pi a}\right)\,\int_0^{\infty}\frac{x^a}{1+x^2}\,dx\\\\
&=-2i e^{i\pi a}\sin(\pi a)\,\int_0^{\infty}\frac{x^a}{1+x^2}\,dx
\end{align}$$
Therefore, we have
$$\int_0^{\infty}\frac{x^a}{1+x^2}\,dx=\frac{\pi}{2\cos (\pi a/2)} $$
and 
$$\begin{align}
I_n&=\left.\left(\frac{d^n}{da^n}\frac{\pi}{2\cos (\pi a/2)}\right)\right|_{a=0}\\\\
&=(\pi/2)^{n+1}\left.\left(\frac{d^n\sec x}{dx^n}\right)\right|_{x=0}
\end{align}$$
From the Series for the Secant Function we have
$$
\left.\frac{d^n \sec x}{dx^n}\right|_{x=0}=
\begin{cases}0&,n\,\,\text{odd}\\\\
(i)^n\,E_n  &,n\,\,\text{even}
\end{cases}
$$
Finally, 
$$\bbox[5px,border:2px solid #C0A000]{I_{2n}=(\pi/2)^{2n+1}(-1)^nE_{2n}}$$