I am having trouble evaluating the definite integral $$\int_{-\pi}^{\pi} \frac{\sin\phi}{\pi\left( 1-\cos^2\Lambda\cos^2\phi \right)}d\Lambda$$ by the standard technique of the difference of value of the indefinite integral $$\int \frac{\sin\phi}{\pi\left( 1-\cos^2\Lambda\cos^2\phi \right)} d\Lambda = \frac{1}{\pi} \arctan\left(\frac{\tan\Lambda}{\sin\phi}\right)$$ with integration limits substituted. The arctangent has multiple values, and the argument to it is 0 when $\Lambda=\pm\pi$. If I choose the arctangent value as $0$ for both, I get the wrong answer, but if I choose $\pi$ for the upper limit and 0 for the lower, I get the right answer $1$; it must be nonzero because the integrand is always positive (assuming $\sin\phi > 0$). In Maxima, the definite integral computation gives 1, but substituting the indefinite integral gives 0,
Maxima 5.27.0 http://maxima.sourceforge.net
(%i1) pdflambda : sin(phi)/(%pi*(1-(cos(Lambda)*cos(phi))^2));
sin(phi)
(%o1) --------------------------------
2 2
%pi (1 - cos (Lambda) cos (phi))
(%i2) assume((cos(phi))^2 - 1.0 < 0);
2
(%o2) [cos (phi) < 1.0]
(%i3) assume(sin(phi) >= 0);
(%o3) [sin(phi) >= 0]
(%i4) indefint : trigsimp(integrate(pdflambda,Lambda));
sin(Lambda)
atan(--------------------)
cos(Lambda) sin(phi)
(%o4) --------------------------
%pi
(%i5) defint : trigreduce(integrate(pdflambda,Lambda,-%pi,%pi));
(%o5) 1
(%i6) substindef : subst(%pi,Lambda,indefint) - subst(-%pi,Lambda,indefint);
(%o6) 0
What are the evaluation rules for selecting the correct value of arctangent? Even using the two-argument arctangent doesn't help here.