# Improper integral of $\exp[-(a+bi)x]\log x$

Prove:\begin{align*}\mathcal{I} & =\int\limits_0^{\infty}dx\, e^{-ax}\log x\cos bx\\ & =-\frac a{a^2+b^2}\left[\gamma+\log\sqrt{a^2+b^2}+\frac ba\arctan\frac ba\right]\end{align*}

This is what I've done so far, but I'm not getting the exact answer the problem has. I rewrote $\mathcal{I}$ as$$\mathcal{I}=\Re\left[\mathcal{J}\right]=\Re\left[\lim\limits_{\mu\to0}\frac {\partial}{\partial\mu}\int\limits_0^{\infty}dx\, e^{-(a+bi)x}x^{\mu}\right]$$Substitute $t=(a+bi)x$ so\begin{align*}\mathcal{J} & =\lim\limits_{\mu\to0}\frac {\partial}{\partial\mu}(a+bi)^{-\mu}\int\limits_0^{\infty}dt\, e^{-t}t^{\mu}\\ & =\lim\limits_{\mu\to0}\frac {\partial}{\partial\mu}\left[\left(\frac 1{a+bi}\right)^{\mu}\Gamma(\mu+1)\right]\end{align*}However, if I differentiate and take the limit, I'm just left with$$\mathcal{J}=-\gamma-\log(a+bi)=-\gamma-\log\sqrt{a^2+b^2}-i\arctan\frac ba$$Which is completely different than the answer given above. Where did I go wrong? I'm not entirely sure. The fact that we need to recover the real part of $\mathcal{J}$ doesn't help either.

Rotating the contour back to the real axis after substituting, which works out without difficulty, your substitution isn't quite right: $dx = dt/(a+bi)$, so actually $$\int_0^{\infty} e^{-(a+bi)x} x^{\mu} \, dx = (a+bi)^{-\mu-1} \int_0^{\infty} e^{-t} t^{\mu} \, dt.$$ (we can check this by comparison with the elementary $$\int_0^{\infty} e^{-(a+bi)x} \, dx = \int_0^{\infty} e^{-ax}(\cos{bx}+i\sin{bx}) \, dx = \frac{a}{a^2+b^2}-i\frac{b}{a^2+b^2} = \frac{1}{a+bi})$$ Hence the actual answer is yours divided by an extra $a+bi$, so the real part is $$\frac{1}{a^2+b^2} (a(-\gamma-\log{\sqrt{a^2+b^2}}) - b\arctan{\frac{b}{a}}),$$ which rearranges into the given expression.