How to find $\int_0^{{\pi}/{2}} (\pi x-4x^2)\log(1+\tan x)\mathrm dx$

Now complete


In order to evaluate this integral we will make extensive use of the so-called Clausen Function $\operatorname{Cl}_2(z)$ and its relatives.

Even though the polynomial term within the original integrand has an interesting symmetry concerning the substitution $x-\frac\pi4\mapsto x$ we will just split the integral into two parts. Lets start with the first one, the one only containing a linear polynomial, by rewriting the trigonometric part in the following way

$$\small\begin{align*} \pi\int_0^\frac\pi2 x\log(1+\tan x)\mathrm dx&=\pi\int_0^\frac\pi2 x\log(\sin x+\cos x)\mathrm dx-\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx\\ &=\pi\int_0^\frac\pi2 x\log\left(\sqrt2\sin\left(x+\frac\pi4\right)\right)\mathrm dx-\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx\\ &=\frac{\pi^3}{16}\log2+\pi\int_0^\frac\pi2 x\log\left(\sin\left(x+\frac\pi4\right)\right)\mathrm dx-\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx\\ &=\frac{\pi^3}{16}\log2+\underbrace{\pi\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)\log(\sin x)\mathrm dx}_{=I_1}\underbrace{-\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx}_{=I_2} \end{align*}$$

The reason why we actually want to use the Clausen Function here is the simple fact that this function is capable of providing a closed-form anti-derivative for $\log(\sin x)$ and $\log(\cos x)$ respectively. Thus, for $I_1$ we obtain

$$\small\begin{align*} \pi\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)\log(\sin x)\mathrm dx&=\pi\int_\frac\pi4^{\frac{3\pi}4}x\log(\sin x)\mathrm dx-\frac{\pi^2}4\int_\frac\pi4^{\frac{3\pi}4}\log(\sin x)\mathrm dx\\ &=\pi\left\{\left[x\left(-\frac12\operatorname{Cl}_2(2x)-x\log2\right)\right]_\frac\pi4^{\frac{3\pi}4}+\int_\frac\pi4^{\frac{3\pi}4}\frac12\operatorname{Cl}_2(2x)+x\log2~\mathrm dx\right\}\\ &~~~~+\frac{\pi^2}4\left[\frac12\operatorname{Cl}_2(2x)+x\log2\right]_\frac\pi4^{\frac{3\pi}4}\\ &=\frac{\pi^2}4\mathrm G-\frac{3\pi^3}8\log2+\pi\int_\frac\pi4^{\frac{3\pi}4}\frac12\operatorname{Cl}_2(2x)+x\log2~\mathrm dx\\ &=\frac{\pi^2}4\mathrm G-\frac{\pi^3}8\log2+\frac\pi4\int_\frac\pi2^{\frac{3\pi}2}\operatorname{Cl}_2(x)\mathrm dx\\ &=\frac{\pi^2}4\mathrm G-\frac{\pi^3}8\log2+\underbrace{\frac\pi4\left[-\operatorname{Cl}_3(x)\right]_\frac\pi2^{\frac{3\pi}2}}_{=0}\\ \therefore~\pi\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)\log(\sin x)\mathrm dx&=\frac{\pi^2}4\mathrm G-\frac{\pi^3}8\log2 \end{align*}$$

Similar for $I_2$ we eventually get

$$\small\begin{align*} -\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx&=-\pi\left[x\left(\frac12\operatorname{Cl}_2(\pi-2x)-x\log2\right)\right]_0^\frac\pi2+\pi\int_0^\frac\pi2\frac12\operatorname{Cl}_2(\pi-2x)-x\log2~\mathrm dx\\ &=\frac{\pi^3}8\log2+\frac\pi4\int_0^\pi\operatorname{Cl}_2(x)\mathrm dx\\ &=\frac{\pi^3}8\log2+\frac\pi4[\zeta(3)-\operatorname{Cl}_3(\pi)]\\ &=\frac{\pi^3}8\log2+\frac\pi4[\zeta(3)+\eta(3)]\\ \therefore~-\pi\int_0^\frac\pi2 x\log(\cos x)\mathrm dx&=\frac{\pi^3}8\log2+\frac{7\pi}{16}\zeta(3) \end{align*}$$

Combining those two results we get

$$\pi\int_0^\frac\pi2 x\log(1+\tan x)\mathrm dx~=~\frac{7\pi}{16}\zeta(3)+\frac{\pi^2}4\mathrm G+\frac{\pi^3}{16}\log2\tag1$$

We can deal with the quadratic parts in a similar manner whilst the calculation will become quite nasty. However, lets start

$$\small\begin{align*} -4\int_0^\frac\pi2x^2\log(1+\tan x)\mathrm dx&=-4\int_0^\frac\pi2 x^2\log(\sin x+\cos x)\mathrm dx+4\int_0^\frac\pi2 x^2\log(\cos x)\mathrm dx\\ &=-4\int_0^\frac\pi2 x^2\log\left(\sqrt2\sin\left(x+\frac\pi4\right)\right)\mathrm dx+4\int_0^\frac\pi2 x^2\log(\cos x)\mathrm dx\\ &=-\frac{\pi^3}{12}\log2-4\int_0^\frac\pi2 x^2\log\left(\sin\left(x+\frac\pi4\right)\right)\mathrm dx+4\int_0^\frac\pi2 x^2\log(\cos x)\mathrm dx\\ &=-\frac{\pi^3}{12}\log2\underbrace{-4\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)^2\log(\sin x)\mathrm dx}_{=I_3}\underbrace{+4\int_0^\frac\pi2 x^2\log(\cos x)\mathrm dx}_{=I_4} \end{align*}$$

What is new within $I_3$ and $I_4$ in contrast to $I_1$ and $I_2$ are the $x^2$ terms. the remaining parts can be handled as above. Thus, by expanding the squared term we obtain

$$\small\begin{align*} -4\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)^2\log(\sin x)\mathrm dx&=-4\int_\frac\pi4^{\frac{3\pi}4}\left(x^2-\frac\pi2x+\frac{\pi^2}{16}\right)\log(\sin x)\mathrm dx\\ &=2\pi\left\{\left[x\left(-\frac12\operatorname{Cl}_2(2x)-x\log2\right)\right]_\frac\pi4^{\frac{3\pi}4}+\int_\frac\pi4^{\frac{3\pi}4}\frac12\operatorname{Cl}_2(2x)+x\log2~\mathrm dx\right\}\\ &~~~~+\frac{\pi^2}4\left[\frac12\operatorname{Cl}_2(2x)+x\log2\right]_\frac\pi4^{\frac{3\pi}4}-4\int_\frac\pi4^{\frac{3\pi}4}x^2\log(\sin x)\mathrm dx\\ &=\frac{3\pi^2}4\mathrm G-\frac{7\pi^3}8\log2+2\pi\int_\frac\pi4^{\frac{3\pi}4}\frac12\operatorname{Cl}_2(2x)+x\log2~\mathrm dx-4\int_\frac\pi4^{\frac{3\pi}4}x^2\log(\sin x)\mathrm dx\\ &=\frac{3\pi^2}4\mathrm G-\frac{3\pi^3}8\log2+\frac\pi2\int_\frac\pi4^{\frac{3\pi}4}\operatorname{Cl}_2(x)\mathrm dx-4\int_\frac\pi2^{\frac{3\pi}2}x^2\log(\sin x)\mathrm dx\\ &=\frac{3\pi^2}4\mathrm G-\frac{3\pi^3}8\log2+\underbrace{\frac\pi4\left[-\operatorname{Cl}_3(x)\right]_\frac\pi2^{\frac{3\pi}2}}_{=0}-4\int_\frac\pi2^{\frac{3\pi}2}x^2\log(\sin x)\mathrm dx\\ \therefore~-4\int_\frac\pi4^{\frac{3\pi}4}\left(x-\frac\pi4\right)^2\log(\sin x)\mathrm dx&=\frac{3\pi^2}4\mathrm G-\frac{3\pi^3}8\log2\underbrace{-4\int_\frac\pi2^{\frac{3\pi}2}x^2\log(\sin x)\mathrm dx}_{=I_5} \end{align*}$$

Up to here it does not look that bad. However, as I already mentioned the really nasty part is right in front of us. It remains to somehow evaluate the remaining integrals $I_4$ and $I_5$ respectively. Applying Integration By Parts to $I_4$ two times we obtain

$$\small\begin{align*} 4\int_0^\frac\pi2x^2\log(\cos x)\mathrm dx&=4\left[x^2\left(\frac12\operatorname{Cl}_2(\pi-2x)-x\log2\right)\right]_0^\frac\pi2-8\int_0^\frac\pi2x\left(\frac12\operatorname{Cl}_2(\pi-2x)-x\log2\right)\mathrm dx\\ &=-\frac{\pi^3}2\log2-4\int_0^\frac\pi2x\operatorname{Cl}_2(\pi-2x)\mathrm dx+8\int_0^\frac\pi2x^2\log2~\mathrm dx\\ &=-\frac{\pi^3}6\log2-4\int_0^\frac\pi2x\operatorname{Cl}_2(\pi-2x)\mathrm dx\\ &=-\frac{\pi^3}6\log2-2\int_0^\pi(\pi-x)\operatorname{Cl}_2(x)\mathrm dx\\ &=-\frac{\pi^3}6\log2-\pi\int_0^\pi\operatorname{Cl}_2(x)\mathrm dx+\int_0^\pi x\operatorname{Cl}_2(x)\mathrm dx\\ &=-\frac{\pi^3}6\log2-\pi[\zeta(3)-\operatorname{Cl}_3(\pi)]-[x\operatorname{Cl}_3(x)]_0^\pi+\int_0^\pi\operatorname{Cl}_3(x)\mathrm dx\\ &=-\frac{\pi^3}6\log2-\pi\zeta(3)+\underbrace{[\operatorname{Cl}_4(\pi)]_0^\pi}_{=0}\\ \therefore~4\int_0^\frac\pi2x^2\log(\cos x)\mathrm dx&=-\frac{\pi^3}6\log2-\pi\zeta(3) \end{align*}$$

Preceding in the same manner with $I_5$ we get

$$\small\begin{align*} -4\int_\frac\pi4^{\frac{3\pi}4}x^2\log(\sin x)\mathrm dx&=-4\left[x^2\left(-\frac12\operatorname{Cl}_2(2x)-x\log2\right)\right]_\frac\pi4^{\frac{3\pi}4}-8\int_\frac\pi4^{\frac{3\pi}4}x\left(\frac12\operatorname{Cl}_2(2x)+x\log2\right)\mathrm dx\\ &=\frac{13\pi^3}8\log2-\frac{5\pi^2}4\mathrm G-8\int_\frac\pi4^{\frac{3\pi}4}x\left(\frac12\operatorname{Cl}_2(2x)+x\log2\right)\mathrm dx\\ &=\frac{13\pi^3}{24}\log2-\frac{5\pi^2}4\mathrm G-4\int_\frac\pi4^{\frac{3\pi}4}x\operatorname{Cl}_2(2x)\mathrm dx\\ &=\frac{13\pi^3}{24}\log2-\frac{5\pi^2}4\mathrm G-\int_\frac\pi2^{\frac{3\pi}2}x\operatorname{Cl}_2(x)\mathrm dx\\ &=\frac{13\pi^3}{24}\log2-\frac{5\pi^2}4\mathrm G+[x\operatorname{Cl}_3(x)]_\frac\pi2^{\frac{3\pi}2}-\int_\frac\pi2^{\frac{3\pi}2}\operatorname{Cl}_3(x)\mathrm dx\\ &=\frac{13\pi^3}{24}\log2-\frac{5\pi^2}4\mathrm G-\frac{3\pi}{32}\zeta(3)-[\operatorname{Cl}_4(x)]_\frac\pi2^{\frac{3\pi}2}\\ \therefore~-4\int_\frac\pi4^{\frac{3\pi}4}x^2\log(\sin x)\mathrm dx&=\frac{13\pi^3}{24}\log2-\frac{5\pi^2}4\mathrm G-\frac{3\pi}{32}\zeta(3)+2\beta(4) \end{align*}$$

Putting the afore-deduced together yields

$$\therefore~-4\int_0^\frac\pi2x^2\log(1+\tan x)\mathrm dx~=~-\frac{\pi^3}{12}\log2-\frac{\pi^2}2\mathrm G-\frac{35\pi}{32}\zeta(3)+2\beta(4)\tag2$$

Now, combining $(1)$ and $(2)$ we finally arrive at

$$\int_0^\frac\pi2 (\pi x-4x^2)\log(1+\tan x)\mathrm dx=-\frac{\pi^3}{48}\log2-\frac{\pi^2}4\mathrm G-\frac{21\pi}{32}\zeta(3)+2\beta(4)\tag{$\star$}$$

Numerically this works out. Even though WolframAlpha does not provide a closed-form for the original integral it is capable of expressing what I referred to as $I_4$, the really hard part here. WolframAlpha returns an expression for $I_4$ containing a combination of Trilogarithms which are precisely the here occuring Dirichlet Beta Function term while it does not return a closed-form expression for $I_5$ which is somewhat strange since this derivation was way easier.

It is quite interesting how this all boils down to $\beta(4)$, which is the only remaining term not expressible in terms of other constants (one may argue that $\zeta(3)$ is also only a series in disguise but it more used then $\beta(4)$ I would claim). Moreover the final expression $(\star)$ looks more friendly than the raw Maple output provided by Dr. Sonnhard Graubner.


Partial and incomplete solution (the easier part) \begin{align}J&=\int_0^{\frac{\pi}{2}}x\ln(1+\tan x)\,dx\end{align} Perform the change of variable $\displaystyle =\tan x$, \begin{align}J&=\int_0^{\infty}\frac{\arctan x\ln(1+x)}{1+x^2}\,dx\end{align} Perform the change of variable $\displaystyle y=\frac{1}{x}$, \begin{align}J&=\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(\frac{1+x}{x})}{1+x^2}\,dx\\ &=\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(1+x)}{1+x^2}\,dx-\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln x}{1+x^2}\,dx\\ &=\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(1+x)}{1+x^2}\,dx-\frac{\pi}{2}\int_0^{\infty}\frac{\ln x}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\ &=\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(1+x)}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\ &=\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(1+x)}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\ \end{align}

Therefore, \begin{align}2J&=\int_0^{\infty}\frac{\arctan x\ln(1+x)}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan\left( \frac{1}{x}\right)\ln(1+x)}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\ &=\frac{\pi}{2}\int_0^{1}\frac{\ln(1+x)}{1+x^2}\,dx+\frac{\pi}{2}\int_1^{\infty}\frac{\ln(1+x)}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\\end{align} In the second integral perform the change of variable $\displaystyle y=\frac{1}{x}$, \begin{align}2J&=\pi\int_0^{1}\frac{\ln(1+x)}{1+x^2}\,dx-\frac{\pi}{2}\int_0^{1}\frac{\ln x}{1+x^2}\,dx+\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\end{align} It is well known that: \begin{align}\int_0^{1}\frac{\ln(1+x)}{1+x^2}\,dx=\frac{\pi}{8}\ln 2\\ \int_0^{1}\frac{\ln x}{1+x^2}\,dx=-\text{G}\end{align} $\text{G}$, the Catalan constant. Therefore, \begin{align}J&=\frac{\pi^2}{16}\ln 2+\frac{\pi}{4}\text{G}+\frac{1}{2}\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\end{align} Define the function $R$ on $[0;\infty[$, \begin{align}R(x)&=\int_0^x \frac{\ln t}{1+t^2}\,dt\\ &=\int_0^1 \frac{x\ln(tx)}{1+t^2x^2}\,dt\\ \end{align}

\begin{align}K&=\int_0^{\infty}\frac{\arctan x\ln x}{1+x^2}\,dx\\ &=\Big[R(x)\arctan x\Big]_0^{\infty}-\int_0^1 \int_0^1\frac{x\ln(tx)}{(1+t^2x^2)(1+x^2)}\,dt\,dx\\ &=-\int_0^1 \int_0^1\frac{x\ln t}{(1+t^2x^2)(1+x^2)}\,dt\,dx-\int_0^1 \int_0^1\frac{x\ln x}{(1+t^2x^2)(1+x^2)}\,dt\,dx\\ &=-\int_0^1 \left[\frac{\ln t\ln\left(\frac{1+x^2}{1+t^2x^2}\right)}{2(1-t^2)}\right]_{x=0}^{x=\infty}\,dt-\int_0^{\infty}\left[\frac{\ln x\arctan(tx)}{1+x^2}\right]_{t=0}^{t=1}\,dx\\ &=\int_0^1 \frac{\ln^2 t}{1-t^2}\,dt-K \end{align} Therefore, \begin{align}K&=\frac{1}{2}\int_0^1 \frac{\ln^2 t}{1-t^2}\,dt\\ &=\frac{1}{2}\int_0^1\frac{\ln^2 t}{1-t}\,dt-\frac{1}{2}\int_0^1\frac{t\ln^2 t}{1-t^2}\,dt \end{align} In the second integral perform the change of variable $y=t^2$, \begin{align}K&=\frac{1}{2}\int_0^1\frac{\ln^2 t}{1-t}\,dt-\frac{1}{16}\int_0^1\frac{\ln^2 t}{1-t}\,dt\\ &=\frac{7}{16}\int_0^1\frac{\ln^2 t}{1-t}\,dt\\ &=\frac{7}{16}\times 2\zeta(3)\\ &=\frac{7}{8}\zeta(3) \end{align} Therefore, \begin{align}\boxed{J=\frac{\pi^2}{16}\ln 2+\frac{\pi}{4}\text{G}+\frac{7}{16}\zeta(3)}\end{align}


Inroduction

This is an extended comment in which we provide closed expressions from Mathematica (with some non trivial manual finishing) for the first few integrals of the type

$$f(k) = \int_0^\frac{\pi}{2} x^k \log\left(1+\tan(x)\right) \,dx\tag{1}$$

Notice: After having finished and published most of the results here this question (/1/ Integral $T_n=\int_{0}^{\pi/2}x^{n}\ln(1+\tan x)\,dx$) was brought to my attention which exactly asks for what I did here. Hence this comment would be better considered an answer to that question.

List of closed expressions for the integrals

The list can serve as a cross check for strict results already obtained by manual calculations done by some authors here, and to give direction to future strict derivations.

Also it would be nice to find the general expression after having discovered the general construction rule. I have made modest progress up to now (see below).

In the end it might even be possible to cross check the exponential generating function I had already provided in a comment (see below).

Here is the list of $f(k)$ in the format $\{k,f(k)\}$:

$\begin{array}{l} \left\{0,C+\frac{1}{4} \pi \log (2)\right\} \\ \left\{1,\frac{\pi C}{4}+\frac{7 \zeta (3)}{16}+\frac{1}{16} \pi ^2 \log (2)\right\} \\ \left\{2,\frac{\pi ^2 C}{8}+\frac{35 \pi \zeta (3)}{128}+\frac{1}{512} \left(\zeta \left(4,\frac{3}{4}\right)-\zeta \left(4,\frac{1}{4}\right)\right)+\frac{1}{48} \pi ^3 \log (2)\right\} \\ \left\{3,\frac{\pi ^3 C}{16}+\frac{105 \pi ^2 \zeta (3)}{512}-\frac{93 \zeta (5)}{128}+\frac{3 \pi \left(\zeta \left(4,\frac{3}{4}\right)-\zeta \left(4,\frac{1}{4}\right)\right)}{2048}+\frac{1}{128} \pi ^4 \log (2)\right\} \\ \left\{4,\frac{\pi ^4 C}{32}+\frac{35 \pi ^3 \zeta (3)}{256}-\frac{1581 \pi \zeta (5)}{2048}+\frac{3 \pi ^2 \left(\zeta \left(4,\frac{3}{4}\right)-\zeta \left(4,\frac{1}{4}\right)\right)}{2048}-\frac{3 \left(\zeta \left(6,\frac{3}{4}\right)-\zeta \left(6,\frac{1}{4}\right)\right)}{8192}+\frac{1}{320} \pi ^5 \log (2)\right\} \\ \left\{5,\frac{\pi ^5 C}{64}+\frac{175 \pi ^4 \zeta (3)}{2048}+\frac{1905 \zeta (7)}{512}-\frac{7905 \pi ^2 \zeta (5)}{8192}+\frac{5 \pi ^3 \left(\zeta \left(4,\frac{3}{4}\right)-\zeta \left(4,\frac{1}{4}\right)\right)}{4096}-\frac{15 \pi \left(\zeta \left(6,\frac{3}{4}\right)-\zeta \left(6,\frac{1}{4}\right)\right)}{32768}+\frac{1}{768} \pi ^6 \log (2)\right\} \\ \end{array}$

Here $\zeta(s)$ is the Riemann zeta function, and $\zeta(s,a) =\sum _{k=0}^{\infty } (a+k)^{-s} $ is the Hurwitz zeta function.

I have calculated 10 terms, but for the ease of reading in the analytic expressions I have confined myself to 5 terms.

I have chekced the list numerically comparing the numerical integral with the numerical values of the closed expression from the list.

The first 10 numerical values in the format $\{k,f(k)\}$ are:

$\text{ {{0, 1.46036}, {1, 1.67287}, {2, 2.11591}, {3, 2.81708}, {4, 3.86984}, {5, 5.42943}},}$ $\text{ {{6, 7.73435}, {7, 11.1452}, {8, 16.2057}, {9, 23.7355}, {10, 34.9722}} }$

Analysis of the closed expressions (first attempts)

$1 Components

We see that that closed expressions for $f(k)$ are composed of the Catalan number $C$, powers of $\pi$, Riemann- and Hurwitz $\zeta$-functions, $\log(2)$ and rational coefficients.

§2 Construction rules

Preliminary results are:

The factor in front of $C$ (Catalan number) is $a_{C}(0) = 1$ and $a_{C}(k) = \frac{\pi ^k}{2^{k+1}}$ for $k>0$.

The factor in front of $\log(2)$ is $a_{ln2}(k) = \frac{\pi}{4} \frac{ \pi ^k}{ (k+1) 2^k}$

Maybe the results obtained in /1/ can lead to more clarification.

§3 Asymptotic behaviour of $f(k)$

The transformation $x\to y \frac{\pi}{2}$ in $(1)$ leads to

$$\left(\frac{\pi }{2}\right)^{k+1} \int_0^1 y^k \log \left(\tan \left(\frac{\pi y}{2}\right)+1\right) \, dy$$

Observing that for $k \to \infty$ the main part of the Integrand Comes from the regiom close to $y =1$ we have the sequence

$\log \left(\tan \left(\frac{\pi y}{2}\right)+1\right)\simeq \log \left(\tan \left(\frac{\pi y}{2}\right)\right)=\log \left(\cot \left(\frac{1}{2} \pi (1-y)\right)\right)\simeq -\log \left(\sin \left(\frac{1}{2} \pi (1-y)\right)\right)\simeq -\log \left(\frac{1}{2} \pi (1-y)\right)$

and the final integral becomes

$$\int_0^1 y^k \left(-\log \left(\frac{1}{2} \pi (1-y)\right)\right) \, dy = \frac{1}{k+1} (H_{k+1}-\log \left(\frac{\pi }{2}\right))\\ \simeq \frac{-\log \left(\frac{1}{k}\right)+\gamma -\log \left(\frac{\pi }{2}\right)}{k}$$

Here we have used the asymptotic expansion of the harmonic numbers.

Finally the asymptotics is

$$f(k \to \infty) = \left(\frac{\pi}{2}\right)^{k+1} \frac{1}{k}\left(\log (k)+\gamma -\log \left(\frac{\pi }{2}\right)\right)\tag{1a}$$

Generating function

The exponential generating function

$$g_s(t) = \sum_{k=0}^\infty \frac{t^k}{k!} f(k)$$

in integral form was surprisingly calulated by Mathematica in a few minutes:

$$g_i(t) = \int_0^\frac{\pi}{2} e^{t x} \log\left(1+\tan(x)\right) \,dx\\ = \frac{1}{4t} e^{-\frac{1}{4} (3 \pi t)} \left(-2 e^{\frac{3 \pi t}{4}} \left(\psi ^{(0)}\left(\frac{i t}{4}+\frac{1}{2}\right)-\psi ^{(0)}\left(\frac{i t}{4}\right)\right)\\-4 B_{-i}\left(\frac{i t}{2},0\right)+4 e^{\pi t} B_i\left(\frac{i t}{2},0\right)\\-e^{\frac{\pi t}{4}} \left(4 \left(\gamma +\psi ^{(0)}\left(\frac{i t}{2}\right)\right)+2 i \pi +\log (16)\right)\right) \tag{2}$$

composed of digamma- and incomplete Beta-functions.

Technical remarks

It is well known that CAS often need some manual help by the user to reach results, or satisfactory results. This case here is no exception, and some remarks seem to be appropriate.

For $k=4$, in the first place, Mathematica returns this expression

$$f(4) = \frac{\pi ^4 C}{32}-\frac{3}{8} i \pi ^2 \text{Li}_4(-i)+\frac{3 \pi \text{Li}_5(-i)}{4}+\frac{3 i \text{Li}_6(-i)}{4}-\frac{3 i \text{Li}_6(i)}{4}+\frac{35 \pi ^3 \zeta (3)}{256}-\frac{3 \pi \zeta (5)}{4}+\frac{17 i \pi ^6}{7680}+\frac{1}{320} \pi ^5 \log (2)$$

This has some ugly properties: it seems to be explicitly imaginary (e.g. $\frac{17 i \pi ^6}{7680}$) and has polylog functions with maginary argument (e.g. $\text{Li}_6(i)$), and finally it shows a somwhat confusing construction. Nevertheless the numerical value shows that it is a real quantity. Hence an explicitly real expression, and with a more regular structure, would be desirable.

At first I calculated real and imaginary part of the polylog functions using their power series expansion

$$\text{Li}_n(z)=\sum _{k=1}^{\infty } \frac{z^k}{k^n}$$

Example: for $\text{Li}_4(i)$ the first 8 summands are

$$\text{Li}_4(i) \simeq \left\{i,-\frac{1}{16},-\frac{i}{81},\frac{1}{256},\frac{i}{625},-\frac{1}{1296},-\frac{i}{2401},\frac{1}{4096}\right\}$$

regrouping we have

$$\text{Li}_4(i) \simeq \left\{-\frac{1}{16},\frac{1}{256},-\frac{1}{1296},\frac{1}{4096}\right\}+\left\{i,-\frac{i}{81},\frac{i}{625},-\frac{i}{2401}\right\}$$

This can be identified as the sum of two sums which in the limit give

$$\text{Li}_4(i) = \sum _{k=1}^{\infty } \frac{(-1)^k}{(2 k)^4}+i \sum _{k=1}^{\infty } \frac{(-1)^{k+1}}{(2 k-1)^4}$$

This can be expressed by polygamma functions

$$\text{Li}_4(i) = -\frac{7 \pi ^4}{11520}+\frac{i \psi ^{(3)}\left(\frac{1}{4}\right)}{1536}-\frac{i \psi ^{(3)}\left(\frac{3}{4}\right)}{1536}$$

or, alternatively, using the relation

$$\psi ^{(m)}(z)=(-1)^{m+1} m! \zeta (m+1,z)$$

by Hurwitz zeta functions

$$\text{Li}_4(i) =-\frac{7 \pi ^4}{11520}+\frac{1}{256} i \left(\zeta \left(4,\frac{1}{4}\right)-\zeta \left(4,\frac{3}{4}\right)\right)$$

Fortunately, in the end I have found a simplify command $\text{//FunctionExpand}$ which facilitates the work appreciably effecting the whole conversion of the closed expression of the integral directly.

References

/1/ Integral $T_n=\int_{0}^{\pi/2}x^{n}\ln(1+\tan x)\,dx$