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

3.6.2.1 Optimal result
3.6.2.2 Mathematica [A] (verified)
3.6.2.3 Rubi [C] (verified)
3.6.2.4 Maple [A] (verified)
3.6.2.5 Fricas [A] (verification not implemented)
3.6.2.6 Sympy [F]
3.6.2.7 Maxima [F]
3.6.2.8 Giac [F]
3.6.2.9 Mupad [B] (verification not implemented)

3.6.2.1 Optimal result

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

output
(x^3+x)^(1/2)/(x^2+x+1)-arctan((x^3+x)^(1/2)/(x^2+1))
 
3.6.2.2 Mathematica [A] (verified)

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

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

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

Time = 8.42 (sec) , antiderivative size = 1709, normalized size of antiderivative = 43.82, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {2467, 25, 2035, 7293, 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 {\left (x^2-1\right ) \sqrt {x^3+x}}{\left (x^2+1\right ) \left (x^2+x+1\right )^2} \, dx\)

\(\Big \downarrow \) 2467

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 2035

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

\(\Big \downarrow \) 7293

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

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {2 \sqrt {x^3+x} \left (\frac {\left (i+\sqrt {3}\right ) \arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )}{4 \left (i-\sqrt {3}\right )}+\frac {\left (i-\sqrt {3}\right ) \arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )}{4 \left (i+\sqrt {3}\right )}+\frac {\arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )}{2 \sqrt {3} \left (i+\sqrt {3}\right )}+\frac {1}{12} \left (1+i \sqrt {3}\right ) \arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )+\frac {1}{12} \left (1-i \sqrt {3}\right ) \arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )-\frac {\arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )}{2 \sqrt {3} \left (i-\sqrt {3}\right )}+\frac {1}{3} \arctan \left (\frac {\sqrt {x}}{\sqrt {x^2+1}}\right )+\frac {\text {arctanh}\left (\frac {2-\left (1-i \sqrt {3}\right ) x}{\sqrt {2 \left (1-i \sqrt {3}\right )} \sqrt {x^2+1}}\right )}{4 \left (i+\sqrt {3}\right )}-\frac {\text {arctanh}\left (\frac {\left (1+i \sqrt {3}\right )^2 x+4}{2 \sqrt {2 \left (1-i \sqrt {3}\right )} \sqrt {x^2+1}}\right )}{4 \left (i+\sqrt {3}\right )}+\frac {\left (i+\sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} E\left (2 \arctan \left (\sqrt {x}\right )|\frac {1}{2}\right )}{6 \left (i-\sqrt {3}\right ) \sqrt {x^2+1}}+\frac {\left (i-\sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} E\left (2 \arctan \left (\sqrt {x}\right )|\frac {1}{2}\right )}{6 \left (i+\sqrt {3}\right ) \sqrt {x^2+1}}+\frac {(x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} E\left (2 \arctan \left (\sqrt {x}\right )|\frac {1}{2}\right )}{3 \left (1+i \sqrt {3}\right ) \sqrt {x^2+1}}+\frac {(x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} E\left (2 \arctan \left (\sqrt {x}\right )|\frac {1}{2}\right )}{3 \left (1-i \sqrt {3}\right ) \sqrt {x^2+1}}+\frac {\left (1+i \sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticF}\left (2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{8 \sqrt {x^2+1}}-\frac {(x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticF}\left (2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{6 \left (1+i \sqrt {3}\right ) \sqrt {x^2+1}}+\frac {\left (1-i \sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticF}\left (2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{8 \sqrt {x^2+1}}-\frac {(x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticF}\left (2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{6 \left (1-i \sqrt {3}\right ) \sqrt {x^2+1}}-\frac {(x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticF}\left (2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{6 \sqrt {x^2+1}}-\frac {\left (i+\sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticPi}\left (\frac {1}{4},2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{8 \left (i-\sqrt {3}\right ) \sqrt {x^2+1}}-\frac {\left (i-\sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticPi}\left (\frac {1}{4},2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{8 \left (i+\sqrt {3}\right ) \sqrt {x^2+1}}-\frac {\left (3+i \sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticPi}\left (\frac {1}{4},2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{48 \sqrt {x^2+1}}-\frac {\left (3-i \sqrt {3}\right ) (x+1) \sqrt {\frac {x^2+1}{(x+1)^2}} \operatorname {EllipticPi}\left (\frac {1}{4},2 \arctan \left (\sqrt {x}\right ),\frac {1}{2}\right )}{48 \sqrt {x^2+1}}-\frac {\left (i+\sqrt {3}\right ) \sqrt {x^2+1}}{6 \left (i-\sqrt {3}\right ) \left (-2 \sqrt {x}-i \sqrt {3}+1\right )}-\frac {\sqrt {x^2+1}}{3 \left (1+i \sqrt {3}\right ) \left (-2 \sqrt {x}-i \sqrt {3}+1\right )}-\frac {\left (i-\sqrt {3}\right ) \sqrt {x^2+1}}{6 \left (i+\sqrt {3}\right ) \left (-2 \sqrt {x}+i \sqrt {3}+1\right )}-\frac {\sqrt {x^2+1}}{3 \left (1-i \sqrt {3}\right ) \left (-2 \sqrt {x}+i \sqrt {3}+1\right )}+\frac {\left (i+\sqrt {3}\right ) \sqrt {x^2+1}}{6 \left (i-\sqrt {3}\right ) \left (2 \sqrt {x}-i \sqrt {3}+1\right )}+\frac {\sqrt {x^2+1}}{3 \left (1+i \sqrt {3}\right ) \left (2 \sqrt {x}-i \sqrt {3}+1\right )}+\frac {\left (i-\sqrt {3}\right ) \sqrt {x^2+1}}{6 \left (i+\sqrt {3}\right ) \left (2 \sqrt {x}+i \sqrt {3}+1\right )}+\frac {\sqrt {x^2+1}}{3 \left (1-i \sqrt {3}\right ) \left (2 \sqrt {x}+i \sqrt {3}+1\right )}-\frac {\left (i+\sqrt {3}\right ) \sqrt {x} \sqrt {x^2+1}}{6 \left (i-\sqrt {3}\right ) (x+1)}-\frac {\left (i-\sqrt {3}\right ) \sqrt {x} \sqrt {x^2+1}}{6 \left (i+\sqrt {3}\right ) (x+1)}-\frac {\sqrt {x} \sqrt {x^2+1}}{3 \left (1+i \sqrt {3}\right ) (x+1)}-\frac {\sqrt {x} \sqrt {x^2+1}}{3 \left (1-i \sqrt {3}\right ) (x+1)}\right )}{\sqrt {x} \sqrt {x^2+1}}\)

input
Int[((-1 + x^2)*Sqrt[x + x^3])/((1 + x^2)*(1 + x + x^2)^2),x]
 
output
(-2*Sqrt[x + x^3]*(-1/3*Sqrt[1 + x^2]/((1 + I*Sqrt[3])*(1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Sqrt[3])) + ((I + Sqrt[3])*ArcTan[Sqrt[x]/Sq 
rt[1 + x^2]])/(4*(I - Sqrt[3])) + ArcTanh[(2 - (1 - I*Sqrt[3])*x)/(Sqrt[2* 
(1 - I*Sqrt[3])]*Sqrt[1 + x^2])]/(4*(I + Sqrt[3])) - ArcTanh[(4 + (1 + I*S 
qrt[3])^2*x)/(2*Sqrt[2*(1 - I*Sqrt[3])]*Sqrt[1 + x^2])]/(4*(I + Sqrt[3])) 
+ ((1 + x)*Sqrt[(1 + x^2)/(1 + x)^2]*EllipticE[2*ArcTan[Sqrt[x]], 1/2])...
 

3.6.2.3.1 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 7293
Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v] 
]
 
3.6.2.4 Maple [A] (verified)

Time = 7.37 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.03

method result size
risch \(\frac {\left (x^{2}+1\right ) x}{\left (x^{2}+x +1\right ) \sqrt {\left (x^{2}+1\right ) x}}+\arctan \left (\frac {\sqrt {\left (x^{2}+1\right ) x}}{x}\right )\) \(40\)
default \(\frac {\left (x^{2}+x +1\right ) \arctan \left (\frac {\sqrt {\left (x^{2}+1\right ) x}}{x}\right )+\sqrt {\left (x^{2}+1\right ) x}}{x^{2}+x +1}\) \(41\)
pseudoelliptic \(\frac {\left (x^{2}+x +1\right ) \arctan \left (\frac {\sqrt {\left (x^{2}+1\right ) x}}{x}\right )+\sqrt {\left (x^{2}+1\right ) x}}{x^{2}+x +1}\) \(41\)
trager \(\frac {\sqrt {x^{3}+x}}{x^{2}+x +1}-\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right ) \ln \left (\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right ) x^{2}-\operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right ) x +2 \sqrt {x^{3}+x}+\operatorname {RootOf}\left (\textit {\_Z}^{2}+1\right )}{x^{2}+x +1}\right )}{2}\) \(71\)
elliptic \(\frac {\sqrt {x^{3}+x}}{x^{2}+x +1}+\frac {i \sqrt {-i \left (i+x \right )}\, \sqrt {2}\, \sqrt {i \left (-i+x \right )}\, \sqrt {i x}\, \operatorname {EllipticF}\left (\sqrt {-i \left (i+x \right )}, \frac {\sqrt {2}}{2}\right )}{2 \sqrt {x^{3}+x}}+\frac {i \left (-\frac {1}{2}+\frac {i \sqrt {3}}{2}\right ) \sqrt {-i \left (i+x \right )}\, \sqrt {2}\, \sqrt {i \left (-i+x \right )}\, \sqrt {i x}\, \left (i \left (-\frac {1}{2}+\frac {i \sqrt {3}}{2}\right )+1+i\right ) \operatorname {EllipticPi}\left (\sqrt {-i \left (i+x \right )}, \frac {1}{2}-i+\frac {i \sqrt {3}}{2}, \frac {\sqrt {2}}{2}\right )}{2 \sqrt {x^{3}+x}}+\frac {i \left (-\frac {1}{2}-\frac {i \sqrt {3}}{2}\right ) \sqrt {-i \left (i+x \right )}\, \sqrt {2}\, \sqrt {i \left (-i+x \right )}\, \sqrt {i x}\, \left (i \left (-\frac {1}{2}-\frac {i \sqrt {3}}{2}\right )+1+i\right ) \operatorname {EllipticPi}\left (\sqrt {-i \left (i+x \right )}, \frac {1}{2}-i-\frac {i \sqrt {3}}{2}, \frac {\sqrt {2}}{2}\right )}{2 \sqrt {x^{3}+x}}\) \(240\)

input
int((x^2-1)*(x^3+x)^(1/2)/(x^2+1)/(x^2+x+1)^2,x,method=_RETURNVERBOSE)
 
output
(x^2+1)*x/(x^2+x+1)/((x^2+1)*x)^(1/2)+arctan(1/x*((x^2+1)*x)^(1/2))
 
3.6.2.5 Fricas [A] (verification not implemented)

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

input
integrate((x^2-1)*(x^3+x)^(1/2)/(x^2+1)/(x^2+x+1)^2,x, algorithm="fricas")
 
output
1/2*((x^2 + x + 1)*arctan(1/2*(x^2 - x + 1)/sqrt(x^3 + x)) + 2*sqrt(x^3 + 
x))/(x^2 + x + 1)
 
3.6.2.6 Sympy [F]

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

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

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

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

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

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

Time = 5.39 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.26 \[ \int \frac {\left (-1+x^2\right ) \sqrt {x+x^3}}{\left (1+x^2\right ) \left (1+x+x^2\right )^2} \, dx=\frac {\sqrt {x^3+x}}{x^2+x+1}-\frac {\ln \left (x^2+x+1\right )\,1{}\mathrm {i}}{2}+\frac {\ln \left (x^2-x+1+\sqrt {x^3+x}\,2{}\mathrm {i}\right )\,1{}\mathrm {i}}{2} \]

input
int(((x^2 - 1)*(x + x^3)^(1/2))/((x^2 + 1)*(x + x^2 + 1)^2),x)
 
output
(log((x + x^3)^(1/2)*2i - x + x^2 + 1)*1i)/2 - (log(x + x^2 + 1)*1i)/2 + ( 
x + x^3)^(1/2)/(x + x^2 + 1)