I'm reading a paper which therein the author claims:
$$\int_0^\infty dx \frac{e^{-m^2 x}}{x^2} \left[a x \cot (a x) - 1\right] = a K \left(\frac{i m^2}{2 a}\right)$$
where $m$ and $a$ are real, and
$$K(z) = 2 i \left[\left(z - \frac{1}{2}\right)\log z - z - \log \Gamma(z) + \frac{1}{2} \log 2 \pi\right]$$
How can one verify this?
I tried to investigate it numerically, which it seems to be correct. For example, for $m = 4$ and $a = 3$, Mathematica returns $-0.18842$ for the integral, and $-0.18842 - i 1.5865 \cdot 10^{-7}$ for the right hand side. For other values of $m$ and $a$, it seems one should consider the real part of the function $K$.
To long for a comment. $K(z)$ is related to the Binet's Log Gamma Formulas Binet's, where only the factor $2\,i$ is different. The relation of the integral in the Binet' formulas and your's have to be shown.
EDIT: I tried to show the relation and proof the identity:
$\int_0^{\infty } \frac{e^{-tz} \left(\frac{t}{2} \cot \ \left(\frac{t}{2}\right)-1\right)}{t^2} \, dt=-2 \int_0^{\infty } \ \frac{\tanh ^{-1}\left(\frac{t}{z}\right)}{e^{2 \pi t}-1} \, dt$ for $z=\frac{m^2}{2a}$
Numerical experiment show, that the right hand side is just an approximation of the left hand side for $z>>1$. In other words your solution is only an approximation.
Proof of the identity
The statement above is not correct, I managed to find the proof of the identity.
We start with the identity above:
$$\int_0^{\infty } \frac{e^{-m^2 x} (a x \cot (a x)-1)}{x^2} \, dx=a \ K\left[\frac{i\, m^2}{2 a}\right]$$
with
$$K(z)=2 i \left(\left(z-\frac{1}{2}\right) \log (z)-z-\log (\Gamma \ (z))+\frac{1}{2} \,\log (2\, \pi )\right)$$
Set: $y = 2 \,a\, x$ and $z=\frac{i\,m^2}{2\,a}$
$$\int_0^{\infty } \frac{2\, a \,\left(\frac{y}{2} \,\cot \left(\frac{y}{2}\right)-1\right) e^{i\,z\,y}}{y^2}\, dy=2\,a\, i \left(\left(z-\frac{1}{2}\right) \log (z)-z-\log (\Gamma \ (z))+\frac{1}{2} \,\log (2\, \pi )\right)$$
Differentiate both sides with respect to z:
$$\int_0^{\infty } \frac{e^{i\, y \,z} \left(\frac{y}{2}\, \cot\left(\frac{y}{2}\right)-1\right)}{y} \, dy=-\frac{1}{2 z}+\log \ (z)-\psi(z)$$
where $\psi(z)$ is the digamma function.
3.) Redefine z
It is easier to go further with $w=\frac{z}{i}$
4.) Integration
We split the indefinite integral in two parts:
$$\int \frac{e^{-w\, y} \left(\frac{y}{2} \cot \left(\frac{y}{2}\right)-1\right)}{y} \, dy=\frac{1}{2} \int e^{-w \,y} \cot \left(\frac{y}{2}\right)\, dy-\int \frac{e^{-w\, y}}{y} \, dy$$
and substitute the integration limits later. The first Integral is just the half of the Laplace-Transform of ${\cot \left(\frac{y}{2}\right)}$. The last integral is the well known ExpIntegraE - Function $\text{Ei}(-w\, y)$. The first integral can also alternatively done with Mathematica:
$$\frac{1}{2} \int e^{-w\, y} \cot \left(\frac{y}{2}\right) \, \ dy=-\,\frac{1}{2} \left(B_{e^{i\, y}}(1+i\, w,0) + B_{e^{i\, y}}(i\, w,0)\right)$$
where $B_z(a,b)$ is the Euler beta function. One can proof that by differentiation.
5.) Insertion of integration limits
If we insert the integration limits we finally get:
$$\int_0^{\infty } \frac{e^{-w\, y} \left(\frac{y}{2} \cot\left(\frac{y}{2}\right)-1\right)}{y} \, dy= -\, \frac{1}{2} \left(\log\left(-\frac{1}{z}\right)-\log(-z)+\psi(1+i\, z)+\psi(i\, z)-i \,\pi \right)$$
Further simplification and using:
$$\frac{1}{2} \psi(1+i\, z)+\frac{\psi(i \,z)}{2}=\psi(i\, w)-\frac{i}{2\, w}$$ leads to the postulate identity.