integral of exponential divided by polynomial I would like to solve the integral $$A\int_{-\infty}^\infty\frac{e^{-ipx/h}}{x^2+a^2}dx$$
where h and a are positive constants.
Mathematica gives the solution as $\frac\pi{a}e^{-|p|a/h}$, but I have been trying to reduce my reliance on mathematica. I have no idea what methods I would use to solve it. 
Is there a good (preferably online) resource where I could look up methods for integrals like this fairly easily?
 A: Consider the positively-oriented contour $C$ that spans the real axis from $-R$ to $R$ and then around the semicircle $Re^{i\theta}$ for $0\le \theta\le \pi$.  Let
$$f(x) := \frac{e^{-ipx/h}}{x^2+a^2} = \frac{e^{-ipx/h}}{(x+ia)(x-ia)}$$
Now, we have (if $z_n$ are the poles of $f$ in $C$)
$$\oint_C f(z)\, dz = \int_{-R}^R f(z)\, dz + \oint_{\text Arc} f(z)\, dz = 2\pi i \sum \operatorname*{Res}_{z = z_n} f(z)$$
Letting $R \to \infty$, we see, for $p/h < 0$
$$\int_{\text Arc}\frac{e^{-ipx/h}}{x^2+a^2}\,dz = \int_0^\pi \frac{e^{-ipRe^{i z}/h}}{(Re^{i z})^2+a^2}\,dz = 0$$
$$\oint_C f(z)\, dz = \int_{-\infty}^\infty f(z)\, dz$$
so, because $ia$ lies in $C$ (and is the only pole in $C$)
$$
z_0 = \operatorname*{Res}_{z = ia} f(z) = \lim_{z\to ia}(z-ia)f(z) =  \frac{e^{-ip(i a)/h}}{2ia} = \frac{e^{-pa/h}}{2ia}
$$
so
$$\int_{-\infty}^\infty f(z)\, dz = 2\pi i z_0 = 2\pi i\frac{e^{-pa/h}}{2ia} = \frac{\pi e^{-pa/h}}{a}$$
for $p/h < 0$

Considering the new contour $\Gamma$ which is the same as $C$ except that it traverses $Re^{i\theta}$ for $\pi\le \theta\le 2\pi$, we see that
$$\int_{\text Arc}\frac{e^{-ipx/h}}{x^2+a^2}\,dz = \int_0^\pi \frac{e^{ipRe^{i z}/h}}{(Re^{i z})^2+a^2}\,dz = 0$$
when $p/h > 0$ and $R \to \infty$.  Using the method above, we now have
$$\int_{-\infty}^\infty f(z)\, dz = 2\pi i z_0 = 2\pi i\frac{e^{-pa/h}}{2ia} = \frac{\pi e^{pa/h}}{a}$$
for $p/h > 0$
Putting our results together, we obtain the complete answer
$$\int_{-\infty}^\infty f(z)\, dx = \frac{\pi e^{\left|\frac{p}{h}\right|a}}{a}$$
A: $\mathbf{Method\;1: }$ Integral Fourier Transform
Consider the function $f(t)=e^{-a|t|}$, then the Fourier transform of $f(t)$ is given by
$$
\begin{align}
F(\omega)=\mathcal{F}[f(t)]&=\int_{-\infty}^{\infty}f(t)e^{-i\omega t}\,dt\\
&=\int_{-\infty}^{\infty}e^{-a|t|}e^{-i\omega t}\,dt\\
&=\int_{-\infty}^{0}e^{at}e^{-i\omega t}\,dt+\int_{0}^{\infty}e^{-at}e^{-i\omega t}\,dt\\
 &=\lim_{u\to-\infty}\left. \frac{e^{(a-i\omega)t}}{a-i\omega} \right|_{t=u}^0-\lim_{v\to\infty}\left. \frac{e^{-(a+i\omega)t}}{a+i\omega} \right|_{t=0}^v\\
&=\frac{1}{a-i\omega}+\frac{1}{a+i\omega}\\
&=\frac{2a}{\omega^2+a^2}.
\end{align}
$$
Next, the inverse Fourier transform of $F(\omega)$ is
$$
\begin{align}
f(t)=\mathcal{F}^{-1}[F(\omega)]&=\frac{1}{2\pi}\int_{-\infty}^{\infty}F(\omega)e^{i\omega t}\,d\omega\\
e^{-a|t|}&=\frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{2a}{\omega^2+a^2}e^{i\omega t}\,d\omega\\
\frac{\pi e^{-a|t|}}{a}&=\int_{-\infty}^{\infty}\frac{e^{i\omega t}}{\omega^2+a^2}\,d\omega.
\end{align}
$$
Comparing the last integral to the problem yields $t=-\frac{p}{h}$. Thus,
$$
\int_{-\infty}^{\infty}\frac{e^{-\frac{ipx}{h}}}{x^2+a^2}\,dx=\frac{\pi e^{-a\left|\frac{p}{h}\right|}}{a}.
$$
$\mathbf{Method\;2: }$ 
Note that:
$$
\int_{y=0}^\infty e^{-(x^2+a^2)y}\,dy=\frac{1}{x^2+a^2},
$$
therefore
$$
\int_{x=0}^\infty\int_{y=0}^\infty e^{-(x^2+a^2)y}\;e^{-\frac{ipx}{h}}\,dy\,dx=\int_{x=0}^{\infty}\frac{e^{-\frac{ipx}{h}}}{x^2+a^2}\,dx
$$
Rewrite
$$
\begin{align}
\int_{x=0}^{\infty}\frac{e^{-\frac{ipx}{h}}}{x^2+a^2}\,dx&=\int_{y=0}^\infty\int_{x=0}^\infty e^{-(yx^2+\frac{ip}{h}x+a^2y)}\,dx\,dy\\
&=\int_{y=0}^\infty e^{-a^2y} \int_{x=0}^\infty e^{-\left(yx^2+\frac{ip}{h}x\right)}\,dx\,dy.
\end{align}
$$
In general
$$
\begin{align}
\int_{x=0}^\infty e^{-(ax^2+bx)}\,dx&=\int_{x=0}^\infty \exp\left(-a\left(\left(x+\frac{b}{2a}\right)^2-\frac{b^2}{4a^2}\right)\right)\,dx\\
&=\exp\left(\frac{b^2}{4a}\right)\int_{x=0}^\infty \exp\left(-a\left(x+\frac{b}{2a}\right)^2\right)\,dx\\
\end{align}
$$
Let $u=x+\frac{b}{2a}\;\rightarrow\;du=dx$, then
$$
\begin{align}
\int_{x=0}^\infty e^{-(ax^2+bx)}\,dx&=\exp\left(\frac{b^2}{4a}\right)\int_{x=0}^\infty \exp\left(-a\left(x+\frac{b}{2a}\right)^2\right)\,dx\\
&=\exp\left(\frac{b^2}{4a}\right)\int_{u=0}^\infty e^{-au^2}\,du.\\
\end{align}
$$
The last form integral is Gaussian integral that equals to $\frac{1}{2}\sqrt{\frac{\pi}{a}}$. Hence
$$
\int_{x=0}^\infty e^{-(ax^2+bx)}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{a}}\exp\left(\frac{b^2}{4a}\right).
$$
Thus
$$
\int_{x=0}^\infty e^{-(yx^2+\frac{ip}{h}x)}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{y}}\exp\left(\frac{\left(\frac{ip}{h}\right)^2}{4y}\right)=\frac{1}{2}\sqrt{\frac{\pi}{y}}\exp\left(-\frac{p^2}{4h^2y}\right).
$$
Next
$$
\int_{x=0}^{\infty}\frac{e^{-\frac{ipx}{h}}}{x^2+a^2}\,dx=\frac{\sqrt{\pi}}{2}\int_{y=0}^\infty \frac{\exp\left(-a^2y-\frac{p^2}{4h^2y}\right)}{\sqrt{y}}\,dy.
$$
In general
$$
\begin{align}
\int_{y=0}^\infty \frac{\exp\left(-ay-\frac{b}{y}\right)}{\sqrt{y}}\,dy&=2\int_{v=0}^\infty \exp\left(-av^2-\frac{b}{v^2}\right)\,dv\\
&=2\int_{v=0}^\infty \exp\left(-a\left(v^2+\frac{b}{av^2}\right)\right)\,dv\\
&=2\int_{v=0}^\infty \exp\left(-a\left(v^2-2\sqrt{\frac{b}{a}}+\frac{b}{av^2}+2\sqrt{\frac{b}{a}}\right)\right)\,dv\\
&=2\int_{v=0}^\infty \exp\left(-a\left(v-\frac{1}{v}\sqrt{\frac{b}{a}}\right)^2-2\sqrt{ab}\right)\,dv\\
&=2\exp(-2\sqrt{ab})\int_{v=0}^\infty \exp\left(-a\left(v-\frac{1}{v}\sqrt{\frac{b}{a}}\right)^2\right)\,dv\\
\end{align}
$$
The trick to solve the last integral is by setting
$$
I=\int_{v=0}^\infty \exp\left(-a\left(v-\frac{1}{v}\sqrt{\frac{b}{a}}\right)^2\right)\,dv.
$$
Let $t=-\frac{1}{v}\sqrt{\frac{b}{a}}\;\rightarrow\;v=-\frac{1}{t}\sqrt{\frac{b}{a}}\;\rightarrow\;dv=\frac{1}{t^2}\sqrt{\frac{b}{a}}\,dt$, then
$$
I_t=\sqrt{\frac{b}{a}}\int_{t=0}^\infty \frac{\exp\left(-a\left(-\frac{1}{t}\sqrt{\frac{b}{a}}+t\right)^2\right)}{t^2}\,dt.
$$
Let $t=v\;\rightarrow\;dt=dv$, then
$$
I_t=\int_{t=0}^\infty \exp\left(-a\left(t-\frac{1}{t}\sqrt{\frac{b}{a}}\right)^2\right)\,dt.
$$
Adding the two $I_t$s yields
$$
2I=I_t+I_t=\int_{t=0}^\infty\left(1+\frac{1}{t^2}\sqrt{\frac{b}{a}}\right)\exp\left(-a\left(t-\frac{1}{t}\sqrt{\frac{b}{a}}\right)^2\right)\,dt.
$$
Let $s=t-\frac{1}{t}\sqrt{\frac{b}{a}}\;\rightarrow\;ds=\left(1+\frac{1}{t^2}\sqrt{\frac{b}{a}}\right)dt$ and for $0<t<\infty$ is corresponding to $-\infty<s<\infty$, then
$$
I=\frac{1}{2}\int_{s=-\infty}^\infty e^{-as^2}\,ds=\frac{1}{2}\sqrt{\frac{\pi}{a}}.
$$
Thus
$$
\begin{align}
\int_{y=0}^\infty \frac{\exp\left(-ay-\frac{b}{y}\right)}{\sqrt{y}}\,dy&=2\exp(-2\sqrt{ab})\int_{v=0}^\infty \exp\left(-a\left(v-\frac{1}{v}\sqrt{\frac{b}{a}}\right)^2\right)\,dv\\
&=\sqrt{\frac{\pi}{a}}e^{-2\sqrt{ab}}\\
\end{align}
$$
and
$$
\begin{align}
\int_{-\infty}^{\infty}\frac{e^{-\frac{ipx}{h}}}{x^2+a^2}\,dx&=2\cdot\frac{\sqrt{\pi}}{2}\int_{y=0}^\infty \frac{\exp\left(-a^2y-\frac{p^2}{4h^2y}\right)}{\sqrt{y}}\,dy\\
&=\sqrt{\pi}\cdot\sqrt{\frac{\pi}{a^2}}\;e^{-2\sqrt{a^2\cdot\frac{p^2}{4h^2}}}\\
&=\frac{\pi}{a}\;e^{-\frac{pa}{h}}.
\end{align}
$$

$$
\text{# }\mathbb{Q.E.D.}\text{ #}
$$
