How to integrate $\int_0^\infty \frac{(x^2+a)^n}{(x^2+b)^m} \>\text{d}x$? How to integrate this guy:
$$\int_0^\infty \frac{(x^2+a)^n}{(x^2+b)^m} \>\text{d}x,$$
where $a,b,n,m$ are positive integers, and $n<m.$
Thank you in advance. :)
 A: In a first step, we perform the substitution $y=x^2$. Then you integral reads
$$ I=\int_0^\infty \!dy \frac{(y+a)^n}{2\sqrt{y}(y+b)^m}.\tag{1}$$
It is easy to show, the this integral is given by
$$I = \oint_C\!dz \frac{(z+a)^n}{4i\sqrt{-z} (z+b)^m} ,\tag{2}$$
where $C$ is the keyhole contour; the branch cut of $\sqrt{z}$ is along the negative real axis.
The keyhole contour is chose such that the large semicircle ($for m \geq n+1/2$) and the small semicircle (around $z=0$) vanish. The remaining integral is along the real axis. Slightly below the real axis (along which you integrate to the left), we have that $1/\sqrt{-z} = -i/\sqrt{z}$. Slightly above the real axis (along which you integrate to the right), we have that $1/\sqrt{-z} = i/\sqrt{z}$. Together, these two contours give $2i/\sqrt{z}$. So in (2) you have to divide by an additional $2i$ with respect to (1).
The integral can thus be solved by the residue theorem. As the only pole is at $z=-b$, we obtain
$$I = 2\pi i \mathop{\rm Res}_{z=-b} \frac{(z+a)^n}{4i\sqrt{-z} (z+b)^m}.$$
As there is an $m$-th order pole at $z=-b$, the result reads
$$I =   \frac{\pi}{2}  \frac{1}{(m-1)!} \lim_{z \to -b} \frac{d^{m-1}}{dz^{m-1}}\left( \frac{(z+a)^n}{\sqrt{-z}} \right).$$
So now we need to evaluate the $m-1$-derivative. You can show by induction that
$$\frac{d^{m-1}}{dz^{m-1}}\left( \frac{(z+a)^n}{\sqrt{-z}}\right)= (m-1)!\sum_{k=0}^{m-1}\binom{n}{k} \frac{  (2 m - 3 - 2 k)!! (a+z)^{n-k}}{(m-1-k)! 2^{m-1-k} (-z)^{m-1/2-k}}.$$
Thus, we obtain the result
$$I= \frac{\pi}{2}\sum_{k=0}^{m-1}\binom{n}{k} \frac{  (2 m - 3 - 2 k)!! (a+z)^{n-k}}{(m-1-k)! 2^{m-1-k} (b)^{m-1/2-k}}$$
A: Assuming $b>0$ and $k<m$
$$\int_{0}^{+\infty}\frac{x^{2k}}{(x^2+b)^m}\,dx = \frac{\Gamma\left(k+\frac{1}{2}\right)\,\Gamma\left(m-k-\frac{1}{2}\right)}{2b^{m-k}(m-1)!}\sqrt{b} $$
follows from Euler's Beta function, hence it is enough to apply a binomial expansion to solve the given integral.
A: Assuming that $m>n+1/2$ so that the integral converges and $m\in\mathbb N$ for simplicity, it's easy enough to apply a semicircle contour, and by Jordan's lemma one can see the circular part of the integral goes to $0$ as $R\to\infty$.  By symmetry, all that remains is twice the integral in interest, and by Cauchy's residue formula, we have
$$\oint_C\frac{(x^2+a)^n}{(x^2+b)^m}\ dx=2\pi i\frac1{(m-1)!}\lim_{x\to bi}\frac{d^{m-1}}{dx^{m-1}}\frac{(x^2+a)^n}{(x+bi)^m}$$
Which finally gives us
$$\int_0^\infty\frac{(x^2+a)^n}{(x^2+b)^m}\ dx=\pi i\frac1{(m-1)!}\lim_{x\to bi}\frac{d^{m-1}}{dx^{m-1}}\frac{(x^2+a)^n}{(x+bi)^m}$$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

With $\ds{\quad a, b, m, n \in \mathbb{N}_{> 0}\quad}$ and
  $\ds{\quad \color{#f00}{m > n + {1 \over 2}}}$,
  note that:
  $$
\int_{0}^{\infty}{\pars{x^{2} + a}^{n} \over \pars{x^{2} + b}^{m}}\,\dd x =
{1 \over b^{m - n - 1/2}}
\int_{0}^{\infty}{\pars{x^{2} + \mu}^{n} \over \pars{x^{2} + 1}^{m}}\,\dd x\,,
\qquad \mu \equiv {a \over b}
$$

\begin{align}
\int_{0}^{\infty}{\pars{x^{2} + a}^{n} \over \pars{x^{2} + b}^{m}}\,\dd x & =
{1 \over b^{m - n - 1/2}}
\int_{0}^{\infty}{\pars{x^{2} + \mu}^{n} \over \pars{x^{2} + 1}^{m}}\,\dd x
\,\,\,\stackrel{x^{2}\ \mapsto\ x}{=}\,\,\,
{1 \over 2b^{m - n - 1/2}}
\int_{0}^{\infty}{\pars{x + \mu}^{n} \over \pars{x + 1}^{m}}\,x^{-1/2}\,\dd x
\\[5mm] & \stackrel{x + 1\ \mapsto\ x}{=}\,\,\,
{1 \over 2b^{m - n - 1/2}}
\int_{1}^{\infty}x^{-m}\,\pars{x - 1}^{-1/2}\,\pars{x - 1 + \mu}^{n}\,\dd x
\\[5mm] & \stackrel{x\ \mapsto\ 1/x}{=}\,\,\,
{1 \over 2b^{m - n - 1/2}}
\int_{1}^{0}x^{m}\pars{{1 \over x} - 1}^{-1/2}\pars{{1 \over x} - 1 + \mu}^{n}
\,{\dd x \over -x^{2}}
\\[5mm] & \stackrel{x\ \mapsto\ 1/x}{=}\,\,\,
{1 \over 2b^{m - n - 1/2}}
\int_{0}^{1}x^{m - n - 3/2}\,\pars{1 - x}^{-1/2}\,
\bracks{1 - \pars{1 - \mu}x}^{\,n}\,\dd x\label{1}\tag{1}
\\[5mm] & =
{1 \over 2b^{m - n - 1/2}}\,
{{}_{2}\mrm{F}_{1}\pars{-n,m - n -1/2;m - n;1  - \mu} \over
\mrm{B}\pars{m - n - 1/2,1/2}}
\end{align}

${}_{2}\mrm{F}_{1}$ is the 'Euler type'
Hypergeometric Function and
  $\ds{\,\mrm{B}}$ is the Beta Function.

$$\bbx{\ds{%
\int_{0}^{\infty}{\pars{x^{2} + a}^{n} \over \pars{x^{2} + b}^{m}}\,\dd x =
{1 \over 2b^{m - n - 1/2}}\,
{{}_{2}\mrm{F}_{1}\pars{-n,m - n -1/2;m - n;\bracks{b - a}/a} \over
\mrm{B}\pars{m - n - 1/2,1/2}}}}
$$
As explained in the above link, the result requires
$\ds{\verts{1 - \mu} \leq 1\ \mbox{and/or}\ 1 \leq {b \over a} \leq 2}$.
Otherwise, we can modify the factor
$\ds{\bracks{1 - \pars{1 - \mu}}^{\,n}}$, in expression \eqref{1}, in a trivial way.
