<s>[INST] A little more integration. Help integrating
$$\int\cos^{-1}(a\tan\theta)\ d\theta$$
I understand that Wolfram gives a solution, but I'd like to know the steps. I haven't been able to rewrite the equation into anything helpful.
 [/INST] Mathematica outputs $$\theta \cos ^{-1}(a \tan (\theta))+\frac{1}{4} \left(4 \theta \sin ^{-1}(a \tan (\theta))+i \left(2 i \left(\text{Li}_2\left(\left(\sqrt{a^2+1}-a\right) e^{-i \sin ^{-1}(a \tan (\theta))}\right)+\text{Li}_2\left(-\left(a+\sqrt{a^2+1}\right) e^{-i \sin ^{-1}(a \tan (\theta))}\right)\right)-2 i \left(\text{Li}_2\left(\left(a-\sqrt{a^2+1}\right) e^{-i \sin ^{-1}(a \tan (\theta))}\right)+\text{Li}_2\left(\left(a+\sqrt{a^2+1}\right) e^{-i \sin ^{-1}(a \tan (\theta))}\right)\right)+\left(-2 \sin ^{-1}(a \tan (\theta))-4 \sin ^{-1}\left(\frac{\sqrt{1+i a}}{\sqrt{2}}\right)+\pi \right) \log \left(1-\left(\sqrt{a^2+1}+a\right) e^{-i \sin ^{-1}(a \tan (\theta))}\right)-\left(-2 \sin ^{-1}(a \tan (\theta))+4 \sin ^{-1}\left(\frac{\sqrt{1-i a}}{\sqrt{2}}\right)+\pi \right) \log \left(e^{-i \sin ^{-1}(a \tan (\theta))} \left(-\sqrt{a^2+1}+e^{i \sin ^{-1}(a \tan (\theta))}+a\right)\right)+\left(-2 \sin ^{-1}(a \tan (\theta))+4 \sin ^{-1}\left(\frac{\sqrt{1+i a}}{\sqrt{2}}\right)+\pi \right) \log \left(e^{-i \sin ^{-1}(a \tan (\theta))} \left(\sqrt{a^2+1}+e^{i \sin ^{-1}(a \tan (\theta))}-a\right)\right)-\left(-2 \sin ^{-1}(a \tan (\theta))-4 \sin ^{-1}\left(\frac{\sqrt{1-i a}}{\sqrt{2}}\right)+\pi \right) \log \left(e^{-i \sin ^{-1}(a \tan (\theta))} \left(\sqrt{a^2+1}+e^{i \sin ^{-1}(a \tan (\theta))}+a\right)\right)-8 i \sin ^{-1}\left(\frac{\sqrt{1-i a}}{\sqrt{2}}\right) \tan ^{-1}\left(\frac{(a-i) \cot \left(\frac{1}{4} \left(2 \sin ^{-1}(a \tan (\theta))+\pi \right)\right)}{\sqrt{a^2+1}}\right)+8 i \sin ^{-1}\left(\frac{\sqrt{1+i a}}{\sqrt{2}}\right) \tan ^{-1}\left(\frac{(a+i) \cot \left(\frac{1}{4} \left(2 \sin ^{-1}(a \tan (\theta))+\pi \right)\right)}{\sqrt{a^2+1}}\right)+2 \log (a+i a \tan (\theta)) \sin ^{-1}(a \tan (\theta))+\log (a+i a \tan (\theta)) \left(\pi -2 \sin ^{-1}(a \tan (\theta))\right)-2 \log (a-i a \tan (\theta)) \sin ^{-1}(a \tan (\theta))-\log (a-i a \tan (\theta)) \left(\pi -2 \sin ^{-1}(a \tan (\theta))\right)\right)\right)$$
</s>