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

Optimal result
Mathematica [A] (verified)
Rubi [C] (warning: unable to verify)
Maple [C] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F]
Mupad [B] (verification not implemented)
Reduce [F]

Optimal result

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

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

Mathematica [A] (verified)

Time = 1.82 (sec) , antiderivative size = 58, normalized size of antiderivative = 1.66 \[ \int \frac {-1-2 x+x^2}{\left (1+2 x+3 x^2\right ) \sqrt {-x+x^3}} \, dx=-\frac {2 \sqrt {x} \sqrt {-1+x^2} \text {arctanh}\left (\frac {\sqrt {3} \sqrt {x} \sqrt {-1+x^2}}{-1+x}\right )}{\sqrt {3} \sqrt {x \left (-1+x^2\right )}} \] Input:

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

Output:

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

Rubi [C] (warning: unable to verify)

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

Time = 0.97 (sec) , antiderivative size = 289, normalized size of antiderivative = 8.26, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.156, Rules used = {2467, 25, 2035, 7279, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {x^2-2 x-1}{\left (3 x^2+2 x+1\right ) \sqrt {x^3-x}} \, dx\)

\(\Big \downarrow \) 2467

\(\displaystyle \frac {\sqrt {x} \sqrt {x^2-1} \int -\frac {-x^2+2 x+1}{\sqrt {x} \sqrt {x^2-1} \left (3 x^2+2 x+1\right )}dx}{\sqrt {x^3-x}}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {\sqrt {x} \sqrt {x^2-1} \int \frac {-x^2+2 x+1}{\sqrt {x} \sqrt {x^2-1} \left (3 x^2+2 x+1\right )}dx}{\sqrt {x^3-x}}\)

\(\Big \downarrow \) 2035

\(\displaystyle -\frac {2 \sqrt {x} \sqrt {x^2-1} \int \frac {-x^2+2 x+1}{\sqrt {x^2-1} \left (3 x^2+2 x+1\right )}d\sqrt {x}}{\sqrt {x^3-x}}\)

\(\Big \downarrow \) 7279

\(\displaystyle -\frac {2 \sqrt {x} \sqrt {x^2-1} \int \left (\frac {4 (2 x+1)}{3 \sqrt {x^2-1} \left (3 x^2+2 x+1\right )}-\frac {1}{3 \sqrt {x^2-1}}\right )d\sqrt {x}}{\sqrt {x^3-x}}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {2 \sqrt {x} \sqrt {x^2-1} \left (-\frac {2 \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),-1\right )}{3 \sqrt {x^2-1}}+\frac {\left (2 \sqrt {2}+i\right ) \sqrt {x-1} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {2} \sqrt {x}}{\sqrt {x-1}}\right ),\frac {1}{2}\right )}{3 \left (4+i \sqrt {2}\right ) \sqrt {x^2-1}}+\frac {\left (-7 \sqrt {2}+8 i\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticPi}\left (-\frac {3}{1-i \sqrt {2}},\arcsin \left (\sqrt {x}\right ),-1\right )}{3 \left (-\sqrt {2}+5 i\right ) \sqrt {x^2-1}}+\frac {\left (7 \sqrt {2}+8 i\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticPi}\left (-\frac {3}{1+i \sqrt {2}},\arcsin \left (\sqrt {x}\right ),-1\right )}{3 \left (\sqrt {2}+5 i\right ) \sqrt {x^2-1}}\right )}{\sqrt {x^3-x}}\)

Input:

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

Output:

(-2*Sqrt[x]*Sqrt[-1 + x^2]*((-2*Sqrt[1 - x]*Sqrt[1 + x]*EllipticF[ArcSin[S 
qrt[x]], -1])/(3*Sqrt[-1 + x^2]) + ((I + 2*Sqrt[2])*Sqrt[-1 + x]*Sqrt[1 + 
x]*EllipticF[ArcSin[(Sqrt[2]*Sqrt[x])/Sqrt[-1 + x]], 1/2])/(3*(4 + I*Sqrt[ 
2])*Sqrt[-1 + x^2]) + ((8*I - 7*Sqrt[2])*Sqrt[1 - x]*Sqrt[1 + x]*EllipticP 
i[-3/(1 - I*Sqrt[2]), ArcSin[Sqrt[x]], -1])/(3*(5*I - Sqrt[2])*Sqrt[-1 + x 
^2]) + ((8*I + 7*Sqrt[2])*Sqrt[1 - x]*Sqrt[1 + x]*EllipticPi[-3/(1 + I*Sqr 
t[2]), ArcSin[Sqrt[x]], -1])/(3*(5*I + Sqrt[2])*Sqrt[-1 + x^2])))/Sqrt[-x 
+ x^3]
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2035
Int[(Fx_)*(x_)^(m_), x_Symbol] :> With[{k = Denominator[m]}, Simp[k   Subst 
[Int[x^(k*(m + 1) - 1)*SubstPower[Fx, x, k], x], x, x^(1/k)], x]] /; Fracti 
onQ[m] && AlgebraicFunctionQ[Fx, x]
 

rule 2467
Int[(Fx_.)*(Px_)^(p_), x_Symbol] :> With[{r = Expon[Px, x, Min]}, Simp[Px^F 
racPart[p]/(x^(r*FracPart[p])*ExpandToSum[Px/x^r, x]^FracPart[p])   Int[x^( 
p*r)*ExpandToSum[Px/x^r, x]^p*Fx, x], x] /; IGtQ[r, 0]] /; FreeQ[p, x] && P 
olyQ[Px, x] &&  !IntegerQ[p] &&  !MonomialQ[Px, x] &&  !PolyQ[Fx, x]
 

rule 7279
Int[(u_)/((a_.) + (b_.)*(x_)^(n_.) + (c_.)*(x_)^(n2_.)), x_Symbol] :> With[ 
{v = RationalFunctionExpand[u/(a + b*x^n + c*x^(2*n)), x]}, Int[v, x] /; Su 
mQ[v]] /; FreeQ[{a, b, c}, x] && EqQ[n2, 2*n] && IGtQ[n, 0]
 
Maple [C] (verified)

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

Time = 0.70 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.74

method result size
trager \(\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}-3\right ) \ln \left (\frac {-3 \operatorname {RootOf}\left (\textit {\_Z}^{2}-3\right ) x^{2}-4 \operatorname {RootOf}\left (\textit {\_Z}^{2}-3\right ) x +6 \sqrt {x^{3}-x}+\operatorname {RootOf}\left (\textit {\_Z}^{2}-3\right )}{3 x^{2}+2 x +1}\right )}{3}\) \(61\)
elliptic \(\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticF}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}\right )}{3 \sqrt {x^{3}-x}}+\frac {\left (-\frac {4}{9}+\frac {i \sqrt {2}}{9}\right ) \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \left (-1+\frac {i \sqrt {2}}{2}\right ) \operatorname {EllipticPi}\left (\sqrt {1+x}, 1-\frac {i \sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}+\frac {\left (-\frac {4}{9}-\frac {i \sqrt {2}}{9}\right ) \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \left (-1-\frac {i \sqrt {2}}{2}\right ) \operatorname {EllipticPi}\left (\sqrt {1+x}, 1+\frac {i \sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}\) \(165\)
default \(\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticF}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}\right )}{3 \sqrt {x^{3}-x}}-\frac {4 \left (\frac {1}{3}-\frac {i \sqrt {2}}{12}\right ) \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \left (-1+\frac {i \sqrt {2}}{2}\right ) \operatorname {EllipticPi}\left (\sqrt {1+x}, 1-\frac {i \sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{3 \sqrt {x^{3}-x}}-\frac {4 \left (\frac {1}{3}+\frac {i \sqrt {2}}{12}\right ) \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \left (-1-\frac {i \sqrt {2}}{2}\right ) \operatorname {EllipticPi}\left (\sqrt {1+x}, 1+\frac {i \sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{3 \sqrt {x^{3}-x}}\) \(167\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (28) = 56\).

Time = 0.12 (sec) , antiderivative size = 73, normalized size of antiderivative = 2.09 \[ \int \frac {-1-2 x+x^2}{\left (1+2 x+3 x^2\right ) \sqrt {-x+x^3}} \, dx=\frac {1}{6} \, \sqrt {3} \log \left (\frac {9 \, x^{4} + 36 \, x^{3} - 4 \, \sqrt {3} \sqrt {x^{3} - x} {\left (3 \, x^{2} + 4 \, x - 1\right )} + 10 \, x^{2} - 20 \, x + 1}{9 \, x^{4} + 12 \, x^{3} + 10 \, x^{2} + 4 \, x + 1}\right ) \] Input:

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

Output:

1/6*sqrt(3)*log((9*x^4 + 36*x^3 - 4*sqrt(3)*sqrt(x^3 - x)*(3*x^2 + 4*x - 1 
) + 10*x^2 - 20*x + 1)/(9*x^4 + 12*x^3 + 10*x^2 + 4*x + 1))
 

Sympy [F]

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

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

Output:

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

Maxima [F]

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 7.34 (sec) , antiderivative size = 175, normalized size of antiderivative = 5.00 \[ \int \frac {-1-2 x+x^2}{\left (1+2 x+3 x^2\right ) \sqrt {-x+x^3}} \, dx=-\frac {2\,\sqrt {-x}\,\sqrt {1-x}\,\sqrt {x+1}\,\mathrm {F}\left (\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )}{3\,\sqrt {x^3-x}}-\frac {\sqrt {2}\,\sqrt {-x}\,\left (-\frac {4}{9}+\frac {\sqrt {2}\,8{}\mathrm {i}}{9}\right )\,\sqrt {1-x}\,\sqrt {x+1}\,\Pi \left (\frac {1}{\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{3}};\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )\,1{}\mathrm {i}}{2\,\sqrt {x^3-x}\,\left (\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{3}\right )}+\frac {\sqrt {2}\,\sqrt {-x}\,\left (\frac {4}{9}+\frac {\sqrt {2}\,8{}\mathrm {i}}{9}\right )\,\sqrt {1-x}\,\sqrt {x+1}\,\Pi \left (-\frac {1}{-\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{3}};\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )\,1{}\mathrm {i}}{2\,\sqrt {x^3-x}\,\left (-\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{3}\right )} \] Input:

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

Output:

(2^(1/2)*(-x)^(1/2)*((2^(1/2)*8i)/9 + 4/9)*(1 - x)^(1/2)*(x + 1)^(1/2)*ell 
ipticPi(-1/((2^(1/2)*1i)/3 - 1/3), asin((-x)^(1/2)), -1)*1i)/(2*(x^3 - x)^ 
(1/2)*((2^(1/2)*1i)/3 - 1/3)) - (2^(1/2)*(-x)^(1/2)*((2^(1/2)*8i)/9 - 4/9) 
*(1 - x)^(1/2)*(x + 1)^(1/2)*ellipticPi(1/((2^(1/2)*1i)/3 + 1/3), asin((-x 
)^(1/2)), -1)*1i)/(2*(x^3 - x)^(1/2)*((2^(1/2)*1i)/3 + 1/3)) - (2*(-x)^(1/ 
2)*(1 - x)^(1/2)*(x + 1)^(1/2)*ellipticF(asin((-x)^(1/2)), -1))/(3*(x^3 - 
x)^(1/2))
 

Reduce [F]

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

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

Output:

int((sqrt(x)*sqrt(x**2 - 1)*x)/(3*x**4 + 2*x**3 - 2*x**2 - 2*x - 1),x) - i 
nt((sqrt(x)*sqrt(x**2 - 1))/(3*x**5 + 2*x**4 - 2*x**3 - 2*x**2 - x),x) - 2 
*int((sqrt(x)*sqrt(x**2 - 1))/(3*x**4 + 2*x**3 - 2*x**2 - 2*x - 1),x)