I am wondering if anyone would know how to evaluate this integral: $$\int_{0}^{\Large\frac{\pi}{4}}\left(\frac{1}{\log(\tan(x))}+\frac{1}{1-\tan(x)}\right)dx.$$
I've tried, unsuccessfully, the change of variables $u=\tan (x)$.
I am wondering if anyone would know how to evaluate this integral: $$\int_{0}^{\Large\frac{\pi}{4}}\left(\frac{1}{\log(\tan(x))}+\frac{1}{1-\tan(x)}\right)dx.$$
I've tried, unsuccessfully, the change of variables $u=\tan (x)$.
We have the following closed form evaluation.
$$ I:=\int_0^{\Large \frac{\pi}{4}}\!\!\left(\frac{1}{\ln(\tan x)}+\frac{1}{1-\tan x}\right)\! \mathrm dx= \color{blue}{\frac\pi8+\frac74\ln2+\frac\gamma2+\ln\pi-2\ln \Gamma\!\left(\!\frac14\!\right)} \tag1 $$
where $\gamma$ is the Euler-Mascheroni constant.
A numerical approximation is $$ I =\color{blue}{0.462999316582640135993449151416572....} $$
As Lucian pointed out, by the change of variable $\displaystyle u=\tan x$, we readily have $$ I=\int_0^1\left(\frac{1}{\ln u}+\frac{1}{1-u}\right)\frac{1}{1+u^2} \mathrm du. $$ We set $$ I(s):=\int_0^1\left(\frac{1}{\ln u}+\frac{1}{1-u}\right)\frac{u^s}{1+u^2} \mathrm du, \quad s>-1. $$ The expected integral is thus $I(0)$.
Let's differentiate $I(s)$.
We get $$ \begin{align} I'(s)& =\int_0^1\left(\frac{1}{\ln u}+\frac{1}{1-u}\right)\frac{u^s\ln u}{1+u^2} \mathrm du \\\\ & =\int_0^1\left(1+\frac{\ln u}{1-u}\right)\frac{u^s}{1+u^2} \mathrm du \\\\ & =\int_0^1\! \frac{u^s}{1+u^2}\mathrm du +\int_0^1\!\frac{(1+u)u^s \ln u}{(1-u^2)(1+u^2)}\mathrm du \\\\ & =\int_0^1\! \frac{u^s(1-u^2)}{1-u^4}\mathrm du +\int_0^1\!\frac{u^s \ln u}{1-u^4}\mathrm du+\int_0^1\!\frac{u^{s+1} \ln u}{1-u^4}\mathrm du. \end{align} $$ By the change of variable $\displaystyle v=u^4$ in each of the preceding integrals and recalling the well known integral representations for the digamma function $\displaystyle \psi : = \Gamma'/\Gamma$ and for its derivative, $$ \psi(s) = -\gamma+\int_0^1 \frac{1 - v^{s-1}}{1 -v}{\rm{d}} v, \quad s>0, $$ $$ \psi'(s) = -\int_0^1 \frac{s^{s-1} \ln v}{1 - v}{\rm{d}} v, \quad s>0, $$ we obtain
$$ I'(s)=\frac{1}{4}\psi\left(\frac{s+3}{4}\right)-\frac{1}{4}\psi\left(\frac{s+1}{4}\right)-\frac{1}{16}\psi'\left(\frac{s+2}{4}\right)-\frac{1}{16}\psi'\left(\frac{s+1}{4}\right). \tag2 $$
Since $$ \left|\left(\frac{1}{\ln u}+\frac{1}{1-u}\right)\frac{u^s}{1+u^2} \right| < u^s, \quad 0<u<1,\, s>-1,$$ giving $$ |I(s)|\leq \int_0^1\left|\left(\frac{1}{\ln u}+\frac{1}{1-u}\right)\frac{u^s}{1+u^2} \right|\mathrm du < \!\!\int_0^1 u^s\mathrm du = \frac{1}{s+1}, $$ then, as $s \rightarrow +\infty$, we have $I(s) \rightarrow 0$.
We deduce that
$$ I(s)=\log \Gamma \left(\frac{s+3}{4}\right)\!-\!\log \Gamma \left(\frac{s+1}{4}\right) \!-\!\frac{1}{4}\psi\!\left(\frac{s+2}{4}\right)\!-\!\frac{1}{4}\psi\!\left(\frac{s+1}{4}\right) , \, s>-1, \tag3 $$
and, for $s=0$,
$$ \begin{align} I=\frac\pi8+\frac74\ln2+\frac\gamma2+\ln\pi-2\ln \Gamma\left(\frac14\right) \end{align} $$
where have used special values of the digamma function, $$ \begin{align} \psi \left(\frac12\right) & = -\gamma - 2\ln 2, \\ \psi \left(\frac14\right) & = -\gamma + \frac\pi2- 3\ln 2, \end{align} $$ and the complement/reflection formula $$ \Gamma\left(\frac34\right)\Gamma\left(\frac14\right)=\frac{\pi}{\sin(\frac\pi4)}=\pi \sqrt{2}. $$
Noti ce that this is not an answer with same limits as question, but I'm leaving it here for others to help them if the upper limit was changed.
We have the following integral: $$I=\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\tan(x))}+\frac{1}{1-\tan(x)}\right)dx\tag{$I$}$$ Use $\displaystyle \int_0^a f(x) dx=\int_0^a f(a-x) dx$ $$I=\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\tan(\pi/2-x))}+\frac{1}{1-\tan(\pi/2-x)}\right)dx$$ Use $\displaystyle \tan(\pi/2-x)=\cot(x)$ $$ I=\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\cot(x))}+\frac{1}{1-\cot(x)}\right)dx\tag{$II$}$$ Add $(I)$ and $(II)$ $$2I=\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\tan(x))}+\frac{1}{1-\tan(x)}\right)dx+\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{\log(\cot(x))}+\frac{1}{1-\cot(x)}\right)dx$$ Simplify using $\displaystyle \log(\cot x)=\log(1/\tan x)=-\log(\tan x)$ $$2I=\int_{0}^{\Large\frac{\pi}{2}}\left(\frac{1}{1-\cot(x)}+\frac{1}{1-\tan x}\right)dx$$ Use $\displaystyle \cot x\tan x=1$ after taking common denominators to get: $$2I=\int_{0}^{\Large\frac{\pi}{2}}dx=\frac{\pi}2$$ Just the final step: $$I=\frac{\pi}4\Box$$
This is my friend’s solution. He doesn’t use Math Stack Exchange, so I’m posting it on his behalf.
Let $$ I = \int_0^{\pi/4} \left( \frac{1}{\ln(\tan x)} + \frac{1}{1 - \tan x} \right) dx. $$
Set $t = \tan x$, so $x \in [0, \pi/4]$ corresponds to $t \in [0, 1]$ and $dx = \frac{dt}{1 + t^2}$. Then:
$$ I = \int_0^1 \left( \frac{1}{(1 + t^2)\ln t} + \frac{1}{(1 + t^2)(1 - t)} \right) dt = \int_0^1 \frac{1}{1 + t^2} \left( \frac{1}{\ln t} + \frac{1}{1 - t} \right) dt. $$
Break this into two integrals:
$$ I_1 = \int_0^1 \frac{dt}{(1 + t^2)\ln t}, \qquad I_2 = \int_0^1 \frac{dt}{(1 + t^2)(1 - t)}. $$
Use the substitution $t = e^{-s}$ in each integral. Then $dt = -e^{-s} ds$, $t = 1$ corresponds to $s = 0$, and $t \to 0^+$ corresponds to $s \to \infty$. One finds:
$$ I_1 = \int_{\infty}^0 \frac{-e^{-s}}{(1 + e^{-2s})(-s)},ds = \int_0^\infty \frac{e^{-s}}{s(1 + e^{-2s})} ds = \int_0^\infty \frac{ds}{2s\cosh s}, $$
since $1 + e^{-2s} = 2e^{-s} \cosh s$.
Similarly,
$$ I_2 = \int_{\infty}^0 \frac{-e^{-s}}{(1 + e^{-2s})(1 - e^{-s})} ds = \int_0^\infty \frac{e^{-s}}{(1 - e^{-s})(1 + e^{-2s})} ds = \int_0^\infty \frac{ds}{2\cosh s (1 - e^{-s})}. $$
Hence,
$$ I = I_1 + I_2 = \frac{1}{2} \int_0^\infty \frac{1}{\cosh s} \left( \frac{1}{s} + \frac{1}{1 - e^{-s}} \right) ds. $$
Combine the bracketed terms using the expansion:
$$ \frac{1}{1 - e^{-s}} - \frac{1}{s} = \frac{1}{2} + \frac{s}{12} - \frac{s^3}{720} + \cdots, $$
then integrate termwise against $\frac{1}{2\cosh s}$. In particular, use the known series expansions:
$$ \int_0^\infty \frac{s^n}{\cosh s} ds = 2,n! \sum_{k=0}^\infty \frac{(-1)^k}{(2k + 1)^{n+1}} = 2,n! ,\beta(n+1), $$
where $\beta$ is the Dirichlet beta function. After simplifying, one eventually arrives at:
$$ I = \frac{1}{2} - \beta’(0) - \frac{1}{4} \left[ \psi\left( \frac{1}{4} \right) + \psi\left( \frac{1}{2} \right) \right]. $$
Using the known values:
$$ \beta’(0) = \ln\left( \frac{\Gamma(1/4)^2}{2\pi \sqrt{2}} \right), \quad \psi\left( \frac{1}{2} \right) = -\gamma - 2\ln 2, \quad \psi\left( \frac{1}{4} \right) = -\gamma - \frac{\pi}{2} - 3\ln 2, $$
we simplify:
$$ I = \frac{\pi}{8} + \frac{\gamma}{2} + \ln\left( \frac{2^{7/4} \pi}{\Gamma(1/4)^2} \right). $$