14

How do you find the integral of $$ \int_0^{\pi/2}\left(\pi x - 4x^{2}\right) \log\left(1 + \tan\left(x\right)\right)\,\mathrm{d}x $$

The integral can be simplified to $$ \int_0^{\pi/2}x\left(4x + {\pi}\right) \ln\left(1 - \dfrac{\mathrm{i}\left[\mathrm{e}^{\mathrm{i}x}-\mathrm{e}^{-\mathrm{i}x}\right]}{\mathrm{e}^{\mathrm{i}x}+\mathrm{e}^{-\mathrm{i}x}}\right) \,\mathrm{d}x$$

Felix Marin
  • 89,464
  • 1
    Welcome to MSE. Please read this text about how to ask a good question. – José Carlos Santos May 10 '19 at 08:18
  • Noted. Thank you – NoLand'sMan May 10 '19 at 08:23
  • No more integral sign after simplification? – FDP May 10 '19 at 08:24
  • 1
    I suppose that polylogarithms would appear. – Claude Leibovici May 10 '19 at 08:28
  • Maple says this here $$-i{\it polylog} \left( 4,i \right) +{\frac {5,i}{192}}{\pi}^{4}+1/4, \pi,{\it polylog} \left( 3,i \right) -{\frac {9,\pi,\zeta \left( 3 \right) }{16}}+i{\it polylog} \left( 4,-i \right) -1/4,{\pi}^{2}{ \it Catalan}+3/4,\pi,{\it polylog} \left( 3,-i \right) -1/24,\ln \left( 1-i \right) {\pi}^{3}-1/24,{\pi}^{3}\ln \left( -1+i \right) +1/24,{\pi}^{3}\ln \left( 1+i \right) $$ – Dr. Sonnhard Graubner May 10 '19 at 08:37
  • It may not be doable! – Z Ahmed May 10 '19 at 08:50
  • Not by hand, i agree with you! – Dr. Sonnhard Graubner May 10 '19 at 09:02
  • There is an easy part in the computation. $\displaystyle \int_0^{\frac{\pi}{2}}x\ln(1+\tan x),dx$ is doable. – FDP May 10 '19 at 09:06
  • All powers of $x$ in front of $\log(1+\tan(x))$ are doable. We even have a generating function $\int_0^{\frac{\pi }{2}} \exp (-t x) \log (\tan (x)+1) , 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)$ – Dr. Wolfgang Hintze May 10 '19 at 10:04
  • Dr Wolfgang: we don't have the same meaning for doable. – FDP May 10 '19 at 10:41
  • 1
    FDP For me doable means, i.e. explicitly expressable in terms of known (possibly special) functions. What is your definition? – Dr. Wolfgang Hintze May 10 '19 at 11:33
  • I was able to finish my own attempt, thus I present to you a complete evaluation now! – mrtaurho May 10 '19 at 14:04
  • Dr Wolgang: solution using elementary computation (see my partial solution below) – FDP May 10 '19 at 19:48
  • My answer gives you the possibility to build up the formula by hand without problems. ;) – user90369 May 13 '19 at 17:02
  • @FDP What you mean is "done". If Mathematica (or any other CAS) can solve an integral (with some skilled manual aid) and it can be surely done also by hand. I am surprised a little that seeing CAS-results (except the one of Dr. Graubner) is only poorly appreciated. After all they show the ingredients (functions and constants) of the solutions and might also very well lead to successful hand-made calculations. You can compare this in part with the strategy of "experimental mathematics" to "guess" the coefficients in a linear combination of known constants, all based on high precision numerics. – Dr. Wolfgang Hintze May 14 '19 at 10:12
  • @Dr Wolfgang Hintze: I use CAS (WA online and Maxima) to obtain antiderivatives and GP PARI to compute approximation of integrals and to guess closed form (lindep function). The results obtained for definite integrals are often ugly using CAS. – FDP May 14 '19 at 10:25
  • @ FDP same experience. As I said in my extended comment, there was in fact manual aid to Mathematica necessary. As a long time user of this CAS I have some experience in helping out ;-) I was especially surprised that Mathamatica was able to solve the integral for the generating function, and this in terms of well known special functions. Unfortunately, I was not able up to now to calculate the derivatives analytically. But numerically the first few are ok. – Dr. Wolfgang Hintze May 14 '19 at 10:33
  • Claude Leibovici gave the right hint, there is no need for complicate calculations here. ;) – user90369 May 15 '19 at 11:20

4 Answers4

15

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.

mrtaurho
  • 16,103
5

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}

FDP
  • 13,647
3

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$

  • this question might interest you – clathratus May 13 '19 at 01:56
  • 1
    @ clathratus Very interesting, Have to take a closer look. Just a few question right now: can you confirm the expressions I have presented? Did you find the general construction rule? What do you think about the generating function? – Dr. Wolfgang Hintze May 13 '19 at 10:24
  • I edited the post. It just comes down to finding two integrals in the form $$\int_{p\pi}^{q\pi}x^a\mathrm{Cl}_{b}(x)dx$$ where $p$ and $q$ are rational, but the process is really nasty. I have yet to see if it confirms your results. The generating function looks pretty hard to use. – clathratus May 13 '19 at 16:43
  • Quick clarification question: $\zeta(s,z)$ is the Hurwitz Zeta, right? – clathratus May 13 '19 at 16:57
  • 1
    @ caltharius I agree, the generating function seems to be hard to handle. But to know the expression at all is a value in its own I would say. As I said I have checked successfully the first few derivatives numerically. And, yes, it is Hurwitz zeta. I think I shall extend my post to include some technical questions. – Dr. Wolfgang Hintze May 14 '19 at 11:36
  • 1
    @ caltharius I have found that due to the relation $\beta (s)= 2^{-2 s} \left(\zeta \left(s,\frac{1}{4}\right)-\zeta \left(s,\frac{3}{4}\right)\right)$ my expressions can be written in more compact form using $\beta(s)$. Unfortunately, in the first 10 terms the coefficients of $\beta(4)$ are very irregular so that there's not much hopre left to find the general expression. The e.g.f. can also easily be calculated for your $Cl_b$ functions. They are simpler but still contain divergent terms when considered separately. – Dr. Wolfgang Hintze May 15 '19 at 10:43
  • Interesting... Fortunately someone has found a way to approach the integral and I accepted their answer. You should look at it. Thanks for all your hard work and interest, your ideas are really cool :) – clathratus May 15 '19 at 21:58
  • 1
    @ clathratus Thank you for your compliment which I return happily. I was just entering the asymptotic expression of $f(k)$ ($T_k$) when I saw your hint. Very interesting result. It seems that the Fourier decomposition of $\log(\cos(x))$ was the essential new idea. I have checked the expressions with my list and find agreement (except that the index has been shifted by 1: our 1 is his 0). – Dr. Wolfgang Hintze May 16 '19 at 12:55
  • 1
    @ clathratus no, there is no shift. everything ok. – Dr. Wolfgang Hintze May 17 '19 at 05:03
  • Excellent work, thank you so much – clathratus May 17 '19 at 20:57
3

For $~ \displaystyle -\frac{\pi}{4} < x < \frac{\pi}{2} ~$ and $~\displaystyle e^{i\frac{\pi}{2}}=i ~$ it’s

$$\ln(1+\tan x) = \ln\left(\sqrt{2}~\frac{\sin\left(x+\frac{\pi}{4}\right)}{\cos x}\right) = \frac{\ln 2}{2} - i\frac{\pi}{4} + \text{Li}_1(-e^{-i2x}) - \text{Li}_1(-ie^{-i2x}) $$

and with $~m,n\in\mathbb{N}_0~$ we have the following integral recursion:

$$\int x^n \text{Li}_m(ae^{bx}) dx = \frac{x^n}{b} \text{Li}_{m+1}(ae^{bx}) - \frac{n}{b} \int x^{n-1} \text{Li}_{m+1}(ae^{bx}) dx $$

This recursion leads directly to the following formula:

$$\int x^n\ln(1+\tan x)dx =$$

$$ =\frac{x^{n+1}}{n+1}\left(\frac{\ln 2}{2}-i\frac{\pi}{4}\right) - \sum\limits_{k=0}^n \frac{n!}{(n-k)!}\frac{x^{n-k}}{(i2)^{k+1}}\left(\text{Li}_{ k+2}\left(-e^{-i2x}\right)-\text{Li}_{ k+2}\left(-ie^{-i2x}\right)\right) + C $$

Note: $~~$ It answers also the question here .

For the given problem, means: $x\in\{0,\frac{\pi}{2}\}$, it only remains to express the series of $~\text{Li}_m(z)$

with $~z\in\{1,-1,i,-i\}~$ by other symbols:

$\displaystyle \text{Li}_m(1)~|_{m\in\mathbb{N}\setminus\{1\}} =\zeta(m)\hspace{4.8cm}$ ( $\zeta(s)$ is the Riemann $\zeta$-function )

$\displaystyle \text{Li}_m(-1)~|_{m\in\mathbb{N}} =-\eta(m)\equiv\left(2^{1-m}-1\right)\zeta(m)\hspace{1cm}$ ( $\eta(s)$ is the Dirichlet $\eta$-function )

$\displaystyle \text{Li}_m(i)~|_{m\in\mathbb{N}} =-\frac{1}{2^m}\eta(m)+i\beta(m)\hspace{2.9cm}$ ( $\beta(s)$ is the Dirichlet $\beta$-function )

$\displaystyle \text{Li}_m(-i)~|_{m\in\mathbb{N}} = (-1)^{m+1}\text{Li}_m(i)-\frac{(i2\pi)^m}{m!}B_m\left(\frac{3}{4}\right) \enspace$ ( $B_m(x)$ is the Bernoulli polynomial )

E.g. for $~n\in\{0,1,2,3,4\}~$ we get:

$\displaystyle \int\limits_0^{\frac{\pi}{2}} \ln(1+\tan x) dx = \frac{\pi}{4}\ln 2 + \beta(2)$

$\displaystyle \int\limits_0^{\frac{\pi}{2}} x\ln(1+\tan x) dx = \frac{\pi^2}{16}\ln 2 + \frac{\pi}{4}\beta(2) + \frac{7}{16}\zeta(3)$

$\displaystyle \int\limits_0^{\frac{\pi}{2}} x^2\ln(1+\tan x) dx = \frac{\pi^3}{48}\ln 2 + \frac{\pi^2}{8}\beta(2) + \frac{35\pi}{128}\zeta(3) - \frac{1}{2}\beta(4)$

$\displaystyle \int\limits_0^{\frac{\pi}{2}} x^3\ln(1+\tan x) dx = \frac{\pi^4}{128}\ln 2 + \frac{\pi^3}{16}\beta(2) + \frac{105\pi^2}{512}\zeta(3) - \frac{3\pi}{8}\beta(4) - \frac{93}{128}\zeta(5)$

$\displaystyle \int\limits_0^{\frac{\pi}{2}} x^4\ln(1+\tan x) dx = $

$\hspace{2cm}\displaystyle = \frac{\pi^5}{320}\ln 2 + \frac{\pi^4}{32}\beta(2) + \frac{35\pi^3}{256}\zeta(3) - \frac{3\pi^2}{8}\beta(4) - \frac{1581\pi}{2048}\zeta(5) + \frac{3}{2}\beta(6)$

$\enspace$

The above formula provides for $~n\in\mathbb{N}_0~$ :

$\displaystyle \int\limits_0^{\frac{\pi}{2}}x^n\ln(1+\tan x)\,dx = \frac{\pi^{n+1}\ln 2}{2^{n+2}(n+1)}+ $

$\hspace{0.5cm}\displaystyle + \frac{n!}{2^{3n+4}}\sum\limits_{\,k=0 \\ k~\text{odd}}^{n-1}\frac{(4\pi)^{n-k}}{(n-k)!} \left(\sin\frac{\pi k}{2}\right) (2^{2k+3}+2^{k+1}-1)\zeta(k+2) $

$\hspace{0.5cm}\displaystyle + \frac{n!}{2^{n+1}}\sum\limits_{\,\,k=0 \\ k~\text{even}}^{n-1}\frac{\pi^{n-k}}{(n-k)!} \left(\cos\frac{\pi k}{2}\right)\beta(k+2) $

$\hspace{0.5cm}\displaystyle + \frac{n!}{2^{3n+4}} \left(\sin\frac{\pi n}{2}\right) (2^{2n+4}-(1-(-1)^n)2^{n+1}-1-(-1)^n)\zeta(n+2)$

$\hspace{0.5cm}\displaystyle +\frac{n!}{2^{n+1}}(1+(-1)^n)\left(\cos\frac{\pi n}{2}\right)\beta(n+2) $


$(\text{A})~$ Hint.

For a better understanding of the first formula (of my answer) we can also write:

$\displaystyle \ln(1+\tan x) = \int\limits_0^x\frac{1+\tan^2 t}{1+\tan t}dt = \int\limits_0^x \left(\tan t - \tan\left(t-\frac{\pi}{4}\right)\right)dt$

$\hspace{1cm}\displaystyle = -i2 \int\limits_0^x \left(\text{Li}_0\left(-e^{-i2t}\right) - \text{Li}_0\left(-ie^{-i2t}\right)\right) dt = \left(\text{Li}_1\left(-e^{-i2t}\right) - \text{Li}_1\left(-ie^{-i2t}\right)\right)|_0^x$

with $\displaystyle \enspace \left(\text{Li}_1\left(-e^{-i2t}\right) - \text{Li}_1\left(-ie^{-i2t}\right)\right)|_{t=0} = \text{Li}_1(-1) - \text{Li}_1(-i) = -\frac{\ln 2}{2} + i\frac{\pi}{4} $

The transformation $\displaystyle\enspace \frac{1+\tan^2 t}{1+\tan t} = \tan t - \tan\left(t-\frac{\pi}{4}\right) \enspace$ comes from

$$\tan(x+y) = \frac{\tan x + \tan y}{1 - \tan x \tan y}\enspace\enspace \text{with} \enspace x:=t\enspace\enspace \text{and} \enspace\enspace y:=\frac{\pi}{4}-t$$

And the basic connection of $~\tan~$ with $~\text{Li}_0~$ is

$$\tan t + i2\,\text{Li}_0\left(-e^{-i2t}\right) = -i = \tan\left(t-\frac{\pi}{4}\right) + i2\,\text{Li}_0\left(-ie^{-i2t}\right) ~ .$$


$(\text{B})~$ About the generating function, mentioned by Dr. Wolfgang Hintze.

We need the following formula:

$$\int e^{tx}\text{Li}_{\,m}(ae^{bx})dx = e^{tx}\sum\limits_{k=1}^\infty\frac{(ae^{bx})^k}{k^m(kb+t)}+C = $$ $$=\sum\limits_{k=0}^\infty\frac{(tx)^k}{k!}\cdot\sum\limits_{k=0}^\infty\frac{(-t)^k}{b^{k+1}}\text{Li}_{m+k+1}(ae^{bx})+C$$ $$=\sum\limits_{n=0}^\infty t^n\sum\limits_{k=0}^n\frac{x^{n-k}}{(n-k)!}\frac{(-1)^k}{b^{k+1}}\text{Li}_{m+k+1}(ae^{bx})+C$$

With $\displaystyle\enspace\ln(1+\tan x) = \frac{\ln 2}{2} - i\frac{\pi}{4} + \text{Li}_1(-e^{-i2x}) - \text{Li}_1(-ie^{-i2x}) \enspace $ we get a formula for

$~\displaystyle\int x^n\ln(1+\tan x)dx = n!~[t^n]\int e^{tx}\ln(1+\tan x)dx~. \hspace{1cm}$ (it's the same as above)


$(\text{C})~$ An additional note: $~$The case $~n=-1~$ has no "closed form".

$\displaystyle f~:~\mathbb{R}\to \mathbb{R}\enspace,\enspace f’(x):=\frac{ \text{Li}_1(-e^{-i2x}) - \text{Li}_1(-1)}{x}-i\enspace , \enspace f(0):=0$

$\displaystyle g~:~\mathbb{R}\to \mathbb{R}\enspace,\enspace g’(x):=\frac{ \text{Li}_1(-ie^{-i2x}) - \text{Li}_1(-i)}{x}-i\enspace , \enspace g(0):=0$

It follows:

$\displaystyle \int\frac{\ln(1+\tan x)}{x}dx = f(x) - g(x) + C$

Special values:

$\displaystyle f\left(\frac{\pi}{2}\right)\approx 0.9412376742877 , ~g\left(\frac{\pi}{2}\right)\approx -0.7215715580242$

user90369
  • 11,518