<s>[INST] Integrating a function of tan inverse How would I carry out the following integration?
$$\int_0^12\arctan x^2$$
I tried to substitute $x^2 = \tan\theta$
From there I wrote the integral as:
$$\int_0^{\pi/4}\theta\cdot \frac{\sec^2\theta}{\sqrt{\tan\theta}}\ d\theta$$
Now, is my only option to use integration by parts? Or is there a better method to solve this integral?
 [/INST] By using the Taylor series of the arctangent function, $\arctan(x)=\sum_{n\geq 0}\frac{(-1)^n x^{2n+1}}{2n+1}$, we get:
$$ \int_{0}^{1}\arctan(x^2)\,dx = 2\sum_{n\geq 0}\frac{(-1)^n}{(4n+2)(4n+3)}=2\sum_{n\geq 0}(-1)^n\left(\frac{1}{4n+2}-\frac{1}{4n+3}\right),$$
where the series 
$$\sum_{n\geq 0}\frac{(-1)^n}{4n+3} = \sum_{n\geq 0}\left(\frac{1}{8n+3}-\frac{1}{8n+7}\right)$$
can be computed through the identity
$$ -\log(1-z) = \sum_{n\geq 1}\frac{z^n}{n} $$
with $z$ being a root of $\frac{z^8-1}{z-1}$, i.e. through the discrete Fourier transform. By collecting the pieces,

$$ \int_{0}^{1}\arctan(x^2)\,dx = \color{red}{\frac{\pi}{4}-\frac{\pi}{2\sqrt{2}}+\frac{1}{\sqrt{2}}\,\log(1+\sqrt{2})}.$$

As an alternative, you may notice that the problem is equivalent, by integration by parts, to computing $\int_{0}^{1}\frac{x^2}{1+x^4}\,dx$, but $$1+x^4 = (1+2x^2+x^4)-2x^2 = (1+x^2)^2-(\sqrt{2} x)^2 $$
gives
$$ \frac{x^2}{1+x^4} = \frac{1}{2\sqrt{2}}\cdot\left(\frac{x}{x^2-\sqrt{2}\,x+1}-\frac{x}{x^2+\sqrt{2}\,x+1}\right)$$
and the primitive of $\frac{x}{x^2\pm\sqrt{2}\,x+1}$ is just:
$$ \frac{1}{2}\,\log(x^2\pm\sqrt{2}\,x+1)\mp\arctan\left(\frac{2x\pm\sqrt{2}}{2}\right).$$
</s>