I am trying to evalute the following integral:
Integrate[Cos[θ] Cos[ArcTan[a^2/b^2 Tan[φ]]], {φ, 0, 2π}]
I know that for $a=b$ I should get 0 out of the integral since I would be integrating something of the form $A \cos \phi d\phi$ completely around a circle.
The issue is that the answer for the equation above is: $\frac{4 b^2 \cos (\theta ) \cos ^{-1}\left(\frac{a^2}{b^2}\right)}{\sqrt{b^4-a^4}}$
Which, if I take the limit $a=b$ like this:
Limit[(4 b^2 ArcCos[a^2/b^2] Cos[θ])/Sqrt[-a^4 + b^4], b -> a]
Results in $4 \cos \theta$ which is typically not 0.
It seems like the $\arctan$-$\tan$ combination is messing things up, but I am not sure. Can anybody explain why this happens and how I can get to the correct solution?
[EDIT]
I am already assuming $a>0$, $b>0$ and both $a$ and $b$ to be real.
[EDIT 2] I only just fully understood what the comment of @b.gatessucks implies: I need to divide the integral in pieces and take care to shift the phase of $\tan$ appropriately.
[EDIT 3]
Physically the meaning of the argument of the $\cos$ looks like this:
Where $\tan \psi = \frac{a^2}{b^2} \tan\phi$. So I know that $\psi$ should run from 0 to 360 deg
Simplify@Cos[ArcTan[ Tan[\[Phi]]]]
->1/Sqrt[Sec[\[Phi]]^2]
so you have a modulus. $\endgroup$