Indefinite integral $\int \arctan^2 x dx$ in terms of the dilogarithm function I read about the integral
$$\int \arctan^2 x dx$$ in this old post: Evaluation of $\int (\arctan x)^2 dx$
By replacing
$$\arctan x = -\frac{i}{2}\left[\log(1+ix) - \log(i-ix)\right],$$
as suggested there, I ended up with this solution
$$\int\arctan^2 x dx = x\arctan^2x - \frac{1}{2}\log(1+x^2)\arctan x -\log 2 \arctan x  + \mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+ix}{2}\right)\right\} + K, \tag{1}\label{uno}$$
where, as usual, $\mbox{Li}_2(z)$ is the dilogarithm function 
$$\mbox{Li}_2(z) = -\int_0^z \frac{\log(1-u)}{u}du=\sum_{k=1}^{+\infty}\frac{z^k}{k^2}.$$
Is this a correct development? 
In that case, if I determine, using \eqref{uno}, the definite integral $\int_0^1 \arctan^2xdx$ I get the result
$$\int_0^1 \arctan^2xdx=\frac{\pi^2}{16}-\frac{3\pi}{8}\log 2 + \mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+i}{2}\right)\right\}.$$
If I now compare this result with the one given in Definite Integral of $\arctan(x)^2$, i.e.
$$\int_0^1 \arctan^2xdx=\frac{\pi^2}{16}+\frac{\pi}{4}\log 2 - C,$$
where $C$ is the Catalan constant
$$C = \sum_{k=0}^{+\infty} \frac{(-1)^k}{(2k+1)^2},$$
I get the following expression:
$$\mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+i}{2}\right)\right\} = \frac{5\pi}{8}\log 2 - C.$$
Is that reasonable?
 A: Landen's identity states that if $z \notin (1,\infty)$, then
$$
\operatorname{Li}_2(z) = -\operatorname{Li}_2\left(\frac{z}{z-1}\right)-\frac12\ln^2(1-z).
$$
For $z:=(1+i)/2$, we have $z/(z-1) = -i$, thus
$$
\operatorname{Li}_2\left(\frac{i+1}{2}\right) = -\operatorname{Li}_2(-i)-\frac12\ln^2\left(\frac{1-i}{2}\right).
$$
It is well known that
$$
\operatorname{Li}_2(-i) = -iC -\frac{\pi^2}{48},
$$
where $C$ is Catalan's constant. For the logarithmic term we have
\begin{align}
\frac12\ln^2\left(\frac{1-i}{2}\right) &= -\frac{1}{32}\left(\pi - 2\ln(2)\cdot i\right)^2 \\
&= \frac{\ln^2 2}{8} - \frac{\pi^2}{32} + \frac{\pi}{8}\ln(2) \cdot i.
\end{align}
Finally
$$
\operatorname{Li}_2\left(\frac{i+1}{2}\right) = \frac{5\pi^2}{96} - \frac{\ln^2 2}{8} + \left(C - \frac{\pi}{8}\ln 2\right)\cdot i.
$$
You could find a more general approach in this answer, where there is a solution for all $z \in \mathbb{C}$, such that $\left|z/(z-1)\right|=1$.
A: Ok, thanks for the help in giving me $\mbox{Li}_2\left(\frac{1+i}{2}\right)=C-\pi(\log 2)/8$. I checked my result and found out a mistake. The correct form of the integral in terms of the dilogarithm function should be
$$\begin{align} \int \arctan^2xdx=&x\arctan^2x -\frac{1}{2}\log(1+x^2)\arctan x+ \log2\arctan x+\\
&-\mbox{Im}\left\{\mbox{Li}_2\left(\frac{1+ix}{2}\right)\right\}+K.\end{align}$$
I checked derivating back to $\arctan^2x$. Also the result is now compatible with definite integral $\int_0^1 \arctan^2x dx = \pi^2/16+\pi/4\log2 -C.$
Thanks again for your answers!
A: When $x\in\mathbb{R}^+$ we can write:
$$\arctan\left(x\right)=\frac{i}{2}\cdot\ln\left(\frac{1-xi}{1+xi}\right)\tag1$$
So, when we square both sides we get:
$$\arctan^2\left(x\right)=\left(\frac{i}{2}\cdot\ln\left(\frac{1-xi}{1+xi}\right)\right)^2=-\frac{1}{4}\cdot\ln^2\left(\frac{1-xi}{1+xi}\right)\tag2$$
For the integral we get, then:
$$\mathscr{I}:=\int\arctan^2\left(x\right)\space\text{d}x=-\frac{1}{4}\cdot\int\ln^2\left(\frac{1-xi}{1+xi}\right)\space\text{d}x\tag3$$
Let $\text{u}:=\frac{1-xi}{1+xi}$:
$$\mathscr{I}=-\frac{2i}{4}\cdot\int\frac{\ln^2\left(\text{u}\right)}{\text{u}^2+2\text{u}+1}\space\text{d}\text{u}=-\frac{i}{2}\cdot\int\frac{\ln^2\left(\text{u}\right)}{\left(1+\text{u}\right)^2}\space\text{d}\text{u}\tag4$$
Let $\text{v}:=1+\text{u}$:
$$\mathscr{I}=-\frac{i}{2}\cdot\int\frac{\ln^2\left(\text{v}-1\right)}{\text{v}^2}\space\text{d}\text{v}\tag5$$
Using integration by parts:
$$\mathscr{I}=-\frac{i}{2}\cdot\left\{-\frac{\ln^2\left(\text{v}-1\right)}{\text{v}}+2\cdot\int\frac{\ln\left(\text{v}-1\right)}{\text{v}\cdot\left(\text{v}-1\right)}\space\text{d}\text{v}\right\}=$$
$$-\frac{i}{2}\cdot\left\{-\frac{\ln^2\left(\text{v}-1\right)}{\text{v}}+2\cdot\left\{\int\frac{\ln\left(\text{v}-1\right)}{\text{v}-1}\space\text{d}\text{v}-\int\frac{\ln\left(\text{v}-1\right)}{\text{v}}\space\text{d}\text{v}\right\}\right\}\tag6$$
