\(\int \frac {(-1+x^2) \sqrt {1+x^2+x^4}}{(1+x^2) (1+x+x^2+x^3+x^4)} \, dx\) [1911]

   Optimal result
   Rubi [F]
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 39, antiderivative size = 133 \[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=-2 \arctan \left (\frac {\sqrt {1+x^2+x^4}}{1-x+x^2}\right )+\sqrt {\frac {1}{5} \left (2+2 \sqrt {5}\right )} \arctan \left (\frac {\sqrt {1+x^2+x^4}}{\sqrt {2+\sqrt {5}} \left (1-x+x^2\right )}\right )+\sqrt {\frac {1}{5} \left (-2+2 \sqrt {5}\right )} \text {arctanh}\left (\frac {\sqrt {1+x^2+x^4}}{\sqrt {-2+\sqrt {5}} \left (1-x+x^2\right )}\right ) \]

[Out]

-2*arctan((x^4+x^2+1)^(1/2)/(x^2-x+1))+1/5*(10+10*5^(1/2))^(1/2)*arctan((x^4+x^2+1)^(1/2)/(2+5^(1/2))^(1/2)/(x
^2-x+1))+1/5*(-10+10*5^(1/2))^(1/2)*arctanh((x^4+x^2+1)^(1/2)/(-2+5^(1/2))^(1/2)/(x^2-x+1))

Rubi [F]

\[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=\int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx \]

[In]

Int[((-1 + x^2)*Sqrt[1 + x^2 + x^4])/((1 + x^2)*(1 + x + x^2 + x^3 + x^4)),x]

[Out]

(-2*x*Sqrt[1 + x^2 + x^4])/(1 + x^2) - ArcTan[x/Sqrt[1 + x^2 + x^4]] + (2*(1 + x^2)*Sqrt[(1 + x^2 + x^4)/(1 +
x^2)^2]*EllipticE[2*ArcTan[x], 1/4])/Sqrt[1 + x^2 + x^4] - (3*(1 + x^2)*Sqrt[(1 + x^2 + x^4)/(1 + x^2)^2]*Elli
pticF[2*ArcTan[x], 1/4])/(2*Sqrt[1 + x^2 + x^4]) + Defer[Int][Sqrt[1 + x^2 + x^4]/(1 + x + x^2 + x^3 + x^4), x
] + 2*Defer[Int][(x*Sqrt[1 + x^2 + x^4])/(1 + x + x^2 + x^3 + x^4), x] + 2*Defer[Int][(x^2*Sqrt[1 + x^2 + x^4]
)/(1 + x + x^2 + x^3 + x^4), x]

Rubi steps \begin{align*} \text {integral}& = \int \left (-\frac {2 \sqrt {1+x^2+x^4}}{1+x^2}+\frac {\left (1+2 x+2 x^2\right ) \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4}\right ) \, dx \\ & = -\left (2 \int \frac {\sqrt {1+x^2+x^4}}{1+x^2} \, dx\right )+\int \frac {\left (1+2 x+2 x^2\right ) \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx \\ & = -\left (2 \int \frac {x^2}{\sqrt {1+x^2+x^4}} \, dx\right )-2 \int \frac {1}{\left (1+x^2\right ) \sqrt {1+x^2+x^4}} \, dx+\int \left (\frac {\sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4}+\frac {2 x \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4}+\frac {2 x^2 \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4}\right ) \, dx \\ & = -\left (2 \int \frac {1}{\sqrt {1+x^2+x^4}} \, dx\right )+2 \int \frac {1-x^2}{\sqrt {1+x^2+x^4}} \, dx+2 \int \frac {x \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx+2 \int \frac {x^2 \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx-\int \frac {1}{\sqrt {1+x^2+x^4}} \, dx-\int \frac {1-x^2}{\left (1+x^2\right ) \sqrt {1+x^2+x^4}} \, dx+\int \frac {\sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx \\ & = -\frac {2 x \sqrt {1+x^2+x^4}}{1+x^2}+\frac {2 \left (1+x^2\right ) \sqrt {\frac {1+x^2+x^4}{\left (1+x^2\right )^2}} E\left (2 \arctan (x)\left |\frac {1}{4}\right .\right )}{\sqrt {1+x^2+x^4}}-\frac {3 \left (1+x^2\right ) \sqrt {\frac {1+x^2+x^4}{\left (1+x^2\right )^2}} \operatorname {EllipticF}\left (2 \arctan (x),\frac {1}{4}\right )}{2 \sqrt {1+x^2+x^4}}+2 \int \frac {x \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx+2 \int \frac {x^2 \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx+\int \frac {\sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx-\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\frac {x}{\sqrt {1+x^2+x^4}}\right ) \\ & = -\frac {2 x \sqrt {1+x^2+x^4}}{1+x^2}-\arctan \left (\frac {x}{\sqrt {1+x^2+x^4}}\right )+\frac {2 \left (1+x^2\right ) \sqrt {\frac {1+x^2+x^4}{\left (1+x^2\right )^2}} E\left (2 \arctan (x)\left |\frac {1}{4}\right .\right )}{\sqrt {1+x^2+x^4}}-\frac {3 \left (1+x^2\right ) \sqrt {\frac {1+x^2+x^4}{\left (1+x^2\right )^2}} \operatorname {EllipticF}\left (2 \arctan (x),\frac {1}{4}\right )}{2 \sqrt {1+x^2+x^4}}+2 \int \frac {x \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx+2 \int \frac {x^2 \sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx+\int \frac {\sqrt {1+x^2+x^4}}{1+x+x^2+x^3+x^4} \, dx \\ \end{align*}

Mathematica [A] (verified)

Time = 0.97 (sec) , antiderivative size = 129, normalized size of antiderivative = 0.97 \[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=-2 \arctan \left (\frac {\sqrt {1+x^2+x^4}}{1-x+x^2}\right )+\sqrt {\frac {2}{5} \left (1+\sqrt {5}\right )} \arctan \left (\frac {\sqrt {-2+\sqrt {5}} \sqrt {1+x^2+x^4}}{1-x+x^2}\right )+\sqrt {\frac {2}{5} \left (-1+\sqrt {5}\right )} \text {arctanh}\left (\frac {\sqrt {2+\sqrt {5}} \sqrt {1+x^2+x^4}}{1-x+x^2}\right ) \]

[In]

Integrate[((-1 + x^2)*Sqrt[1 + x^2 + x^4])/((1 + x^2)*(1 + x + x^2 + x^3 + x^4)),x]

[Out]

-2*ArcTan[Sqrt[1 + x^2 + x^4]/(1 - x + x^2)] + Sqrt[(2*(1 + Sqrt[5]))/5]*ArcTan[(Sqrt[-2 + Sqrt[5]]*Sqrt[1 + x
^2 + x^4])/(1 - x + x^2)] + Sqrt[(2*(-1 + Sqrt[5]))/5]*ArcTanh[(Sqrt[2 + Sqrt[5]]*Sqrt[1 + x^2 + x^4])/(1 - x
+ x^2)]

Maple [A] (verified)

Time = 3.16 (sec) , antiderivative size = 119, normalized size of antiderivative = 0.89

method result size
default \(-\frac {\sqrt {5}\, \sqrt {2+2 \sqrt {5}}\, \arctan \left (\frac {\left (x^{2}+1\right ) \sqrt {5}-\left (1+x \right )^{2}}{\sqrt {x^{4}+x^{2}+1}\, \sqrt {-2+2 \sqrt {5}}}\right )}{10}+\frac {\sqrt {5}\, \sqrt {-2+2 \sqrt {5}}\, \operatorname {arctanh}\left (\frac {\left (x^{2}+1\right ) \sqrt {5}+\left (1+x \right )^{2}}{\sqrt {x^{4}+x^{2}+1}\, \sqrt {2+2 \sqrt {5}}}\right )}{10}-\arctan \left (\frac {x}{\sqrt {x^{4}+x^{2}+1}}\right )\) \(119\)
pseudoelliptic \(-\frac {\sqrt {5}\, \sqrt {2+2 \sqrt {5}}\, \arctan \left (\frac {\left (x^{2}+1\right ) \sqrt {5}-\left (1+x \right )^{2}}{\sqrt {x^{4}+x^{2}+1}\, \sqrt {-2+2 \sqrt {5}}}\right )}{10}+\frac {\sqrt {5}\, \sqrt {-2+2 \sqrt {5}}\, \operatorname {arctanh}\left (\frac {\left (x^{2}+1\right ) \sqrt {5}+\left (1+x \right )^{2}}{\sqrt {x^{4}+x^{2}+1}\, \sqrt {2+2 \sqrt {5}}}\right )}{10}-\arctan \left (\frac {x}{\sqrt {x^{4}+x^{2}+1}}\right )\) \(119\)
elliptic \(-\frac {\left (\munderset {\textit {\_R} =\operatorname {RootOf}\left (25 \textit {\_Z}^{4}+5 \textit {\_Z}^{2}-1\right )}{\sum }\textit {\_R} \ln \left (\left (\sqrt {x^{4}+x^{2}+1}-x^{2}\right )^{2}+\left (-15 \textit {\_R}^{3}+5 \textit {\_R}^{2}-4 \textit {\_R} \right ) \left (\sqrt {x^{4}+x^{2}+1}-x^{2}\right )-15 \textit {\_R}^{3}+5 \textit {\_R}^{2}-4 \textit {\_R} +2\right )\right )}{2}+\frac {\left (\sqrt {2}\, \arctan \left (\frac {\sqrt {x^{4}+x^{2}+1}}{x}\right )-\frac {2 \sqrt {5}\, \operatorname {arctanh}\left (\frac {\sqrt {x^{4}+x^{2}+1}\, \sqrt {2}}{x \sqrt {\sqrt {5}+1}}\right )}{5 \sqrt {\sqrt {5}+1}}-\frac {2 \sqrt {5}\, \arctan \left (\frac {\sqrt {x^{4}+x^{2}+1}\, \sqrt {2}}{x \sqrt {\sqrt {5}-1}}\right )}{5 \sqrt {\sqrt {5}-1}}\right ) \sqrt {2}}{2}\) \(186\)

[In]

int((x^2-1)*(x^4+x^2+1)^(1/2)/(x^2+1)/(x^4+x^3+x^2+x+1),x,method=_RETURNVERBOSE)

[Out]

-1/10*5^(1/2)*(2+2*5^(1/2))^(1/2)*arctan(1/(x^4+x^2+1)^(1/2)/(-2+2*5^(1/2))^(1/2)*((x^2+1)*5^(1/2)-(1+x)^2))+1
/10*5^(1/2)*(-2+2*5^(1/2))^(1/2)*arctanh(((x^2+1)*5^(1/2)+(1+x)^2)/(x^4+x^2+1)^(1/2)/(2+2*5^(1/2))^(1/2))-arct
an(x/(x^4+x^2+1)^(1/2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 378 vs. \(2 (105) = 210\).

Time = 0.41 (sec) , antiderivative size = 378, normalized size of antiderivative = 2.84 \[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=-\frac {1}{20} \, \sqrt {5} \sqrt {-2 \, \sqrt {5} - 2} \log \left (-\frac {2 \, \sqrt {x^{4} + x^{2} + 1} {\left (2 \, x^{2} + \sqrt {5} x + x + 2\right )} + {\left (x^{4} + 3 \, x^{2} - \sqrt {5} {\left (x^{4} + x^{2} + 1\right )} + 1\right )} \sqrt {-2 \, \sqrt {5} - 2}}{x^{4} + x^{3} + x^{2} + x + 1}\right ) + \frac {1}{20} \, \sqrt {5} \sqrt {-2 \, \sqrt {5} - 2} \log \left (-\frac {2 \, \sqrt {x^{4} + x^{2} + 1} {\left (2 \, x^{2} + \sqrt {5} x + x + 2\right )} - {\left (x^{4} + 3 \, x^{2} - \sqrt {5} {\left (x^{4} + x^{2} + 1\right )} + 1\right )} \sqrt {-2 \, \sqrt {5} - 2}}{x^{4} + x^{3} + x^{2} + x + 1}\right ) + \frac {1}{20} \, \sqrt {5} \sqrt {2 \, \sqrt {5} - 2} \log \left (-\frac {2 \, \sqrt {x^{4} + x^{2} + 1} {\left (2 \, x^{2} - \sqrt {5} x + x + 2\right )} + {\left (x^{4} + 3 \, x^{2} + \sqrt {5} {\left (x^{4} + x^{2} + 1\right )} + 1\right )} \sqrt {2 \, \sqrt {5} - 2}}{x^{4} + x^{3} + x^{2} + x + 1}\right ) - \frac {1}{20} \, \sqrt {5} \sqrt {2 \, \sqrt {5} - 2} \log \left (-\frac {2 \, \sqrt {x^{4} + x^{2} + 1} {\left (2 \, x^{2} - \sqrt {5} x + x + 2\right )} - {\left (x^{4} + 3 \, x^{2} + \sqrt {5} {\left (x^{4} + x^{2} + 1\right )} + 1\right )} \sqrt {2 \, \sqrt {5} - 2}}{x^{4} + x^{3} + x^{2} + x + 1}\right ) - \arctan \left (\frac {x}{\sqrt {x^{4} + x^{2} + 1}}\right ) \]

[In]

integrate((x^2-1)*(x^4+x^2+1)^(1/2)/(x^2+1)/(x^4+x^3+x^2+x+1),x, algorithm="fricas")

[Out]

-1/20*sqrt(5)*sqrt(-2*sqrt(5) - 2)*log(-(2*sqrt(x^4 + x^2 + 1)*(2*x^2 + sqrt(5)*x + x + 2) + (x^4 + 3*x^2 - sq
rt(5)*(x^4 + x^2 + 1) + 1)*sqrt(-2*sqrt(5) - 2))/(x^4 + x^3 + x^2 + x + 1)) + 1/20*sqrt(5)*sqrt(-2*sqrt(5) - 2
)*log(-(2*sqrt(x^4 + x^2 + 1)*(2*x^2 + sqrt(5)*x + x + 2) - (x^4 + 3*x^2 - sqrt(5)*(x^4 + x^2 + 1) + 1)*sqrt(-
2*sqrt(5) - 2))/(x^4 + x^3 + x^2 + x + 1)) + 1/20*sqrt(5)*sqrt(2*sqrt(5) - 2)*log(-(2*sqrt(x^4 + x^2 + 1)*(2*x
^2 - sqrt(5)*x + x + 2) + (x^4 + 3*x^2 + sqrt(5)*(x^4 + x^2 + 1) + 1)*sqrt(2*sqrt(5) - 2))/(x^4 + x^3 + x^2 +
x + 1)) - 1/20*sqrt(5)*sqrt(2*sqrt(5) - 2)*log(-(2*sqrt(x^4 + x^2 + 1)*(2*x^2 - sqrt(5)*x + x + 2) - (x^4 + 3*
x^2 + sqrt(5)*(x^4 + x^2 + 1) + 1)*sqrt(2*sqrt(5) - 2))/(x^4 + x^3 + x^2 + x + 1)) - arctan(x/sqrt(x^4 + x^2 +
 1))

Sympy [F]

\[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=\int \frac {\sqrt {\left (x^{2} - x + 1\right ) \left (x^{2} + x + 1\right )} \left (x - 1\right ) \left (x + 1\right )}{\left (x^{2} + 1\right ) \left (x^{4} + x^{3} + x^{2} + x + 1\right )}\, dx \]

[In]

integrate((x**2-1)*(x**4+x**2+1)**(1/2)/(x**2+1)/(x**4+x**3+x**2+x+1),x)

[Out]

Integral(sqrt((x**2 - x + 1)*(x**2 + x + 1))*(x - 1)*(x + 1)/((x**2 + 1)*(x**4 + x**3 + x**2 + x + 1)), x)

Maxima [F]

\[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=\int { \frac {\sqrt {x^{4} + x^{2} + 1} {\left (x^{2} - 1\right )}}{{\left (x^{4} + x^{3} + x^{2} + x + 1\right )} {\left (x^{2} + 1\right )}} \,d x } \]

[In]

integrate((x^2-1)*(x^4+x^2+1)^(1/2)/(x^2+1)/(x^4+x^3+x^2+x+1),x, algorithm="maxima")

[Out]

integrate(sqrt(x^4 + x^2 + 1)*(x^2 - 1)/((x^4 + x^3 + x^2 + x + 1)*(x^2 + 1)), x)

Giac [F]

\[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=\int { \frac {\sqrt {x^{4} + x^{2} + 1} {\left (x^{2} - 1\right )}}{{\left (x^{4} + x^{3} + x^{2} + x + 1\right )} {\left (x^{2} + 1\right )}} \,d x } \]

[In]

integrate((x^2-1)*(x^4+x^2+1)^(1/2)/(x^2+1)/(x^4+x^3+x^2+x+1),x, algorithm="giac")

[Out]

integrate(sqrt(x^4 + x^2 + 1)*(x^2 - 1)/((x^4 + x^3 + x^2 + x + 1)*(x^2 + 1)), x)

Mupad [F(-1)]

Timed out. \[ \int \frac {\left (-1+x^2\right ) \sqrt {1+x^2+x^4}}{\left (1+x^2\right ) \left (1+x+x^2+x^3+x^4\right )} \, dx=\int \frac {\left (x^2-1\right )\,\sqrt {x^4+x^2+1}}{\left (x^2+1\right )\,\left (x^4+x^3+x^2+x+1\right )} \,d x \]

[In]

int(((x^2 - 1)*(x^2 + x^4 + 1)^(1/2))/((x^2 + 1)*(x + x^2 + x^3 + x^4 + 1)),x)

[Out]

int(((x^2 - 1)*(x^2 + x^4 + 1)^(1/2))/((x^2 + 1)*(x + x^2 + x^3 + x^4 + 1)), x)