I have a long list of real-valued functions I'd like to integrate symbolically. For many of them, Mathematica gives me results with long complex-valued expressions involving weird functions such as EllipticF, even though I know that if I first manually apply a simple substitution such as $u=\sin\theta$ or $u=\cos\theta$, I will get a simple elementary real-valued expression.
As an example, I want to integrate $\arcsin(a/\sin\theta)\cdot\cos\theta$ for some constant $a$ which satisfies $0<a<\sin\theta$ throughout the integration domain. Now, Integrate[ArcSin[a/ Sin[theta]] Cos[theta], theta, Assumptions -> 0<a<Sin[theta]] gives the result
$$\sin (\theta ) \sin ^{-1}(a \csc (\theta ))+\frac{i a \cot \left(\frac{\theta }{2}\right) \sqrt{1-\frac{a^2 \tan
^2\left(\frac{\theta }{2}\right)}{-a^2+2 \sqrt{1-a^2}+2}} \sqrt{\frac{a^2 \tan ^2\left(\frac{\theta }{2}\right)}{a^2+2
\sqrt{1-a^2}-2}+1} \left(F\left(i \sinh ^{-1}\left(\sqrt{\frac{a^2}{a^2+2 \sqrt{1-a^2}-2}} \tan \left(\frac{\theta
}{2}\right)\right)|-\frac{a^2+2 \sqrt{1-a^2}-2}{-a^2+2 \sqrt{1-a^2}+2}\right)-2 \Pi \left(\frac{a^2+2
\sqrt{1-a^2}-2}{a^2};i \sinh ^{-1}\left(\sqrt{\frac{a^2}{a^2+2 \sqrt{1-a^2}-2}} \tan \left(\frac{\theta
}{2}\right)\right)|-\frac{a^2+2 \sqrt{1-a^2}-2}{-a^2+2 \sqrt{1-a^2}+2}\right)\right)}{\sqrt{\frac{a^2}{a^2+2
\sqrt{1-a^2}-2}} \sqrt{\frac{2 a^2+\cos (2 \theta )-1}{\cos (2 \theta )-1}}},$$
where $F=$ EllipticF and $\Pi=$ EllipticPi, but if I first perform the subsitution $u=\sin\theta$ and then evalute Integrate[ArcSin[a/u] , u] /. u -> Sin[theta], I get the much simpler
$$\frac{a \csc (\theta ) \sqrt{\sin ^2(\theta )-a^2} \log \left(\sqrt{\sin ^2(\theta )-a^2}+\sin (\theta )\right)}{\sqrt{1-a^2 \csc ^2(\theta )}}+\sin (\theta ) \sin ^{-1}(a \csc (\theta )).$$
How do I make Mathematica give me the second result without explicitly performing the variable substitution? In my case, all my functions are of the form $\cos\theta\cdot f(\sin\theta)$ or of the form $\sin\theta \cdot f(\sin^2(\theta))$ or of a form which does not need any special substitution (but my list of functions is too long for me to group them according to this). Can I encourage Mathematica to try the substitutions $u=\cos\theta$ and $u=\sin\theta$ first, or can I convince Mathematica that everything is real-valued and not to worry about subtleties concerning complex-valued functions?
0<a<Sin[theta]with the statement thatais a constant sounds strange. – Alexei Boulbitch Aug 19 '14 at 07:26a>0, which made no difference, and I'm not getting any errors assuming alsoa<Sin[theta]so I left it in there. – user19228 Aug 19 '14 at 12:24