Optimal. Leaf size=86 \[ \frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}+\sqrt {2} \tan ^{-1}\left (\frac {\sqrt {2} (1+x)}{\sqrt {1-x+x^2}}\right )-\frac {\tanh ^{-1}\left (\frac {\sqrt {\frac {2}{3}} (1-x)}{\sqrt {1-x+x^2}}\right )}{\sqrt {6}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {1074, 1049,
1043, 212, 210} \begin {gather*} \sqrt {2} \text {ArcTan}\left (\frac {\sqrt {2} (x+1)}{\sqrt {x^2-x+1}}\right )+\frac {\sqrt {x^2-x+1} (x+1)}{x^2+x+1}-\frac {\tanh ^{-1}\left (\frac {\sqrt {\frac {2}{3}} (1-x)}{\sqrt {x^2-x+1}}\right )}{\sqrt {6}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 212
Rule 1043
Rule 1049
Rule 1074
Rubi steps
\begin {align*} \int \frac {1-x+3 x^2}{\sqrt {1-x+x^2} \left (1+x+x^2\right )^2} \, dx &=\frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}+\frac {1}{12} \int \frac {18-6 x}{\sqrt {1-x+x^2} \left (1+x+x^2\right )} \, dx\\ &=\frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}+\frac {1}{48} \int \frac {24+24 x}{\sqrt {1-x+x^2} \left (1+x+x^2\right )} \, dx-\frac {1}{48} \int \frac {-48+48 x}{\sqrt {1-x+x^2} \left (1+x+x^2\right )} \, dx\\ &=\frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}+24 \text {Subst}\left (\int \frac {1}{1728-2 x^2} \, dx,x,\frac {-24+24 x}{\sqrt {1-x+x^2}}\right )+288 \text {Subst}\left (\int \frac {1}{-20736-2 x^2} \, dx,x,\frac {-144-144 x}{\sqrt {1-x+x^2}}\right )\\ &=\frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}+\sqrt {2} \tan ^{-1}\left (\frac {\sqrt {2} (1+x)}{\sqrt {1-x+x^2}}\right )-\frac {\tanh ^{-1}\left (\frac {\sqrt {\frac {2}{3}} (1-x)}{\sqrt {1-x+x^2}}\right )}{\sqrt {6}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 9 vs. order 3 in
optimal.
time = 0.32, size = 239, normalized size = 2.78 \begin {gather*} \frac {(1+x) \sqrt {1-x+x^2}}{1+x+x^2}-\text {RootSum}\left [3+6 \text {$\#$1}+\text {$\#$1}^2-2 \text {$\#$1}^3+\text {$\#$1}^4\&,\frac {19 \log \left (-x+\sqrt {1-x+x^2}-\text {$\#$1}\right )+6 \log \left (-x+\sqrt {1-x+x^2}-\text {$\#$1}\right ) \text {$\#$1}}{3+\text {$\#$1}-3 \text {$\#$1}^2+2 \text {$\#$1}^3}\&\right ]-\frac {1}{2} \text {RootSum}\left [3+6 \text {$\#$1}+\text {$\#$1}^2-2 \text {$\#$1}^3+\text {$\#$1}^4\&,\frac {-36 \log \left (-x+\sqrt {1-x+x^2}-\text {$\#$1}\right )-6 \log \left (-x+\sqrt {1-x+x^2}-\text {$\#$1}\right ) \text {$\#$1}+\log \left (-x+\sqrt {1-x+x^2}-\text {$\#$1}\right ) \text {$\#$1}^2}{3+\text {$\#$1}-3 \text {$\#$1}^2+2 \text {$\#$1}^3}\&\right ] \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(454\) vs.
\(2(71)=142\).
time = 0.74, size = 455, normalized size = 5.29
method | result | size |
risch | \(\frac {\left (1+x \right ) \sqrt {x^{2}-x +1}}{x^{2}+x +1}+\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (6 \sqrt {2}\, \arctan \left (\frac {2 \sqrt {2}\, \left (1+x \right )}{\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (1-x \right )}\right )-\sqrt {6}\, \arctanh \left (\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \sqrt {6}}{4}\right )\right )}{6 \sqrt {\frac {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}{\left (\frac {1+x}{1-x}+1\right )^{2}}}\, \left (\frac {1+x}{1-x}+1\right )}\) | \(158\) |
default | \(\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (3 \sqrt {2}\, \arctan \left (\frac {2 \sqrt {2}\, \left (1+x \right )}{\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (1-x \right )}\right )-\sqrt {6}\, \arctanh \left (\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \sqrt {6}}{4}\right )\right )}{2 \sqrt {\frac {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}{\left (\frac {1+x}{1-x}+1\right )^{2}}}\, \left (\frac {1+x}{1-x}+1\right )}-\frac {\frac {9 \sqrt {2}\, \sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \arctan \left (\frac {2 \sqrt {2}\, \left (1+x \right )}{\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (1-x \right )}\right ) \left (1+x \right )^{2}}{\left (1-x \right )^{2}}-\frac {6 \sqrt {6}\, \sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \arctanh \left (\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \sqrt {6}}{4}\right ) \left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3 \sqrt {2}\, \arctan \left (\frac {2 \sqrt {2}\, \left (1+x \right )}{\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \left (1-x \right )}\right ) \sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}-2 \sqrt {6}\, \arctanh \left (\frac {\sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}\, \sqrt {6}}{4}\right ) \sqrt {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}-\frac {12 \left (1+x \right )^{3}}{\left (1-x \right )^{3}}-\frac {36 \left (1+x \right )}{1-x}}{6 \sqrt {\frac {\frac {\left (1+x \right )^{2}}{\left (1-x \right )^{2}}+3}{\left (\frac {1+x}{1-x}+1\right )^{2}}}\, \left (\frac {1+x}{1-x}+1\right ) \left (\frac {3 \left (1+x \right )^{2}}{\left (1-x \right )^{2}}+1\right )}\) | \(455\) |
trager | \(\frac {\left (1+x \right ) \sqrt {x^{2}-x +1}}{x^{2}+x +1}-\frac {24 \ln \left (\frac {1728 x \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{5}-744 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3} x +1344 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3}+1560 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} \sqrt {x^{2}-x +1}+76 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right ) x -224 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )+1287 \sqrt {x^{2}-x +1}}{24 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} x +15 x +8}\right ) \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3}}{13}-\frac {22 \ln \left (\frac {1728 x \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{5}-744 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3} x +1344 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3}+1560 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} \sqrt {x^{2}-x +1}+76 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right ) x -224 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )+1287 \sqrt {x^{2}-x +1}}{24 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} x +15 x +8}\right ) \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )}{13}+\RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right ) \ln \left (-\frac {3456 x \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{5}+6312 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3} x -2688 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{3}+1560 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} \sqrt {x^{2}-x +1}+2635 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right ) x -1736 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )+143 \sqrt {x^{2}-x +1}}{24 \RootOf \left (576 \textit {\_Z}^{4}+528 \textit {\_Z}^{2}+169\right )^{2} x +7 x -8}\right )\) | \(524\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 358 vs.
\(2 (69) = 138\).
time = 1.06, size = 358, normalized size = 4.16 \begin {gather*} -\frac {8 \, \sqrt {6} \sqrt {3} {\left (x^{2} + x + 1\right )} \arctan \left (\frac {2}{3} \, \sqrt {6} \sqrt {3} {\left (x - 1\right )} + \frac {2}{3} \, \sqrt {2 \, x^{2} - \sqrt {x^{2} - x + 1} {\left (2 \, x - \sqrt {6} + 1\right )} - \sqrt {6} {\left (x + 1\right )} + 4} {\left (\sqrt {6} \sqrt {3} + 3 \, \sqrt {3}\right )} - \frac {2}{3} \, \sqrt {x^{2} - x + 1} {\left (\sqrt {6} \sqrt {3} + 3 \, \sqrt {3}\right )} + \sqrt {3} {\left (2 \, x - 1\right )}\right ) + 8 \, \sqrt {6} \sqrt {3} {\left (x^{2} + x + 1\right )} \arctan \left (\frac {2}{3} \, \sqrt {6} \sqrt {3} {\left (x - 1\right )} + \frac {2}{3} \, \sqrt {2 \, x^{2} - \sqrt {x^{2} - x + 1} {\left (2 \, x + \sqrt {6} + 1\right )} + \sqrt {6} {\left (x + 1\right )} + 4} {\left (\sqrt {6} \sqrt {3} - 3 \, \sqrt {3}\right )} - \frac {2}{3} \, \sqrt {x^{2} - x + 1} {\left (\sqrt {6} \sqrt {3} - 3 \, \sqrt {3}\right )} - \sqrt {3} {\left (2 \, x - 1\right )}\right ) - \sqrt {6} {\left (x^{2} + x + 1\right )} \log \left (12168 \, x^{2} - 6084 \, \sqrt {x^{2} - x + 1} {\left (2 \, x + \sqrt {6} + 1\right )} + 6084 \, \sqrt {6} {\left (x + 1\right )} + 24336\right ) + \sqrt {6} {\left (x^{2} + x + 1\right )} \log \left (12168 \, x^{2} - 6084 \, \sqrt {x^{2} - x + 1} {\left (2 \, x - \sqrt {6} + 1\right )} - 6084 \, \sqrt {6} {\left (x + 1\right )} + 24336\right ) - 12 \, x^{2} - 12 \, \sqrt {x^{2} - x + 1} {\left (x + 1\right )} - 12 \, x - 12}{12 \, {\left (x^{2} + x + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {3 x^{2} - x + 1}{\sqrt {x^{2} - x + 1} \left (x^{2} + x + 1\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 304 vs.
\(2 (69) = 138\).
time = 0.85, size = 304, normalized size = 3.53 \begin {gather*} -\frac {1}{3} \, \sqrt {6} \sqrt {3} \arctan \left (-\frac {2 \, x + \sqrt {6} - 2 \, \sqrt {x^{2} - x + 1} + 1}{\sqrt {3} + \sqrt {2}}\right ) + \frac {1}{3} \, \sqrt {6} \sqrt {3} \arctan \left (-\frac {2 \, x - \sqrt {6} - 2 \, \sqrt {x^{2} - x + 1} + 1}{\sqrt {3} - \sqrt {2}}\right ) + \frac {1}{12} \, \sqrt {6} \log \left (4 \, {\left (\sqrt {6} \sqrt {3} + 3 \, \sqrt {3}\right )}^{2} + 36 \, {\left (2 \, x + \sqrt {6} - 2 \, \sqrt {x^{2} - x + 1} + 1\right )}^{2}\right ) - \frac {1}{12} \, \sqrt {6} \log \left (4 \, {\left (\sqrt {6} \sqrt {3} - 3 \, \sqrt {3}\right )}^{2} + 36 \, {\left (2 \, x - \sqrt {6} - 2 \, \sqrt {x^{2} - x + 1} + 1\right )}^{2}\right ) + \frac {{\left (x - \sqrt {x^{2} - x + 1}\right )}^{3} + 4 \, {\left (x - \sqrt {x^{2} - x + 1}\right )}^{2} - 10 \, x + 10 \, \sqrt {x^{2} - x + 1} + 5}{{\left (x - \sqrt {x^{2} - x + 1}\right )}^{4} + 2 \, {\left (x - \sqrt {x^{2} - x + 1}\right )}^{3} + {\left (x - \sqrt {x^{2} - x + 1}\right )}^{2} - 6 \, x + 6 \, \sqrt {x^{2} - x + 1} + 3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {3\,x^2-x+1}{\sqrt {x^2-x+1}\,{\left (x^2+x+1\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________