Welcome to the Maths forum MathsArthur! I've added comments below which hopefully you will find useful.

Quote:
 Originally Posted by MathsArthur I have an equation. closed line integral ( dx/(a + b*cos(x)) ) between 0 and 2pi
Just a small point here, this isn't a "closed" line integral yet - it is just a real integral over the real interval 0 to

It changes to a closed line integral only after you make the change of variable substitution below. Then you start tackling the problem using residue methods in the complex plane.

Quote:
 using the change of variable z=r*exp(i*x), we get closed line integral ( -i*dz/(z-r*m1)(z-r*m2) ) between 0 and 2pi where m1 and m2 are functions of a and b only
Just out of curiousity, why do you bother to include the 'r' in your change of variable expression at all? It's much easier if you just integrate around the unit circle. . Maybe you have some other reason though?

I think this step is also where your problem lies. You have assumed that the polynomial you get on the bottom is monic, and you've just written the expression as

when actually it should be

where is some constant. This won't affect the value of the roots, but it will affect the value of the residues.

Quote:
 the residuals are then (-i/r)*(m1-m2) and (i/r)*(m1-m2) and their sum is zero the resolution is that you only include the pole nearest the origin to calculate the integral. Why is this?
Those 's should not be present. This is a result of assuming the monic polynomial as explained above.

You only include the residues inside the closed curve you are integrating over in the complex plane. This is a result of the Resiude Theorem.

Quote:
 Also, the residuals are a function of r, so the integral has a different value depending on the size of the circle you integrate around contradicting the residue theorem that says that the integral is independent of the path.
Again, this is a result of assuming a monic polynomial above.