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

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

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}} \]

[Out]

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

Rubi [C] (verified)

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

Time = 0.65 (sec) , antiderivative size = 229, normalized size of antiderivative = 6.54, number of steps used = 13, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.219, Rules used = {2081, 6860, 335, 228, 947, 174, 551} \[ \int \frac {-1-2 x+x^2}{\left (1+2 x+3 x^2\right ) \sqrt {-x+x^3}} \, dx=\frac {\sqrt {2} \sqrt {x-1} \sqrt {x} \sqrt {x+1} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {2} \sqrt {x}}{\sqrt {x-1}}\right ),\frac {1}{2}\right )}{3 \sqrt {x^3-x}}+\frac {2 \left (1+2 i \sqrt {2}\right ) \sqrt {x} \sqrt {1-x^2} \operatorname {EllipticPi}\left (\frac {3}{4-i \sqrt {2}},\arcsin \left (\sqrt {1-x}\right ),\frac {1}{2}\right )}{3 \left (\sqrt {2}+4 i\right ) \sqrt {x^3-x}}-\frac {2 \left (1-2 i \sqrt {2}\right ) \sqrt {x} \sqrt {1-x^2} \operatorname {EllipticPi}\left (\frac {3}{4+i \sqrt {2}},\arcsin \left (\sqrt {1-x}\right ),\frac {1}{2}\right )}{3 \left (-\sqrt {2}+4 i\right ) \sqrt {x^3-x}} \]

[In]

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

[Out]

(Sqrt[2]*Sqrt[-1 + x]*Sqrt[x]*Sqrt[1 + x]*EllipticF[ArcSin[(Sqrt[2]*Sqrt[x])/Sqrt[-1 + x]], 1/2])/(3*Sqrt[-x +
 x^3]) + (2*(1 + (2*I)*Sqrt[2])*Sqrt[x]*Sqrt[1 - x^2]*EllipticPi[3/(4 - I*Sqrt[2]), ArcSin[Sqrt[1 - x]], 1/2])
/(3*(4*I + Sqrt[2])*Sqrt[-x + x^3]) - (2*(1 - (2*I)*Sqrt[2])*Sqrt[x]*Sqrt[1 - x^2]*EllipticPi[3/(4 + I*Sqrt[2]
), ArcSin[Sqrt[1 - x]], 1/2])/(3*(4*I - Sqrt[2])*Sqrt[-x + x^3])

Rule 174

Int[1/(((a_.) + (b_.)*(x_))*Sqrt[(c_.) + (d_.)*(x_)]*Sqrt[(e_.) + (f_.)*(x_)]*Sqrt[(g_.) + (h_.)*(x_)]), x_Sym
bol] :> Dist[-2, Subst[Int[1/(Simp[b*c - a*d - b*x^2, x]*Sqrt[Simp[(d*e - c*f)/d + f*(x^2/d), x]]*Sqrt[Simp[(d
*g - c*h)/d + h*(x^2/d), x]]), x], x, Sqrt[c + d*x]], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x] && GtQ[(d*e - c
*f)/d, 0]

Rule 228

Int[1/Sqrt[(a_) + (b_.)*(x_)^4], x_Symbol] :> With[{q = Rt[(-a)*b, 2]}, Simp[Sqrt[-a + q*x^2]*(Sqrt[(a + q*x^2
)/q]/(Sqrt[2]*Sqrt[-a]*Sqrt[a + b*x^4]))*EllipticF[ArcSin[x/Sqrt[(a + q*x^2)/(2*q)]], 1/2], x] /; IntegerQ[q]]
 /; FreeQ[{a, b}, x] && LtQ[a, 0] && GtQ[b, 0]

Rule 335

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> With[{k = Denominator[m]}, Dist[k/c, Subst[I
nt[x^(k*(m + 1) - 1)*(a + b*(x^(k*n)/c^n))^p, x], x, (c*x)^(1/k)], x]] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0]
 && FractionQ[m] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 551

Int[1/(((a_) + (b_.)*(x_)^2)*Sqrt[(c_) + (d_.)*(x_)^2]*Sqrt[(e_) + (f_.)*(x_)^2]), x_Symbol] :> Simp[(1/(a*Sqr
t[c]*Sqrt[e]*Rt[-d/c, 2]))*EllipticPi[b*(c/(a*d)), ArcSin[Rt[-d/c, 2]*x], c*(f/(d*e))], x] /; FreeQ[{a, b, c,
d, e, f}, x] &&  !GtQ[d/c, 0] && GtQ[c, 0] && GtQ[e, 0] &&  !( !GtQ[f/e, 0] && SimplerSqrtQ[-f/e, -d/c])

Rule 947

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(f_.) + (g_.)*(x_)]*Sqrt[(a_) + (c_.)*(x_)^2]), x_Symbol] :> With[{q = Rt[-c/
a, 2]}, Dist[Sqrt[1 + c*(x^2/a)]/Sqrt[a + c*x^2], Int[1/((d + e*x)*Sqrt[f + g*x]*Sqrt[1 - q*x]*Sqrt[1 + q*x]),
 x], x]] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] && NeQ[c*d^2 + a*e^2, 0] &&  !GtQ[a, 0]

Rule 2081

Int[(u_.)*(P_)^(p_.), x_Symbol] :> With[{m = MinimumMonomialExponent[P, x]}, Dist[P^FracPart[p]/(x^(m*FracPart
[p])*Distrib[1/x^m, P]^FracPart[p]), Int[u*x^(m*p)*Distrib[1/x^m, P]^p, x], x]] /; FreeQ[p, x] &&  !IntegerQ[p
] && SumQ[P] && EveryQ[BinomialQ[#1, x] & , P] &&  !PolyQ[P, x, 2]

Rule 6860

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] /; SumQ[v]] /; FreeQ[{a, b, c}, x] && EqQ[n2, 2*n] && IGtQ[n, 0]

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

Mathematica [A] (verified)

Time = 1.61 (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 )}} \]

[In]

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

[Out]

(-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)])

Maple [C] (verified)

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

Time = 4.81 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.80

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 -\operatorname {RootOf}\left (\textit {\_Z}^{2}-3\right )+6 \sqrt {x^{3}-x}}{3 x^{2}+2 x +1}\right )}{3}\) \(63\)
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\)

[In]

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

[Out]

-1/3*RootOf(_Z^2-3)*ln((3*RootOf(_Z^2-3)*x^2+4*RootOf(_Z^2-3)*x-RootOf(_Z^2-3)+6*(x^3-x)^(1/2))/(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.26 (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 ) \]

[In]

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

[Out]

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 \]

[In]

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

[Out]

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 } \]

[In]

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

[Out]

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 } \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 5.23 (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 )} \]

[In]

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

[Out]

(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), a
sin((-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))