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

3.12.34.1 Optimal result
3.12.34.2 Mathematica [A] (verified)
3.12.34.3 Rubi [C] (verified)
3.12.34.4 Maple [C] (verified)
3.12.34.5 Fricas [B] (verification not implemented)
3.12.34.6 Sympy [F]
3.12.34.7 Maxima [F]
3.12.34.8 Giac [F]
3.12.34.9 Mupad [B] (verification not implemented)

3.12.34.1 Optimal result

Integrand size = 29, antiderivative size = 85 \[ \int \frac {-x+x^2}{\left (-1+2 x+x^2\right ) \sqrt {-x+x^3}} \, dx=\frac {1}{4} \left (2+\sqrt {2}\right ) \arctan \left (\frac {\sqrt {3-2 \sqrt {2}} \sqrt {-x+x^3}}{1+x}\right )+\frac {1}{4} \left (-2+\sqrt {2}\right ) \arctan \left (\frac {\sqrt {3+2 \sqrt {2}} \sqrt {-x+x^3}}{1+x}\right ) \]

output
1/4*(2+2^(1/2))*arctan((2^(1/2)-1)*(x^3-x)^(1/2)/(1+x))+1/4*(-2+2^(1/2))*a 
rctan((1+2^(1/2))*(x^3-x)^(1/2)/(1+x))
 
3.12.34.2 Mathematica [A] (verified)

Time = 11.02 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.86 \[ \int \frac {-x+x^2}{\left (-1+2 x+x^2\right ) \sqrt {-x+x^3}} \, dx=\frac {1}{4} \left (2+\sqrt {2}\right ) \arctan \left (\frac {\left (-1+\sqrt {2}\right ) \sqrt {-x+x^3}}{1+x}\right )+\frac {1}{4} \left (-2+\sqrt {2}\right ) \arctan \left (\frac {\left (1+\sqrt {2}\right ) \sqrt {-x+x^3}}{1+x}\right ) \]

input
Integrate[(-x + x^2)/((-1 + 2*x + x^2)*Sqrt[-x + x^3]),x]
 
output
((2 + Sqrt[2])*ArcTan[((-1 + Sqrt[2])*Sqrt[-x + x^3])/(1 + x)])/4 + ((-2 + 
 Sqrt[2])*ArcTan[((1 + Sqrt[2])*Sqrt[-x + x^3])/(1 + x)])/4
 
3.12.34.3 Rubi [C] (verified)

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

Time = 1.19 (sec) , antiderivative size = 414, normalized size of antiderivative = 4.87, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {2027, 2467, 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-x}{\left (x^2+2 x-1\right ) \sqrt {x^3-x}} \, dx\)

\(\Big \downarrow \) 2027

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

\(\Big \downarrow \) 2467

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

\(\Big \downarrow \) 2035

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

\(\Big \downarrow \) 7279

\(\displaystyle \frac {2 \sqrt {x} \sqrt {x^2-1} \int \left (\frac {1}{\sqrt {x^2-1}}-\frac {1-3 x}{\left (-x^2-2 x+1\right ) \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 {\left (3+2 \sqrt {2}\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),-1\right )}{2 \left (2+\sqrt {2}\right ) \sqrt {x^2-1}}+\frac {\left (3-2 \sqrt {2}\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),-1\right )}{2 \left (2-\sqrt {2}\right ) \sqrt {x^2-1}}-\frac {\left (1+\sqrt {2}\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 )}{4 \sqrt {x^2-1}}+\frac {\left (1-\sqrt {2}\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 )}{4 \sqrt {x^2-1}}+\frac {\sqrt {x-1} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {2} \sqrt {x}}{\sqrt {x-1}}\right ),\frac {1}{2}\right )}{\sqrt {2} \sqrt {x^2-1}}-\frac {\left (1+\sqrt {2}\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticPi}\left (1-\sqrt {2},\arcsin \left (\sqrt {x}\right ),-1\right )}{2 \sqrt {x^2-1}}-\frac {\left (1-\sqrt {2}\right ) \sqrt {1-x} \sqrt {x+1} \operatorname {EllipticPi}\left (1+\sqrt {2},\arcsin \left (\sqrt {x}\right ),-1\right )}{2 \sqrt {x^2-1}}\right )}{\sqrt {x^3-x}}\)

input
Int[(-x + x^2)/((-1 + 2*x + x^2)*Sqrt[-x + x^3]),x]
 
output
(2*Sqrt[x]*Sqrt[-1 + x^2]*(((3 - 2*Sqrt[2])*Sqrt[1 - x]*Sqrt[1 + x]*Ellipt 
icF[ArcSin[Sqrt[x]], -1])/(2*(2 - Sqrt[2])*Sqrt[-1 + x^2]) + ((3 + 2*Sqrt[ 
2])*Sqrt[1 - x]*Sqrt[1 + x]*EllipticF[ArcSin[Sqrt[x]], -1])/(2*(2 + Sqrt[2 
])*Sqrt[-1 + x^2]) + (Sqrt[-1 + x]*Sqrt[1 + x]*EllipticF[ArcSin[(Sqrt[2]*S 
qrt[x])/Sqrt[-1 + x]], 1/2])/(Sqrt[2]*Sqrt[-1 + x^2]) + ((1 - Sqrt[2])*Sqr 
t[-1 + x]*Sqrt[1 + x]*EllipticF[ArcSin[(Sqrt[2]*Sqrt[x])/Sqrt[-1 + x]], 1/ 
2])/(4*Sqrt[-1 + x^2]) - ((1 + Sqrt[2])*Sqrt[-1 + x]*Sqrt[1 + x]*EllipticF 
[ArcSin[(Sqrt[2]*Sqrt[x])/Sqrt[-1 + x]], 1/2])/(4*Sqrt[-1 + x^2]) - ((1 + 
Sqrt[2])*Sqrt[1 - x]*Sqrt[1 + x]*EllipticPi[1 - Sqrt[2], ArcSin[Sqrt[x]], 
-1])/(2*Sqrt[-1 + x^2]) - ((1 - Sqrt[2])*Sqrt[1 - x]*Sqrt[1 + x]*EllipticP 
i[1 + Sqrt[2], ArcSin[Sqrt[x]], -1])/(2*Sqrt[-1 + x^2])))/Sqrt[-x + x^3]
 

3.12.34.3.1 Defintions of rubi rules used

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

rule 2027
Int[(Fx_.)*((a_.)*(x_)^(r_.) + (b_.)*(x_)^(s_.))^(p_.), x_Symbol] :> Int[x^ 
(p*r)*(a + b*x^(s - r))^p*Fx, x] /; FreeQ[{a, b, r, s}, x] && IntegerQ[p] & 
& PosQ[s - r] &&  !(EqQ[p, 1] && EqQ[u, 1])
 

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]
 
3.12.34.4 Maple [C] (verified)

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

Time = 4.45 (sec) , antiderivative size = 222, normalized size of antiderivative = 2.61

method result size
default \(\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticF}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}-\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}+\frac {3 \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \sqrt {2}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{4 \sqrt {x^{3}-x}}-\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, -\frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}-\frac {3 \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \sqrt {2}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, -\frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{4 \sqrt {x^{3}-x}}\) \(222\)
elliptic \(\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticF}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}-\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}+\frac {3 \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \sqrt {2}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, \frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{4 \sqrt {x^{3}-x}}-\frac {\sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, -\frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{\sqrt {x^{3}-x}}-\frac {3 \sqrt {1+x}\, \sqrt {2-2 x}\, \sqrt {-x}\, \sqrt {2}\, \operatorname {EllipticPi}\left (\sqrt {1+x}, -\frac {\sqrt {2}}{2}, \frac {\sqrt {2}}{2}\right )}{4 \sqrt {x^{3}-x}}\) \(222\)
trager \(\text {Expression too large to display}\) \(773\)

input
int((x^2-x)/(x^2+2*x-1)/(x^3-x)^(1/2),x,method=_RETURNVERBOSE)
 
output
(1+x)^(1/2)*(2-2*x)^(1/2)*(-x)^(1/2)/(x^3-x)^(1/2)*EllipticF((1+x)^(1/2),1 
/2*2^(1/2))-(1+x)^(1/2)*(2-2*x)^(1/2)*(-x)^(1/2)/(x^3-x)^(1/2)*EllipticPi( 
(1+x)^(1/2),1/2*2^(1/2),1/2*2^(1/2))+3/4*(1+x)^(1/2)*(2-2*x)^(1/2)*(-x)^(1 
/2)/(x^3-x)^(1/2)*2^(1/2)*EllipticPi((1+x)^(1/2),1/2*2^(1/2),1/2*2^(1/2))- 
(1+x)^(1/2)*(2-2*x)^(1/2)*(-x)^(1/2)/(x^3-x)^(1/2)*EllipticPi((1+x)^(1/2), 
-1/2*2^(1/2),1/2*2^(1/2))-3/4*(1+x)^(1/2)*(2-2*x)^(1/2)*(-x)^(1/2)/(x^3-x) 
^(1/2)*2^(1/2)*EllipticPi((1+x)^(1/2),-1/2*2^(1/2),1/2*2^(1/2))
 
3.12.34.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 389 vs. \(2 (57) = 114\).

Time = 0.30 (sec) , antiderivative size = 389, normalized size of antiderivative = 4.58 \[ \int \frac {-x+x^2}{\left (-1+2 x+x^2\right ) \sqrt {-x+x^3}} \, dx=-\frac {1}{16} \, \sqrt {2} \sqrt {2 \, \sqrt {2} - 3} \log \left (\frac {x^{4} - 2 \, x^{3} + 2 \, \sqrt {x^{3} - x} {\left (x^{2} + 2 \, \sqrt {2} {\left (x + 1\right )} + 2 \, x + 3\right )} \sqrt {2 \, \sqrt {2} - 3} + 4 \, \sqrt {2} {\left (x^{3} - x\right )} - 2 \, x - 1}{x^{4} + 4 \, x^{3} + 2 \, x^{2} - 4 \, x + 1}\right ) + \frac {1}{16} \, \sqrt {2} \sqrt {2 \, \sqrt {2} - 3} \log \left (\frac {x^{4} - 2 \, x^{3} - 2 \, \sqrt {x^{3} - x} {\left (x^{2} + 2 \, \sqrt {2} {\left (x + 1\right )} + 2 \, x + 3\right )} \sqrt {2 \, \sqrt {2} - 3} + 4 \, \sqrt {2} {\left (x^{3} - x\right )} - 2 \, x - 1}{x^{4} + 4 \, x^{3} + 2 \, x^{2} - 4 \, x + 1}\right ) + \frac {1}{16} \, \sqrt {2} \sqrt {-2 \, \sqrt {2} - 3} \log \left (\frac {x^{4} - 2 \, x^{3} + 2 \, \sqrt {x^{3} - x} {\left (x^{2} - 2 \, \sqrt {2} {\left (x + 1\right )} + 2 \, x + 3\right )} \sqrt {-2 \, \sqrt {2} - 3} - 4 \, \sqrt {2} {\left (x^{3} - x\right )} - 2 \, x - 1}{x^{4} + 4 \, x^{3} + 2 \, x^{2} - 4 \, x + 1}\right ) - \frac {1}{16} \, \sqrt {2} \sqrt {-2 \, \sqrt {2} - 3} \log \left (\frac {x^{4} - 2 \, x^{3} - 2 \, \sqrt {x^{3} - x} {\left (x^{2} - 2 \, \sqrt {2} {\left (x + 1\right )} + 2 \, x + 3\right )} \sqrt {-2 \, \sqrt {2} - 3} - 4 \, \sqrt {2} {\left (x^{3} - x\right )} - 2 \, x - 1}{x^{4} + 4 \, x^{3} + 2 \, x^{2} - 4 \, x + 1}\right ) \]

input
integrate((x^2-x)/(x^2+2*x-1)/(x^3-x)^(1/2),x, algorithm="fricas")
 
output
-1/16*sqrt(2)*sqrt(2*sqrt(2) - 3)*log((x^4 - 2*x^3 + 2*sqrt(x^3 - x)*(x^2 
+ 2*sqrt(2)*(x + 1) + 2*x + 3)*sqrt(2*sqrt(2) - 3) + 4*sqrt(2)*(x^3 - x) - 
 2*x - 1)/(x^4 + 4*x^3 + 2*x^2 - 4*x + 1)) + 1/16*sqrt(2)*sqrt(2*sqrt(2) - 
 3)*log((x^4 - 2*x^3 - 2*sqrt(x^3 - x)*(x^2 + 2*sqrt(2)*(x + 1) + 2*x + 3) 
*sqrt(2*sqrt(2) - 3) + 4*sqrt(2)*(x^3 - x) - 2*x - 1)/(x^4 + 4*x^3 + 2*x^2 
 - 4*x + 1)) + 1/16*sqrt(2)*sqrt(-2*sqrt(2) - 3)*log((x^4 - 2*x^3 + 2*sqrt 
(x^3 - x)*(x^2 - 2*sqrt(2)*(x + 1) + 2*x + 3)*sqrt(-2*sqrt(2) - 3) - 4*sqr 
t(2)*(x^3 - x) - 2*x - 1)/(x^4 + 4*x^3 + 2*x^2 - 4*x + 1)) - 1/16*sqrt(2)* 
sqrt(-2*sqrt(2) - 3)*log((x^4 - 2*x^3 - 2*sqrt(x^3 - x)*(x^2 - 2*sqrt(2)*( 
x + 1) + 2*x + 3)*sqrt(-2*sqrt(2) - 3) - 4*sqrt(2)*(x^3 - x) - 2*x - 1)/(x 
^4 + 4*x^3 + 2*x^2 - 4*x + 1))
 
3.12.34.6 Sympy [F]

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

input
integrate((x**2-x)/(x**2+2*x-1)/(x**3-x)**(1/2),x)
 
output
Integral(x*(x - 1)/(sqrt(x*(x - 1)*(x + 1))*(x**2 + 2*x - 1)), x)
 
3.12.34.7 Maxima [F]

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

input
integrate((x^2-x)/(x^2+2*x-1)/(x^3-x)^(1/2),x, algorithm="maxima")
 
output
integrate((x^2 - x)/(sqrt(x^3 - x)*(x^2 + 2*x - 1)), x)
 
3.12.34.8 Giac [F]

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

input
integrate((x^2-x)/(x^2+2*x-1)/(x^3-x)^(1/2),x, algorithm="giac")
 
output
integrate((x^2 - x)/(sqrt(x^3 - x)*(x^2 + 2*x - 1)), x)
 
3.12.34.9 Mupad [B] (verification not implemented)

Time = 5.77 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.87 \[ \int \frac {-x+x^2}{\left (-1+2 x+x^2\right ) \sqrt {-x+x^3}} \, dx=\frac {\sqrt {2}\,\sqrt {-x}\,\left (3\,\sqrt {2}+4\right )\,\sqrt {1-x}\,\sqrt {x+1}\,\Pi \left (\frac {1}{\sqrt {2}+1};\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )}{2\,\sqrt {x^3-x}\,\left (\sqrt {2}+1\right )}-\frac {2\,\sqrt {-x}\,\sqrt {1-x}\,\sqrt {x+1}\,\mathrm {F}\left (\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )}{\sqrt {x^3-x}}-\frac {\sqrt {2}\,\sqrt {-x}\,\left (3\,\sqrt {2}-4\right )\,\sqrt {1-x}\,\sqrt {x+1}\,\Pi \left (-\frac {1}{\sqrt {2}-1};\mathrm {asin}\left (\sqrt {-x}\right )\middle |-1\right )}{2\,\sqrt {x^3-x}\,\left (\sqrt {2}-1\right )} \]

input
int(-(x - x^2)/((x^3 - x)^(1/2)*(2*x + x^2 - 1)),x)
 
output
(2^(1/2)*(-x)^(1/2)*(3*2^(1/2) + 4)*(1 - x)^(1/2)*(x + 1)^(1/2)*ellipticPi 
(1/(2^(1/2) + 1), asin((-x)^(1/2)), -1))/(2*(x^3 - x)^(1/2)*(2^(1/2) + 1)) 
 - (2*(-x)^(1/2)*(1 - x)^(1/2)*(x + 1)^(1/2)*ellipticF(asin((-x)^(1/2)), - 
1))/(x^3 - x)^(1/2) - (2^(1/2)*(-x)^(1/2)*(3*2^(1/2) - 4)*(1 - x)^(1/2)*(x 
 + 1)^(1/2)*ellipticPi(-1/(2^(1/2) - 1), asin((-x)^(1/2)), -1))/(2*(x^3 - 
x)^(1/2)*(2^(1/2) - 1))