Say $\displaystyle f(x) = a_nx^n+...+a_1x+a_0$ is a real polynomial with $\displaystyle \deg f(x) \geq 2$ with no real zeros.

Say we want to find,

$\displaystyle \int_{-\infty}^{\infty} \frac{1}{f(x)} dx$.

Here are the steps:

1)Find the zeros (which are complex) of $\displaystyle f(x)$.

2)Disregard (throw away) the zeros that lie in the lower half plane (so for example, ignore $\displaystyle -i$).

3)Compute the multiplicity of each zero.

4)If $\displaystyle a$ is a zero of $\displaystyle f(x)$ with multiplicity $\displaystyle k$ compute: $\displaystyle \frac{1}{(k-1)!}\cdot \frac{d^{k-1}[(x-a)^{k-1}/f(x)]}{dx^k}$ evaluated at $\displaystyle a$.

5)Sum up all the values in step #4.

6)Multiply the total sum from #5 by $\displaystyle 2\pi i$.

7)The value of the integral is equal to the value in #6.

Here is an example.

Say you want to find,

$\displaystyle \int_{-\infty}^{\infty} \frac{1}{f(x)} dx$ where $\displaystyle f(x)=x^2+1$.

Now do the steps.

1)The zeros of $\displaystyle f(x)$ are $\displaystyle +i,-i$.

2)We disregard $\displaystyle -i$ because it is a lower half of plane.

3)The multiplicity of $\displaystyle i$ is $\displaystyle 1$. Thus $\displaystyle a=i$ and $\displaystyle k=1$

4)Compute $\displaystyle \frac{1}{(1-1)!}\cdot \frac{d^0[(x-i)/(x^2+1)]}{dx^0}$ thus $\displaystyle \frac{1}{x+i}\big|_{x=i}=\frac{1}{2i}$

5)There is only one value so the total sum is just $\displaystyle 1/2i$

6)Multiply by $\displaystyle 2\pi i$ to get $\displaystyle 2\pi i (1/2i) = \pi$.

7)The value of the integral is $\displaystyle \pi$.

A real timesaver

Suppose $\displaystyle f(x)$ has zeros of multiplicity $\displaystyle 1$. Then doing the ugly step in #4 is really easy because you are computing the $\displaystyle 0$-th derivative (which is just doing the derivative 0 times, i.e. not doing anything). Let $\displaystyle a_1,a_2,...,a_n$ be its complex zeros. Since $\displaystyle f(x)\in \mathbb{R}[x]$ it means the complex values occur in complex conjugates pairs. Thus, half of these zeros are in the upper plane and half of these zeros are in the lower plane...

SORRY, I have to stop now. I will try to complete this post.

Have fun!