Evaluate $\int_{0}^{\infty} \frac{{(1+x)}^{-n}}{\log^2 x+\pi^2} \ dx, \space n\ge1$

Evaluate the integral

$$\int_{0}^{\infty} \frac{{(1+x)}^{-n}}{\log^2 x+\pi^2} \ dx, \space n\ge1$$


Solution 1:

This is the case $n=1$: $$ \begin{align} \int\limits_{0}^{+\infty}\frac{(1+x)^{-1}}{\log^2 x+\pi^2}dx =\{x=e^{\pi t}\} &=\frac{1}{\pi}\int\limits_{-\infty}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\\ &=\frac{1}{\pi}\left(\int\limits_{-\infty}^{0}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\left(\int\limits_{0}^{+\infty}\frac{e^{-\pi t}}{(1+e^{-\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\left(\int\limits_{0}^{+\infty}\frac{1}{(1+e^{\pi t})(1+t^2)}dt+\int\limits_{0}^{+\infty}\frac{e^{\pi t}}{(1+e^{\pi t})(1+t^2)}dt\right)\\ &=\frac{1}{\pi}\int\limits_{0}^\infty\left(\frac{1}{1+e^{\pi t}}+\frac{e^{\pi t}}{1+e^{\pi t}}\right)\frac{1}{t^2+1}dt\\ &=\frac{1}{\pi}\int\limits_{0}^\infty\frac{1}{t^2+1}dt=\frac{1}{2} \end{align} $$

Solution 2:

This is the same integral as $\frac 1 {2 \pi i} \int_{\mathcal{C}} \frac {d x}{(1+x)^n \ln(-x)}$, where the contour $\mathcal{C}$ starts from infinity, below the positive axis and returns to infinity above the positive axis, after going around zero. Therefore the answer is given by the residue in $x=-1$ which is the coefficient of $y^{n-1}$ in the series expansion of $\frac 1{\ln(1-y)}$. Not sure if there's a closed form for that, but I guess there should be.

EDIT: Here's the reasoning in more detail. First, if $x>0$ then $\ln (-x \pm 0 i) = \ln x \pm \pi i$. Therefore, $$ \frac 1 {\ln(x)^2 + \pi^2} = \frac 1 {2 \pi i} \left(\frac 1 {\ln(x)-\pi i} - \frac 1 {\ln(x) + \pi i}\right), $$ where in the RHS we have the difference between the value of the function $\frac 1 {\ln(-x)}$ above and below the real axis.

enter image description here

Now consider the contour $\mathcal{C}$ shown above in red. When integrating along the part under the positive real axis and above the real axis we end up with the discontinuity across the branch cut. The part at infinity vanishes if $n \geq 1$. Therefore, $$ \frac 1 {2 \pi i} \int_{\mathcal{C}} \frac {d x}{(1+x)^n \ln(-x)} = \frac 1 {2 \pi i} \int_0^\infty \frac {d x}{(1+x)^n} \left(\frac 1 {\ln(-(x+0 i))}-\frac 1 {\ln(-(x-0 i))}\right)= \int_0^\infty \frac {d x}{(1+x)^n (\ln(x)^2 + \pi^2)}. $$

Now we should compute the contour integral. We only have on pole at $x=-1$ so we need to compute its residue: $$ \operatorname{Res}\left(\frac 1{(1+x)^n \ln(-x)},x=-1\right) = \operatorname{Res}\left(\frac 1{y^n \ln(1-y)},y=0\right), $$ which is the same as the coefficient of $y^{n-1}$ in the expansion of $\frac 1 {\ln(1-y)}$, which is often denoted as $[y^{n-1}] \frac 1 {\ln(1-y)}$.

The expansion of $\frac 1 {\ln(1-y)}$ around $y=0$ is easy to find by computer. I find $$ \frac 1 {\ln(1-y)} = -\frac{1}{y}+\frac{1}{2}+\frac{y}{12}+\frac{y^2}{24}+\frac{19 y^3}{720}+\frac{3 y^4}{160}+\frac{863 y^5}{60480}+\frac{275 y^6}{24192}+\frac{33953 y^7}{3628800}+\frac{8183 y^8}{1036800}+O\left(y^9\right), $$ but I can't find a closed form for the $n-1$-th coefficient.

EDIT2:

We want to find the coefficient of $y^k$ in the expansion of $\frac 1 {\ln(1-y)}$. Using Lagrange inversion formula we have that $$ k [y^k] \left(\frac 1 {\ln(1-y)}\right) = -[y] (1-e^y)^{-k} = (-1)^{k+1} [y^{k+1}]\left(\frac y {e^y-1}\right)^k. $$

Now, using the generating function for Stirling polynomials, $$ \left(\frac y {e^y-1}\right)^k = \sum_{p=0}^\infty (-1)^p \frac {S_p(k-1)}{p!} t^p, $$ where $S_p(x)$ are the Stirling polynomials, we have that $$ [y^k] \left(\frac 1 {\ln(1-y)}\right) = \frac {S_{k+1}(k-1)} {k (k+1)!}. $$

When evaluated at integer coefficients $m>n$, the Stirling polynomial $S_n(m)$ can be expressed in terms of Stirling numbers of first kind, but here we are not in that situation...

Edit3: Thanks to a comment below I found out the rational numbers which appear as the result of the integral are called Gregory coefficients (see here for more details and properties).