TITLE: How to prove $\int_0^\infty\frac {\tanh(x)-x\exp(-x)}{x^2}dx=\frac{\zeta'(0)}{\zeta(0)}-\frac{\zeta'(2)}{\zeta(2)}+\gamma-\frac73\log(2)$?
QUESTION [17 upvotes]: By educated guessing, inspired by this solution of $\int_0^\infty\frac {\tanh^3(x)}{x^2}dx$, I have found numerically: $$\int\limits_0^\infty\frac {\tanh(x)-x\exp(-x)}{x^2}dx=\frac{\zeta'(0)}{\zeta(0)}-\frac{\zeta'(2)}{\zeta(2)}+\gamma-\frac73\log(2).$$ The method should be similar to the quoted one, i.e. applying the residue theorem to a keyhole contour integral: $$  \frac{1}{2\pi i} \oint \frac {\tanh(z)-z\exp(-z)}{z^2}\log(-z) \, dz.$$ While I guessed correctly that, unlike in the original one, a term with $\gamma=-\int\limits_0^\infty\exp(-x)\log(x)dx$ will survive even in a more elegantly written closed form, I have a hard time understanding how/why the "regulating part" $\dfrac {\exp(-z)}{z}$ contributes to the sum of residues.
Even if it contributed its own residue at $z=0$ (but how can it, as $z=0$ is outside the contour?), I wouldn't see how this residue could lead to $\gamma$.
Any hints, please?

REPLY [10 votes]: To the nice solution by @metamorphy and solutions of the similar problem (the link provided by @Random Variable) I would like to add the heuristic solution via complex integration. I hope it brings some value, too.
Let's denote
$$I=\int_0^\infty\Big(\frac{\tanh x}{x^2}-\frac{e^{-x}}{x}\Big)dx$$
We will consider instead
$$I_\epsilon=\int_0^\infty\Big(x^{\epsilon-2}\tanh x \,-e^{-x}x^{\epsilon-1}\Big)dx=I_{1\epsilon}+I_{2\epsilon}$$
where we keep $\epsilon\ll1$ but fixed, and will take the limit $\epsilon\to0$ at the end of our evaluation.
Now we have the regularized integrals and can treat them separately. The second term
$$I_{2\epsilon}=-\int_0^\infty e^{-x}x^{\epsilon-1}dx=-\Gamma(\epsilon)=-\frac{1}{\epsilon}+\gamma+O(\epsilon)$$
To evaluate the first term, we go to the complex plane and integrate along the keyhole contour:

$$\oint z^{\epsilon-2}\tanh z \,dz=I_{1\epsilon}\big(1-e^{2\pi i\epsilon}\big)+I_r+I_R=2\pi i\sum\operatorname{Res}z^{\epsilon-2}\tanh z$$
where $I_r, I_R$ denote integration along a small circle around $z=0$ with the radius $r\to0$ and along a big circle of the radius $R\to\infty$ correspondingly. It is not difficult to show that both integral tend to zero. We have simple poles inside the contour at $z=\big(\frac{\pi}{2}+\pi k\big)e^{\pi i/2}$ and $z=\big(\frac{\pi}{2}+\pi k\big)e^{3\pi i/2}$.
The residue evaluation is straightforward. Keeping only the terms $O(1)$, we get
$$I_{1\epsilon}=\frac{2}{\epsilon}\sum_{k=0}^\infty\frac{1+\epsilon\ln\big(\frac{\pi}{2}+\pi k\big)}{\big(\frac{\pi}{2}+\pi k\big)^2}+O(\epsilon)$$
Using
$$\sum_{k=0}^\infty\frac{1}{\big(\frac{\pi}{2}+\pi k\big)^2}=\frac{4}{\pi^2}\sum_{k=0}^\infty\frac{1}{\big(1+2k\big)^2}=\frac{1}{2}$$
and
$$\sum_{k=0}^\infty\frac{\ln(1+2k)}{(1+2k)^l}=-\frac{\partial}{\partial l}\sum_{k=0}^\infty\frac{1}{(1+2k)^l}=-\frac{\partial}{\partial l}\zeta(l)(1–2^{-l})=-\zeta’(l)(1–2^{-l})-\frac{\ln2\,\zeta(l)}{2^l}$$
(where $\zeta(l)$ denotes zeta-function), we get
$$2\sum_{k=0}^\infty \frac{\ln\big(\frac{\pi}{2}+\pi k\big)}{\big(\frac{\pi}{2}+\pi k\big)^2}=\ln\frac{\pi}{2}-\frac{\ln2}{3}-\frac{6\,\zeta’(2)}{\pi^2}$$
$$I_\epsilon=I_{1\epsilon}+I_{2\epsilon}=\frac{1}{\epsilon}+\ln\frac{\pi}{2}-\frac{\ln2}{3}-\frac{6\,\zeta’(2)}{\pi^2}-\frac{1}{\epsilon}+\gamma+O(\epsilon)$$
As expected, the diverging terms cancel. Taking the limit $\epsilon\to0$ and using the expression for $\zeta’(2)$, we get the answer in the form provided by @metamorphy.