Help with a definite integral of the type $\sqrt{1-A \tan^2 x}$ I am at a loss to evaluate the following integral:
$$
I=\frac{1}{\pi}\displaystyle\int_{q_1}^{q_2} dq\,\sqrt{2m(E-V(q))}
$$
where $V(q)=U\tan^2(\alpha q)$, $U>0$ and $V(q_1)=V(q_2)=E$.  (Thus the integrand vanishes at the endpoints.)
This integral is the action for the potential $V(q)$ in the action-angle formalism of classical mechanics.  The answer is given as
$$
I=\frac{1}{\alpha}\left(\sqrt{2m(E+U)}-\sqrt{2mU}\right)\, .
$$
Mathematica will spit out an answer for the indefinite integral in terms of $\arcsin$ and $\hbox{arctanh}$ but it seems so far from what the answer is that I get no insight into the solution.
The usual tricks - including trig substitutions and various Euler substitutions - do not seem to work.  Since the integrand contains a square, I looked at breaking the integrand to the form $\sqrt{(A-B\tan(\alpha q))(A+B\tan(\alpha q))}$ but this doesn't seem to improve the situation. 
I tried using a complex substitution since Mma tells the antiderivative is expressible as an arctanh but that got me nowhere.  
I thought about trying some version of Leibnitz's rule for definite integrals whose limits are functions of differential variables and take advantage of the property that the integral vanishes at the endpoint, but to no avail.
I suspect there might be a very specific trick which is not very well known.  More probably it's a multistep process with several sequential substitutions which are not immediately obvious.  
I'm stuck and I'll take any serious hint towards the solution.
 A: I'm just going to focus on the form you give in the title, since you can clearly reduce to this form by linear substitution, factorisation and defining $A=U/E$.
Quick and dirty answer
The substitution you want is
$$ x = \arctan{\left( \frac{v}{\sqrt{A(1+v^2)}} \right)}, $$
which changes the integral to
$$ I = \int_{-\arctan{(A^{-1/2})}}^{\arctan{(A^{-1/2})}} \sqrt{1-A\tan^2{x}} \, dx = \int_{-\infty}^{\infty} \frac{\sqrt{A}}{(1+v^2)(A+(1+A)v^2)} \, dv, $$
which easily expands into partial fractions and gives the answer you want, i.e. 
$$ I = \pi(\sqrt{1+A}-\sqrt{A}). $$
More helpful answer
The limits on the original form of $I$ given above should be clear: they are, modulo $2\pi$, the only places we can take so that the integrand vanishes while the area enclosed is positive and finite. The obvious thing to do is get rid of the tangent function, so put $x=\arctan{(y/\sqrt{A})}$, to deal with the factor of $A$. Then $dx=\sqrt{A}/(A+y^2) \, dy$, and the integral becomes
$$ I=\sqrt{A}\int_{-1}^1 \frac{\sqrt{1-y^2}}{A+y^2} \, dy. $$
We still can't really do this, but at least the square root now looks familiar: to get rid of it, take $y=\sin{u}$, $dy=\cos{u} \, du$,
$$ I=\sqrt{A}\int_{-\pi/2}^{\pi/2} \frac{\cos^2{u}}{A+\sin^2{u}} \, du, $$
with no ambiguity in taking the square root since cosine is positive on the interval of integration. We instinctively want to use the double-angle formula here, but it is actually better to just go straight for a $u=\arctan{v}$ substitution: we have by Pythagoras
$$ du = \frac{dv}{1+v^2}, \quad \sin^2{u} = \frac{v^2}{1+v^2}, \quad \cos^2{u} = \frac{1-v^2}{1+v^2}, $$
and so the integral reduces to the form given above.
Edit: The antiderivative
Unwinding the substitution gives $x=\sqrt{A}\tan{x}/\sqrt{1-A\tan^2{x}}$, which we can reinsert into the antiderivative
$$ \sqrt{A+1}\arctan{\frac{\sqrt{A+1}}{\sqrt{A}}v} - \sqrt{A}\arctan{v} $$
to find the extremely memorable (!) antiderivative
$$ \int \sqrt{1-A\tan^2{x}} \, dx = \sqrt{A+1}\arctan{\left( \frac{\sqrt{A+1}\tan{x}}{\sqrt{1-A\tan^2{x}}} \right)} - \sqrt{A}\arctan{\left( \frac{\sqrt{A}\tan{x}}{\sqrt{1-A\tan^2{x}}} \right)}. $$
Joy of joys, we notice that taking $\sqrt{1-A\tan^2{x}} \downarrow 0$ for $\tan{x} \lessgtr 0$ also gives the right answer (remembering to include both positive and negative endpoints).
