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

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

Optimal result

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

[Out]

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

Rubi [F]

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

[In]

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

[Out]

(2*x*(1 + x)*Sqrt[(1 - x + x^2)/(1 + (1 + Sqrt[3])*x)^2]*EllipticF[ArcCos[(1 + (1 - Sqrt[3])*x)/(1 + (1 + Sqrt
[3])*x)], (2 + Sqrt[3])/4])/(3^(1/4)*Sqrt[(x*(1 + x))/(1 + (1 + Sqrt[3])*x)^2]*Sqrt[x + x^4]) + (Sqrt[-17 + 5*
Sqrt[13]]*Sqrt[x]*Sqrt[1 + x^3]*Defer[Subst][Defer[Int][1/((Sqrt[-3 + Sqrt[13]] - Sqrt[2]*x)*Sqrt[1 + x^6]), x
], x, Sqrt[x]])/Sqrt[x + x^4] - (I*Sqrt[17 + 5*Sqrt[13]]*Sqrt[x]*Sqrt[1 + x^3]*Defer[Subst][Defer[Int][1/((I*S
qrt[3 + Sqrt[13]] - Sqrt[2]*x)*Sqrt[1 + x^6]), x], x, Sqrt[x]])/Sqrt[x + x^4] + (Sqrt[-17 + 5*Sqrt[13]]*Sqrt[x
]*Sqrt[1 + x^3]*Defer[Subst][Defer[Int][1/((Sqrt[-3 + Sqrt[13]] + Sqrt[2]*x)*Sqrt[1 + x^6]), x], x, Sqrt[x]])/
Sqrt[x + x^4] - (I*Sqrt[17 + 5*Sqrt[13]]*Sqrt[x]*Sqrt[1 + x^3]*Defer[Subst][Defer[Int][1/((I*Sqrt[3 + Sqrt[13]
] + Sqrt[2]*x)*Sqrt[1 + x^6]), x], x, Sqrt[x]])/Sqrt[x + x^4]

Rubi steps \begin{align*} \text {integral}& = \frac {\left (\sqrt {x} \sqrt {1+x^3}\right ) \int \frac {-1-2 x+2 x^2}{\sqrt {x} \left (-1+3 x+x^2\right ) \sqrt {1+x^3}} \, dx}{\sqrt {x+x^4}} \\ & = \frac {\left (\sqrt {x} \sqrt {1+x^3}\right ) \int \left (\frac {2}{\sqrt {x} \sqrt {1+x^3}}+\frac {1-8 x}{\sqrt {x} \left (-1+3 x+x^2\right ) \sqrt {1+x^3}}\right ) \, dx}{\sqrt {x+x^4}} \\ & = \frac {\left (\sqrt {x} \sqrt {1+x^3}\right ) \int \frac {1-8 x}{\sqrt {x} \left (-1+3 x+x^2\right ) \sqrt {1+x^3}} \, dx}{\sqrt {x+x^4}}+\frac {\left (2 \sqrt {x} \sqrt {1+x^3}\right ) \int \frac {1}{\sqrt {x} \sqrt {1+x^3}} \, dx}{\sqrt {x+x^4}} \\ & = \frac {\left (\sqrt {x} \sqrt {1+x^3}\right ) \int \left (\frac {-8+2 \sqrt {13}}{\sqrt {x} \left (3-\sqrt {13}+2 x\right ) \sqrt {1+x^3}}+\frac {-8-2 \sqrt {13}}{\sqrt {x} \left (3+\sqrt {13}+2 x\right ) \sqrt {1+x^3}}\right ) \, dx}{\sqrt {x+x^4}}+\frac {\left (4 \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^4}} \\ & = \frac {2 x (1+x) \sqrt {\frac {1-x+x^2}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \operatorname {EllipticF}\left (\arccos \left (\frac {1+\left (1-\sqrt {3}\right ) x}{1+\left (1+\sqrt {3}\right ) x}\right ),\frac {1}{4} \left (2+\sqrt {3}\right )\right )}{\sqrt [4]{3} \sqrt {\frac {x (1+x)}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \sqrt {x+x^4}}-\frac {\left (2 \left (4-\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \int \frac {1}{\sqrt {x} \left (3-\sqrt {13}+2 x\right ) \sqrt {1+x^3}} \, dx}{\sqrt {x+x^4}}-\frac {\left (2 \left (4+\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \int \frac {1}{\sqrt {x} \left (3+\sqrt {13}+2 x\right ) \sqrt {1+x^3}} \, dx}{\sqrt {x+x^4}} \\ & = \frac {2 x (1+x) \sqrt {\frac {1-x+x^2}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \operatorname {EllipticF}\left (\arccos \left (\frac {1+\left (1-\sqrt {3}\right ) x}{1+\left (1+\sqrt {3}\right ) x}\right ),\frac {1}{4} \left (2+\sqrt {3}\right )\right )}{\sqrt [4]{3} \sqrt {\frac {x (1+x)}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \sqrt {x+x^4}}-\frac {\left (4 \left (4-\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (3-\sqrt {13}+2 x^2\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^4}}-\frac {\left (4 \left (4+\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (3+\sqrt {13}+2 x^2\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^4}} \\ & = \frac {2 x (1+x) \sqrt {\frac {1-x+x^2}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \operatorname {EllipticF}\left (\arccos \left (\frac {1+\left (1-\sqrt {3}\right ) x}{1+\left (1+\sqrt {3}\right ) x}\right ),\frac {1}{4} \left (2+\sqrt {3}\right )\right )}{\sqrt [4]{3} \sqrt {\frac {x (1+x)}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \sqrt {x+x^4}}-\frac {\left (4 \left (4-\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \left (\frac {\sqrt {-3+\sqrt {13}}}{2 \left (3-\sqrt {13}\right ) \left (\sqrt {-3+\sqrt {13}}-\sqrt {2} x\right ) \sqrt {1+x^6}}+\frac {\sqrt {-3+\sqrt {13}}}{2 \left (3-\sqrt {13}\right ) \left (\sqrt {-3+\sqrt {13}}+\sqrt {2} x\right ) \sqrt {1+x^6}}\right ) \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^4}}-\frac {\left (4 \left (4+\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \left (\frac {i}{2 \sqrt {3+\sqrt {13}} \left (i \sqrt {3+\sqrt {13}}-\sqrt {2} x\right ) \sqrt {1+x^6}}+\frac {i}{2 \sqrt {3+\sqrt {13}} \left (i \sqrt {3+\sqrt {13}}+\sqrt {2} x\right ) \sqrt {1+x^6}}\right ) \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^4}} \\ & = \frac {2 x (1+x) \sqrt {\frac {1-x+x^2}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \operatorname {EllipticF}\left (\arccos \left (\frac {1+\left (1-\sqrt {3}\right ) x}{1+\left (1+\sqrt {3}\right ) x}\right ),\frac {1}{4} \left (2+\sqrt {3}\right )\right )}{\sqrt [4]{3} \sqrt {\frac {x (1+x)}{\left (1+\left (1+\sqrt {3}\right ) x\right )^2}} \sqrt {x+x^4}}+\frac {\left (2 \left (4-\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (\sqrt {-3+\sqrt {13}}-\sqrt {2} x\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {-3+\sqrt {13}} \sqrt {x+x^4}}+\frac {\left (2 \left (4-\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (\sqrt {-3+\sqrt {13}}+\sqrt {2} x\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {-3+\sqrt {13}} \sqrt {x+x^4}}-\frac {\left (2 i \left (4+\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (i \sqrt {3+\sqrt {13}}-\sqrt {2} x\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {3+\sqrt {13}} \sqrt {x+x^4}}-\frac {\left (2 i \left (4+\sqrt {13}\right ) \sqrt {x} \sqrt {1+x^3}\right ) \text {Subst}\left (\int \frac {1}{\left (i \sqrt {3+\sqrt {13}}+\sqrt {2} x\right ) \sqrt {1+x^6}} \, dx,x,\sqrt {x}\right )}{\sqrt {3+\sqrt {13}} \sqrt {x+x^4}} \\ \end{align*}

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 3.84 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.75

method result size
trager \(\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right ) \ln \left (\frac {3 \operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right ) x^{2}+\operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right ) x +\operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right )+4 \sqrt {x^{4}+x}}{x^{2}+3 x -1}\right )}{2}\) \(56\)
default \(\text {Expression too large to display}\) \(13798\)
elliptic \(\text {Expression too large to display}\) \(15100\)

[In]

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

[Out]

1/2*RootOf(_Z^2-2)*ln((3*RootOf(_Z^2-2)*x^2+RootOf(_Z^2-2)*x+RootOf(_Z^2-2)+4*(x^4+x)^(1/2))/(x^2+3*x-1))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (26) = 52\).

Time = 0.27 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.12 \[ \int \frac {-1-2 x+2 x^2}{\left (-1+3 x+x^2\right ) \sqrt {x+x^4}} \, dx=\frac {1}{4} \, \sqrt {2} \log \left (-\frac {17 \, x^{4} + 6 \, x^{3} + 4 \, \sqrt {2} \sqrt {x^{4} + x} {\left (3 \, x^{2} + x + 1\right )} + 7 \, x^{2} + 10 \, x + 1}{x^{4} + 6 \, x^{3} + 7 \, x^{2} - 6 \, x + 1}\right ) \]

[In]

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

[Out]

1/4*sqrt(2)*log(-(17*x^4 + 6*x^3 + 4*sqrt(2)*sqrt(x^4 + x)*(3*x^2 + x + 1) + 7*x^2 + 10*x + 1)/(x^4 + 6*x^3 +
7*x^2 - 6*x + 1))

Sympy [F]

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

[In]

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

[Out]

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

Maxima [F]

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

[In]

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

[Out]

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

Giac [F]

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

[In]

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

[Out]

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

Mupad [F(-1)]

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

[In]

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

[Out]

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