Indefinite Integration of $(\arctan(x))^2$ $$
\mbox{Hello. I was wondering how to integrate this:}\quad
\int\arctan^{2}\left(x\right)\,{\rm d}x 
$$
Do I first do a u-substitution first ?.  
 A: As already mentioned in the comments, the indefinite integral cannot be expressed in terms of elementary functions. However, on $[0,1]$ the result is $\dfrac\pi4\bigg(\dfrac\pi4+\ln2\bigg)-\text{Catalan}$.
A: This integral is done by using integration by parts. We have:
\begin{eqnarray}
&&\int (\arctan(x))^2 dx = \int x^{'} (\arctan(x))^2 dx =\\
&& x \arctan(x)^2 - \int x \cdot 2 \arctan(x) \cdot \frac{1}{1+x^2} dx =\\
&& x \arctan(x)^2 - \log(1+x^2) \arctan(x) + \int \frac{\log(1+x^2)}{1+x^2} dx =\\
&&  x \arctan(x)^2 - \log(1+x^2) \arctan(x) + \frac{1}{2 \imath}\int \left(\log(x+\imath)+\log(x-\imath)\right) \left(\frac{1}{x-\imath}-\frac{1}{x+\imath}\right) dx =\\
&& x \arctan(x)^2 - \log(1+x^2) \arctan(x) + \frac{1}{2 \imath}\left( \frac{1}{2} \log(x-\imath)^2 - \frac{1}{2} \log(x+\imath)^2\right) + \\
&&\frac{1}{2 \imath}\int \left( \frac{\log(x+\imath)}{x-\imath} - \frac{\log(x-\imath)}{x+\imath}\right)dx =\\
&&x \arctan(x)^2 - \log(1+x^2) \arctan(x) + Im\left( \frac{1}{2} \log(x-\imath)^2 +\log(2 \imath) \log(x-\imath) - Li_2(\frac{x-\imath}{-2 \imath})\right) 
\end{eqnarray}
