# Evaluating $I(s)=\int_0^{\frac{\pi}{2}}\ln(1+s\tan(\theta))\cot(\theta)d\theta$

Recently I've encountered this interesting integral$$I(s)=\int_0^{\frac{\pi}{2}}\ln(1+s\tan(\theta))\cot(\theta)d\theta=\int_0^{\infty}\frac{\ln(1+sx)}{x}\frac{dx}{x^2+1}$$

I was wondering if this integral has a closed form in terms of polylogarithms or other special functions and I would be grateful if someone could provide the answer or a method for finding it.

Assuming $$s \in \mathbb{R} \wedge s > 0$$, Mathematica gives:
$$I(s) = \frac{1}{24} \left(-6 \text{Li}_2\left(-\frac{1}{s^2}\right)+12 \log (s) \log \left(s+\frac{1}{s}\right)-12 \pi \cot ^{-1}(s)+5 \pi ^2\right)$$
Let $$I(s) = \int_0^{\frac{\pi}{2}} \ln (1 + s \tan \theta ) \cot \theta \, d\theta, \qquad s > 0.$$ Note that $$I(0) = 0$$. Differentiating with respect to $$s$$ we have $$I'(s) = \int_0^{\frac{\pi}{2}} \frac{d\theta}{1 + s \tan \theta}.$$
To find the resulting integral, a $$t$$-substitution of $$t = \tan \frac{\theta}{2}$$ can be used. Here $$d\theta = 2/(1 + t^2) \, dt$$ and $$\tan \theta = 2t/(1 - t^2)$$. Thus \begin{align} I'(s) &= 2 \int_0^1 \frac{1 - t^2}{(1 + t^2)(1 + 2st - t^2)} \, dt\\ &= 2 \int_0^1 \left [\frac{1}{1 + s^2} \cdot \frac{1 - st}{1 + t^2} + \frac{s}{1 + s^2} \cdot \frac{t - s}{t^2 - 2st - 1} \right ] \, dt\\ &= \frac{2}{1 + s^2} \int_0^1 \frac{dt}{1 + t^2} - \frac{s}{1 + s^2} \int_0^1 \frac{2t}{1 + t^2} \, dt + \frac{s}{1 + s^2} \int_0^1 \frac{2t - 2s}{t^2 - 2st - 1} \, dt\\ &= \frac{2}{1 + s^2} \big{[}\tan^{-1} t \big{]}_0^1 -\frac{s}{1 + s^2} \big{[} \ln (1 + t^2) \big{]}_0^1 + \frac{s}{1 + s^2} \big{[} \ln |t^2 - 2st - 1| \big{]}_0^1\\ &= \frac{\pi}{2(1 + s^2)} + \frac{s \ln s}{1 + s^2}. \end{align}
Integrating up with respect to $$s$$: \begin{align} I(s) &= \frac{\pi}{2} \int \frac{ds}{1 + s^2} + \frac{1}{2} \int \frac{2s}{1 + s^2} \cdot \ln s \, ds\\ &= \frac{\pi}{2} \tan^{-1} s + \frac{1}{2} \ln (s) \ln (1 + s^2) - \frac{1}{2} \int \frac{\ln (1 + s^2)}{s} \, ds, \tag1 \end{align} where in the second of the integrals integration by parts has been used. The final integral appearing in (1) can be found in terms of the dilogarithm $$\operatorname{Li}_2 (z)$$. To find this set: $$-x = s^2$$, then $$ds = -dx/(2\sqrt{-x})$$ and yields $$\int \frac{\ln (1 + s^2)}{s} ds = \frac{1}{2} \int \frac{\ln (1 - x)}{x} \, dx = - \frac{1}{2} \operatorname{Li}_2 (x) + C = -\frac{1}{2} \operatorname{Li}_2 (-s^2) + C,$$ where the integral definition for the dilogarithm has been used. Thus (1) becomes $$I(s) = \frac{\pi}{2} \tan^{-1} s + \frac{1}{2} \ln (s) \ln (1 + s^2) + \frac{1}{4} \operatorname{Li}_2 (-s^2) + C.$$ To find the constant $$C$$, as $$I(0) = 0$$, we see that $$C = 0$$. Thus $$I(s) = \frac{\pi}{2} \tan^{-1} s + \frac{1}{2} \ln (s) \ln (1 + s^2) + \frac{1}{4} \operatorname{Li}_2 (-s^2), \qquad s > 0.$$