<s>[INST] How to evaluate $\frac{1}{b^2}\int_0^\infty z^{-2}\exp(-a z)\sin^2(b z)\, \mathrm dz$? How can I integrate the following:
$$\frac{1}{b^2}\int_0^\infty z^{-2}\exp(-a z)\sin^2(b z)\, \mathrm dz$$
for $a,b>0$? Maple gives a compact result:
$$\frac{1}{b} \tan^{-1}(c) - \frac{1}{ac^2} \ln(1 + c^2)$$
where $c=2b/a$. I can solve it when the powers of $z$ and $\sin$ are $-1$ and $1$ respectively, but not for 2.
 [/INST] Let $I(a)$ denote the integral. Consider 
$$\begin{eqnarray}
   I^{\prime\prime}(a) &=& \frac{1}{b^2} \int_0^\infty \exp(-a z) \sin^2(b z) \mathrm{d}z = \frac{1}{2b^2} \int_0^\infty \exp(-a z) (1-\cos(2 b z)) \mathrm{d}z \\ 
  &=& \frac{1}{2b^2} \Re \int_0^\infty  (\exp(-a z)-\exp(-(a+ 2i b) z)) \mathrm{d}z = \frac{1}{2b^2} \Re\left(\frac{1}{a} - \frac{1}{a+2 i b}\right) = \frac{2}{a} \frac{1}{a^2 + 4 b^2}
\end{eqnarray}
$$
Now integrate back, using $I(\infty) = 0$ and $I^\prime(\infty)=0$:
$$
   I^{\prime}(a) = \int_{a}^\infty \frac{2}{t} \frac{1}{t^2 + 4 b^2} \mathrm{d}t =  \frac{1}{4 b^2} \log\left(1+ \frac{4b^2}{a^2}\right)
$$
$$
   I(a) = \int_{a}^\infty I^{\prime}(t) \mathrm{d}t = \frac{1}{b} \arctan\left(\frac{2b}{a}\right) - \frac{a}{4b^2} \log\left(1+ \frac{4b^2}{a^2}\right)
$$
</s>