<s>[INST] What is wrong with this integration of $ \int_0^{2\pi}\sin x /(1 + A \sin x)$ A worked solution of the integral has been provided as an answer to a previous question.
But I am still unclear why I get the wrong answer from the following method which uses a formula for the definite integral provided by Wolfram Alpha.
Wolfram Alpha indicates the following solution formula:-
$$
\int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx
= 
(1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + constant\right)^{2\pi}_0
$$
My thinking is that substituting for $x$ by $2 \pi$ and by $0$ leads to the corresponding values of $\tan(x/2)$ being the same, namely $\tan(\pi) = \tan(0) = 0$. It follows therefore that the fractional term:-
$$
\frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}}
$$ 
has the same value ( let us call it $Q$ ) for $x=2\pi$ and $x=0.$ Therefore the definite integral becomes
$$
\int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx
= 
(1/A)\left( (2\pi - Q + constant) - (0 - Q + constant) \right)
= 2\pi/A.
$$
For $A = 0.2$ we derive the result 
$$
\int_0^{2\pi} \frac{\sin x}{1 + 0.2 \sin x} dx
= 10 \pi.
$$
However Wolfram Alpha gives the answer as $-0.64782$ (approx.) which is reasonable looking at the graph and agrees with the formula provided in @abel's answer to my previous question.
So what is wrong with my reasoning?  I realize that the $\tan$ function is not continuous over the range $0,2\pi$ but I don't know what that implies for the analysis of the definite integral.  What rules or tricks should I apply in order to use the Wolfram Alpha formula?  Must I always beware the appearance of $\tan()$ functions in integrand formulae? 
 [/INST] Using the guidance provided by Chappers and Hans I have come up with this approach.
The Wolfram Alpha solution is:-
$$
\int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx
= 
(1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)^{2\pi}_0
$$
The  antiderivative (on the RHS of the equation above) cannot be evaluated by plugging in values for the limiting values of $x=0$ and $x=2\pi$ because the $\tan^{-1}$ term in the anti-derivative function is not continuous over the range $0..2\pi$ 
See this plot. 
However the $\tan^{-1}$ term is cyclic with a period of $\pi$.  Therefore the definite integral over $0..2\pi$ is the same as the definite integral over any other range of length $2\pi$ or two times the definite integral over any range of length $\pi$. We proceed by selecting one particular range: $-\pi/2..\pi/2$ over which the $\tan^{-1}$ term  is continuous.  We will need to multiply the expression by two to compensate for the difference in ranges.
Proceeding thus...
$$
\int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx
= 
Q = 
(2*1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)_{-\pi/2}^{+\pi/2}
$$
$$Q =  
(2/A) \left[
\left( \pi/2- \frac{2 \tan^{-1} \left( \frac{A + \tan{(+\pi/4)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)
- 
\left( (-\pi/2) - \frac{2 \tan^{-1} \left( \frac{A + \tan{(-\pi/4)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)
\right]
$$
$$Q =  
(2/A) \left[
 \pi - \frac{ 2\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} 
+ 
\frac{ 2\tan^{-1} \left( \frac{A -1}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} 
\right]
$$
$$Q = 
\frac{2}{A} \left[
 \pi 
+ 
\frac{ 2\tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right)
      -2\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right)
     }
     {\sqrt{(1-A^2)}} 
\right]
$$
It happens that (for $0<A<1$) (tested in Excel, see Note at bottom of answer)
$$
 \tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right)
      -\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right)
=\tan^{-1} (-\infty)
= - \pi/2
$$
and so we get
$$
\int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx
= Q
=
\frac{2\pi}{A} \left[
 1- \frac{1}{\sqrt{(1-A^2)}} 
\right]
$$
which is the same as the answer derived by @abel in answer to the previous question and for which, with $A=0.2$ we get the result $Q=-0.64782$ (approx.).
============================================================
Note
No proof is provided here for the assertion that ( for $0<A<1$ )
$$
 \tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right)
      -\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right)
=\tan^{-1} (-\infty)
= - \pi/2
$$
However it can be checked (a) by testing in a spreadsheet such as Excel or (b) using the inverse-tangent addition theorem:-
$$
\tan^{-1} x \pm \tan^{-1} y = \tan^{-1} \left( \frac{x \pm y}{1 \mp xy} \right).
$$
</s>