The problem is from Riley, Hobson and Bence's Mathematical Methods for Physics and Engineering. I followed the standard procedure, changing $x$ to $z$ and factorizing the denominator. Then the integrand is the real part of
$$ \frac{e^{imz}}{(2z-i)(2z + i)(z+i)(z-i)} $$
This integrand satisfies the conditions for Jordan's lemma so if we take a semi circular contour, and let the radius go to infinity, then the integration along the circular part goes to $0$. The poles in the upper half plane are at $z=i$ and $z=\frac{i}{2}$. The problem is in calculating the residue at $z = \frac{i}{2}$. The residue at $z = \frac{i}{2}$ is :
$$ \lim_{z\to \frac{i}{2}} \Bigg[ \Big(z-\frac{i}{2}\Big) \frac{e^{imz}}{(2z-i)(2z+i)(z+i)(z-i)}\Bigg] = \frac{e^{-\frac{m}{2}}}{3 i} $$
Similarly, the residue at $z=i$ is given by $$ \lim_{z\to i} \Bigg[ \Big(z-i\Big) \frac{e^{imz}}{(2z-i)(2z+i)(z+i)(z-i)}\Bigg] = \frac{e^{-m}}{6 i} $$
Since the integrand is even, the required integral is
$$ \frac{1}{2} \times 2 \pi i \times \Big(\frac{e^{-\frac{m}{2}}}{3i} - \frac{e^{-m}}{6i} \Big) = \frac{\pi}{6} \Big( 2 e^{-\frac{m}{2}} - e^{-m}\Big)$$
where the $e^{-\frac{m}{2}}$ coefficient is off by a factor of 2.The problem arises from the residue at $z = \frac{i}{2}$. To verify my answer for the integral, I evaluated the integral using mathematica:
Is this an error in the textbook?
