TITLE: How to evaluate $\int_0^{\infty} \bigg(\frac{e^{-x}}{\sinh(x)} - \frac{e^{-3x}}{x}\bigg) \; dx$
QUESTION [7 upvotes]: Evaluate the integral below
$$\int_0^{\infty} \bigg(\frac{e^{-x}}{\sinh(x)} - \frac{e^{-3x}}{x}\bigg) \; dx$$
Using Wolfram I get the integral is $\gamma + \log\bigg(\frac{3}{2}\bigg)$, where $\gamma$ is The Euler-Mascheroni constant.
I split the integral into two parts. For the first one, I tried to use $\sinh(x) = \frac{e^{x}-e^{-x}}{2}=\frac{e^{-x}}{2}(\frac{e^{2x}-1}{2})$ and the first integral became
$$\int_0^{\infty} \frac{2}{e^{2x}-1} \; dx=\int_0^{\infty} \frac{2e^{-2x}}{1-e^{-2x}} \; dx$$
Then, I use substitution $u=1-e^{-2x}$.
$$\int_0^{\infty} \frac{2e^{-2x}}{1-e^{-2x}} \; dx=-4\int_0^{1} \frac{du}{u} = -4\ln u\;\bigg|_0^1 = \infty$$
The second integral also diverges. Where I made a mistake? How is the way to get a result like Wolfram output?

REPLY [3 votes]: Let $u=e^{-x}$, then
\begin{align}
\int^\infty_0\left(\frac{2e^{-x}}{e^{x}-e^{-x}}-\frac{e^{-3x}}{x}\right){\rm d}x
=&\int^1_0\left(\frac{2u}{1-u^2}+\frac{u^2}{\ln{u}}\right){\rm d}u
\end{align}
Denote 
$$\mathcal{I}(a)=\int^1_0\left(\frac{2u}{1-u^2}+\frac{u^2}{\ln{u}}\right)u^a\ {\rm d}u$$
Differentiating under the integral sign, we get
\begin{align}
\mathcal{I}'(a)
=&\int^1_0\left(\frac{2u^{a+1}\ln{u}}{1-u^2}+u^{a+2}\right){\rm d}u\\
=&\frac{1}{a+3}+2\sum^\infty_{n=0}\int^1_0u^{2n+a+1}\ln{u}\ {\rm d}u\\
=&\frac{1}{a+3}-2\sum^\infty_{n=0}\frac{1}{(2n+a+2)^2}\\
=&\frac{1}{a+3}-\frac{1}{2}\psi_1\left(\frac{a+2}{2}\right)
\end{align}
Integrating back,
\begin{align}
\mathcal{I}(a)=\ln(a+3)-\psi_0\left(\frac{a+2}{2}\right)+C
\end{align}
where
\begin{align}
C=\lim_{a\to\infty}\left[\psi_0\left(\frac{a+2}{2}\right)-\ln(a+3)\right]
\end{align}
and by Stirling's formula, we know that $\psi_0(z)\sim \ln{z}$ for large $z$. So
\begin{align}
C=\lim_{a\to\infty}\left[\ln\left(\frac{a+2}{a+3}\right)-\ln{2}\right]=-\ln{2}
\end{align}
and therefore,
$$\int^\infty_0\left(\frac{2e^{-x}}{e^{x}-e^{-x}}-\frac{e^{-3x}}{x}\right){\rm d}x=\mathcal{I}(0)=\gamma+\ln\left(\frac{3}{2}\right)$$