Calculate $\int_{\mu}^{2t} \frac{1}{E+2\mu -2\epsilon}\frac{1}{\sqrt{4t^2-\epsilon^2}} \mathrm dx$ I stumbled upon this integral while doing Solid-state physics homework:
$$\int_\mu^{2t} \frac{1}{E+2\mu -2\epsilon}\frac{1}{\sqrt{4t^2-\epsilon^2}} \mathrm d\epsilon$$
where $E<0$, $\mu \in (-2t,2t)$ and $t>0$.
I tried plugging it into Mathematica:
Integrate[1/(e + 2 \[Mu] - 2 x) 1/Sqrt[4 t^2 - x^2], {x, \[Mu], 2 t}, 
Assumptions -> -2 t < \[Mu] < 2 t && t > 0 && e < 0]

and got the following answer:
$$-\frac{1}{2} \pi  \sqrt{\frac{1}{E^2+4 E \mu +4 \mu ^2-16 t^2}}-\frac{\arctan\left(\frac{\mu  (E+2 \mu )-8 t^2}{\sqrt{\left(4 t^2-\mu ^2\right) \left(E^2+4 E \mu +4 \left(\mu ^2-4 t^2\right)\right)}}\right)}{\sqrt{E^2+4 E \mu +4 \left(\mu ^2-4 t^2\right)}}$$
This result gives correct "physical" interpretation, so now I would like to know how this integral was
calculated.
My first guess was to use substitution $\epsilon = 2t\sin{x}$ and transform this integral to
$$\int_{\arcsin{\frac{\mu}{2t}}}^{\frac{\pi}{2}} \frac{\mathrm dx}{E+2\mu - 4t\sin{x}}
$$
Here I thought about trying to evaluate indefinite integral by doing the standard substitution $u = \tan{\frac{x}{2}}$, however I hesitated after reading this comment.
Is there any other way to obtain the result in closed form like the one obtained from Mathematica?
 A: If you just ask Mathematica to compute the antiderivative without any assumption, you should receive
$$I=\int \frac{dx}{\sqrt{4 t^2-x^2} (e+2 \mu -2 x)}=$$
$$\sqrt{-e^2-4 e \mu -4 \mu ^2+16 t^2}\,I=-\log (e+2 \mu -2 x)+$$ $$\log \left(\sqrt{4 t^2-x^2} \sqrt{-e^2-4 e \mu -4 \mu ^2+16 t^2}-e x+8 t^2-2 \mu 
   x\right)$$  and I suppose that the arctangent comes from the combination of the logarithms.
A: Introduce
$$ f \colon (-1,1) \times (0,\infty) \to \mathbb{R} \, , \, f(m,w) = \int \limits_m^1 \frac{\mathrm{d} v}{(v-m+w)\sqrt{1-v^2}} \, ,$$
to simplify the notation. Your integral then equals $- \frac{1}{4t} f\left(\frac{\mu}{2t},-\frac{E}{4t}\right)$ (just let $v = \frac{\varepsilon}{2t}$).
In order to compute the integral we proceed as you suggested: we let $v = \cos(x)$ (slightly easier than $v = \sin(x)$) and then $\tan\left(\frac{x}{2}\right) = u$ to obtain
\begin{align}
f(m,w) &= \int \limits_m^1 \frac{\mathrm{d} v}{(v-m+w)\sqrt{1-v^2}} = \int \limits_0^{\operatorname{arccos(m)}} \frac{\mathrm{d} x}{\cos(x)-m+w} \\
&= 2 \int \limits_0^{\sqrt{\frac{1-m}{1+m}}} \frac{\mathrm{d} u}{1-m+w + [w-(1+m)] u^2}
\end{align}
for $(m,w) \in (-1,1) \times (0,\infty)$. The next step depends on the relation between $m$ and $w$ (or $\mu$ and $E$ in the original problem). More precisely, depending on the sign of $w - (1+m)$, after one more substitution we get the following results for $(m,w) \in (-1,1) \times (0,\infty)$:
$$ f(m,w) = \begin{cases} 
\frac{2 \operatorname{artanh} \left(\sqrt{\frac{(1+m-w)(1-m)}{(w+1-m)(1+m)}}\right)}{\sqrt{1-(m-w)^2}} &, \, w < 1+m \\
\sqrt{\frac{1-m}{1+m}} &, \, w = 1+m \\
\frac{2 \arctan \left(\sqrt{\frac{(w-(1+m))(1-m)}{(w+1-m)(1+m)}}\right)}{\sqrt{(m-w)^2 - 1}} &, \, w > 1+m
\end{cases} \, .$$
Plugging the original variables into these results (and using the relation $\arctan(x) + \arctan\left(\frac{1}{x}\right) = \frac{\pi}{2}$ for $x > 0$), we see that your Mathematica expression corresponds to the third case, though it covers all cases if complex numbers and limits are taken into account properly.
