What enclosure should I choose to evaluate the next integral using residues? I have to solve the next integral:
$$\int_{-\infty}^{\infty} e^{ibx}(e^{ia/x}-1)dx$$ where $a,b$ are real parameters.
I can use Jordan´s Theorem to show that as $f(z)=e^{ibz}g(z)$ where $g(z)=(e^{ ia /z}-1)$, then if $z=Re^{i{\theta}}$ then $\lim_{R \rightarrow \infty}g(z)=0$
I also know how to calculate $Res_{x=0}e^{ibx}(e^{ia/x}-1)$.
But I don´t know what enclosure to chose to can apply the Cauchy Formula.
I think I have to use someone like this, with the small circle surrounding the 0 but i,m not sure at all. Thanks! 
My biggest problem is that I don´t know how to evaluate $\int_{\gamma (\epsilon)} f(z)$ where in ${\gamma (\epsilon)}$ $z=\epsilon e^{i \theta}$, $\theta \in [\pi, 2\pi]$.
https://www.google.es/search?q=e%5E%7B1/z%7D+residue+contour&espv=2&biw=1242&bih=566&source=lnms&tbm=isch&sa=X&ei=sVyCVcvYCsf4UI6JgpAE&ved=0CAYQ_AUoAQ#imgrc=5bbprXh9H4tq7M%253A%3BBimypvNQtQrz1M%3Bhttp%253A%252F%252Fzen.uta.edu%252Fme5332%252Fresidue_int1.gif%3Bhttp%253A%252F%252Fzen.uta.edu%252Fme5332%252F09.html%3B350%3B201
The integral comes from this, I have to evaluate this density function $$f_t(x)=\frac{1}{2 \pi}\int_{-\infty}^{\infty} \! e^{-ipx}(e^{\lambda t (c_p -1)}-e^{-\lambda t})dp=\frac{1}{2 \pi}\int_{-\infty}^{\infty} \! e^{-ipx}e^{-\lambda t }(e^{\lambda t c_p }-1)dp$$ where $c_p \equiv \mathbb{E}(e^{ipJ})$ and $J$ is a exponencial random variable. So as $c_p \equiv \mathbb{E}(e^{ipJ})=\int_{0}^\infty e^{ipy}h(y)dy$ where $h(y)=\sigma e^{-\sigma y}$, then $c_p=\frac{\sigma}{\sigma -ip}$ so making $q=\sigma -q$, I obtain that my initial problem is to solve the integral I  have put.
 A: To compute the integral
$$\int_{-\infty}^\infty e^{ibx}\bigl(e^{ia/x}-1\bigr)\,dx\tag{$\ast$}$$
for real $a,b$, one uses a contour consisting of two segments on the real axis, $[-R, -\varepsilon]$ and $[\varepsilon,R]$ for $0 < \varepsilon < R$, and two semicircles with centre $0$, one with radius $R$, the other wirh radius $\varepsilon$. The small semicircle is used to avoid the essential singularity of the integrand at $0$ [provided $a \neq 0$, if $a = 0$ the integral is trivially 0]. If $a\neq 0$ and $b\neq 0$, the integral exists as an improper Riemann integral, if $a \neq 0$ and $b = 0$, we must take it as a principal value integral. In all cases, we need to compute
$$\lim_{\substack{R\to\infty\\ \varepsilon \to 0}} \Biggl(\int_{-R}^{-\varepsilon} e^{ibx}\bigl(e^{ia/x}-1\bigr)\,dx + \int_\varepsilon^R e^{ibx}\bigl(e^{ia/x}-1\bigr)\,dx\Biggr).$$
We close the contour with the semicircles to apply the residue theorem. We need to choose the semicircles in the right half-plane, however.
For the large semicircle, to use Jordan's lemma, we need $\operatorname{Re} (ibz) = - b\operatorname{Im} z < 0$ in the relevant half-plane. Thus if $b < 0$, we choose the upper half-plane for the large semicircle, and the lower half-plane if $b < 0$. If $b = 0$, Jordan's lemma isn't applicable in either half-plane, but we have $e^{ia/z} - 1 = \frac{ia}{z} + O(\lvert z\rvert^{-2})$ for large $\lvert z\rvert$, so the limit of the integral over the semicircle can still be determined.
For the small semicircle, we want the integrand to remain bounded as $\varepsilon \to 0$, and that means we require
$$0 > \operatorname{Re} \frac{ia}{z} = \frac{a}{\lvert z\rvert^2}\operatorname{Re} (i\overline{z}) = \frac{a}{\lvert z\rvert^2}\operatorname{Im} z,$$
so if $a > 0$, we choose the small semicircle in the lower half-plane, and in the upper if $a < 0$. This ensures that the integrand remains bounded, $\bigl\lvert e^{ibz}\bigl(e^{ia/z}-1\bigr)\bigr\rvert \leqslant 2e^{\lvert b\rvert}$ on the small semicircle for $0 < \varepsilon \leqslant 1$. So the integral over the small semicircle vanishes as $\varepsilon \to 0$.
It remains to see when the singularity is enclosed by the contour. That is the case if the two semicircles lie in different half-planes, which happens if $a$ and $b$ have different sign. Then the integral is $\pm 2\pi i \operatorname{Res}\Bigl(e^{ibz}\bigl(e^{ia/z}-1\bigr);0\Bigr)$, the sign being $+$ when $b < 0 < a$, and $-$ when $a < 0 < b$. If $a$ and $b$ have the same sign, both semicircles lie in the same half-plane, and the singularity is not enclosed, so the integral is then $0$.
For $b = 0 \neq a$, we can choose the large semicircle in the upper half-plane, the integral then tends to $-\pi a$ as $R\to \infty$, and we obtain the value $\pi a$ for $(\ast)$ if $a < 0$ and $\pi a + 2\pi i \operatorname{Res}\bigl(e^{ia/z};0) = \pi a + 2\pi i (ia) = -\pi a$ if $a > 0$, so either way the value is then $-\pi\lvert a\rvert$.

Let's, for completeness, also compute $f_t(x)$. Ignoring the constant factor $e^{-\lambda t}$, we want to compute
$$\frac{1}{2\pi} \int_{-\infty}^\infty e^{-ipx}\biggl(\exp \Bigl(\frac{\kappa}{\sigma - ip}\Bigr) - 1\biggr)\,dp,$$
where $\kappa = \lambda t\sigma$.
For $\lvert p\rvert$ large, we have
$$\exp \Bigl(\frac{\kappa}{\sigma - ip}\Bigr) - 1 = \frac{\kappa}{\sigma - ip} + O(\lvert p\rvert^{-2}),$$
so by Jordan's lemma
$$\lim_{R\to \infty} \int_{C_R} e^{-ipx}\biggl(\exp \Bigl(\frac{\kappa}{\sigma - ip}\Bigr) - 1\biggr)\,dp = 0,$$
where $C_R$ is the semicircle with radius $R$ and centre $0$


*

*in the upper half-plane, if $x < 0$,

*in the lower half-plane, if $x > 0$.


Thus, since the integrand is holomorphic on $\mathbb{C}\setminus \{-i\sigma\}$ and $\sigma > 0$, we obtain
$$e^{\lambda t} f_t(x) = \begin{cases}\qquad\qquad 0 &, x < 0 \\ -i\operatorname{Res}\biggl(e^{-ipx}\exp\Bigl(\frac{\kappa}{\sigma - ip}\Bigr); -i\sigma\biggr) &, x > 0\end{cases}$$
by the residue theorem. Writing $p + i\sigma = z$ to have a simpler notation, we compute
\begin{align}
e^{-i(z-i\sigma)x}\exp \Bigl(\frac{i\kappa}{z}\Bigr) &= e^{-\sigma x}\biggl(\sum_{n = 0}^\infty \frac{(-ix)^n}{n!}z^n\biggr)\biggl(\sum_{m = 0}^\infty \frac{(i\kappa)^m}{m!}z^{-m}\biggr)\\
&= e^{-\sigma x}\sum_{k = -\infty}^\infty \Biggl(\sum_{n-m = k} \frac{(-ix)^n(i\kappa)^m}{n!m!}z^k\Biggr),
\end{align}
so for the residue we find
$$-i\operatorname{Res}\biggl(e^{-ipx}\exp\Bigl(\frac{\kappa}{\sigma - ip}\Bigr); -i\sigma\biggr) = e^{-\sigma x} \sum_{n = 0}^\infty \frac{x^n\kappa^{n+1}}{n!(n+1)!} = e^{-\sigma x} \sqrt{\frac{\kappa}{x}}\cdot  I_1(2\sqrt{\kappa x}),$$
where $I_1$ is a modified Bessel function.
We have so far ignored $x = 0$. In that case, the integral over the semicircle doesn't tend to $0$, whether we choose the semicircle in the upper or the lower half-plane. But then we can use
$$\exp \Bigl(\frac{i\kappa}{p + i\sigma}\Bigr) - 1 = \frac{i\kappa}{p} + O(\lvert p\rvert^{-2})$$
to see that the integral over the semicircle tends to $-\pi\kappa$. Taking the semicircle in the upper half-plane, the integral over the closed contour is $0$, whence
$$e^{\lambda t} f_t(0) = \frac{\kappa}{2},$$
which, unsurprisingly, is the mean of the left and right limits of $e^{\lambda t}f_t(x)$ at $0$.
