Finding $\int\frac{x^2-1}{\sqrt{x^4+x^2+1}}$ Finding
$$\int\frac{x^2-1}{\sqrt{x^4+x^2+1}}$$
Try: I have tried it to convert it into $\displaystyle \left(x+\frac{1}{x}\right)=t$ and $\displaystyle \left(1-\frac{1}{x^2}\right)$  but nothing happen.
I felt that it must be in Elliptical Integral of first kind, second kind or in third  kind.
Can someone explain me how to write in elliptical form
 A: Elliptic integral of the first kind is
$$E_1(\varphi, k) = \int\limits_0^\varphi \dfrac{d\theta}{\sqrt{1-k^2\sin^2\theta}} = \int\limits_0^{\sin\varphi}\dfrac{1}{\sqrt{(1-t^2)(1-k^2t^2)}}\,dt.$$
Elliptic integral of the second kind is
$$E_2(\varphi, k) = \int\limits_0^\varphi \sqrt{1-k^2\sin^2\theta}\,d\theta = \int\limits_0^{\sin\varphi}\sqrt{\dfrac{1-k^2t^2}{1-t^2}}\,dt.$$
At first,
$$1 + x^2 + x^4 = \left(1 + \dfrac12 x^2\right)^2 - \left(i\dfrac{\sqrt3}{2}\right)^2x^4$$
$$ = \left(1 + \left(\cos\dfrac{\pi}3 - i\sin\dfrac{\pi}3\right)x^2\right)\left(1 + \left(\cos\dfrac{\pi}3 + i\sin\dfrac{\pi}3\right)x^2\right)$$
$$ = \left(1 + e{\large{^{-\frac{\pi}3i}}}x^2\right)\left(1 + e{\large{^{\frac{2\pi}3i}}}e{\large{^{-\frac{\pi}3i}}}x^2\right) 
= \left(1 - e{\large{^{\frac{2\pi}3i}}}x^2\right)\left(1 - e{\large{^{\frac{2\pi}3i}}}e{\large{^{\frac{2\pi}3i}}}x^2\right)$$
$$ = \left(1 - \bigl(e{\large{^{\frac{\pi}3i}}}x\bigr)^2\right)\left(1 - \bigl(e{\large{^{\frac{\pi}3i}}}\bigr)^2\bigl(e{\large{^{\frac{\pi}3i}}}x\bigr)^2\right).$$
Let
$$k = e{\large{^{\frac{\pi}3i}}},\quad  t = kx,$$
then
$$I = \int\dfrac{x^2 - 1}{\sqrt{x^4 + x^2 + 1}}dx = \frac1{k^3}\int\dfrac{t^2 - k^2}{\sqrt{(1-t^2)(1-k^2t^2)}}dt.$$
The ratio can be presented in the form of
$$\dfrac{t^2 - k^2}{\sqrt{(1-t^2)(1-k^2t^2)}} = \dfrac{A}{\sqrt{(1-t^2)(1-k^2t^2)}} + B\,\sqrt{\dfrac{1-k^2t^2}{1-t^2}},$$
where
$$t^2 - k^2 = A + B(1 - k^2t^2),\quad A + B = -k^2,\quad -k^2B = 1,$$ 
$$B = -\frac1{k^2},\quad A = \frac{1 - k^4}{k^2}.$$
Since $k^6 = 1,$ then
$$I = \left(k - \dfrac1k\right)\int\dfrac{dt}{\sqrt{(1-t^2)(1-k^2t^2)}} - k\int\,\sqrt{\dfrac{1-k^2t^2}{1-t^2}}\,dt = {\left(k - \dfrac1k\right)E_1(\arcsin t, k) - kE_2(\arcsin t, k) + const},$$

$$\int\dfrac{x^2 - 1}{\sqrt{x^4 + x^2 + 1}}dx = \left(k - \dfrac1k\right)E_1\left(\arcsin \left(\frac{x}{k}\right), k\right) - kE_2\left(\arcsin\left(\frac{x}{k}\right), k\right) + const,\quad \text{ where } k = e^{\large{\frac\pi3i}}.$$
Differentiation shows the result is correct.
A: The other answers to this question use complex numbers. Here is a "real-only" answer.
Let us first work out
$$\int_y^\infty\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx\qquad y\ge0$$
"But wait a minute, isn't this always infinite?" Yes, but the integral from $0$ to $y$ (the generally implied bounds of the indefinite integral) can be obtained by a simple subtraction once we work out the antiderivative, so there's no problem.
The denominator quartic can be written as $(x^2+z^2)(x^2+\overline z^2)$ where $z=e^{i\pi/6}$. Thus Byrd and Friedman 225.09 applies:
$$\int_y^\infty\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx=\frac12\int_0^{u_1}\left(\frac{1+\operatorname{cn}u}{1-\operatorname{cn}u}-1\right)\,du=\int_0^{u_1}\frac{\operatorname{cn}u}{1-\operatorname{cn}u}\,du$$
where $u_1=F(\varphi,m)$, $m=\frac14$ is the parameter and $\operatorname{cn}u_1=\cos\varphi=\frac{y^2-1}{y^2+1}$. B&F 361.61 provides the solution to this second integral:
$$\int_0^{u_1}\frac{\operatorname{cn}u}{1-\operatorname{cn}u}\,du=-E(\varphi,m)-\frac{\operatorname{sn}u_1\operatorname{dn}u_1}{1-\operatorname{cn}u_1}$$
We can work out $\operatorname{sn}u_1$ and $\operatorname{dn}u_1$ using the known value of $\operatorname{cn}u_1$ and the fundamental relations between Jacobian elliptic functions, yielding
$$\int_y^\infty\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx=-E\left(\varphi,\frac14\right)-\frac{y\sqrt{y^4+y^2+1}}{y^2+1}=J(y)$$
The integral from $0$ to $y$ is then $J(0)-J(y)$ and $J(0)=-2E(1/4)$ (a complete integral), so
$$\int_0^y\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx=-2E\left(\frac14\right)+E\left(\cos^{-1}\frac{y^2-1}{y^2+1},\frac14\right)+\frac{y\sqrt{y^4+y^2+1}}{y^2+1}$$
The quasiperiodicity of $E$ allows us to absorb $2E(1/4)$. Applying a few trigonometric identities then allows us to simplify the amplitude, in the process extending the domain of validity to all real numbers:
$$\int_0^y\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx=E\left(\cos^{-1}\frac{y^2-1}{y^2+1}-\pi,\frac14\right)+\frac{y\sqrt{y^4+y^2+1}}{y^2+1}$$
$$\color{red}{\int_0^y\frac{x^2-1}{\sqrt{x^4+x^2+1}}\,dx=\frac{y\sqrt{y^4+y^2+1}}{y^2+1}-E\left(2\tan^{-1}y,\frac14\right)}$$
A: Maple expresses it as
$$ {\frac { \left( i\sqrt {3}+1 \right) \sqrt {4+2\,{x}^{2}-2\,i{x}
^{2}\sqrt {3}}\sqrt {4+2\,{x}^{2}+2\,i{x}^{2}\sqrt {3}} \left( i{\it 
EllipticF} \left(  \left( i\sqrt {3}+1 \right) x/2,(1+i\sqrt {3})/2
 \right) \sqrt {3}+3\,{\it EllipticF} \left( \left( i\sqrt {3}+1
 \right) x/2,(1+i\sqrt {3})/2 \right) -2\,{\it EllipticE} \left(
 \left( i\sqrt {3}+1 \right) x/2,(1+i\sqrt {3})/2 \right)  \right) }{16\;
\sqrt {x^4+x^2+1}}}
$$
So yes, it is expressed in terms of elliptic integrals of the first and second kinds (EllipticF is first kind, EllipticE is second kind).
