Optimal. Leaf size=59 \[ -\text {ArcTan}\left (\frac {\sqrt {x+x^2+x^3}}{1+x+x^2}\right )-\frac {\tanh ^{-1}\left (\frac {\sqrt {3} \sqrt {x+x^2+x^3}}{1+x+x^2}\right )}{\sqrt {3}} \]
[Out]
________________________________________________________________________________________
Rubi [C] Result contains higher order function than in optimal. Order 4 vs. order 3 in
optimal.
time = 0.72, antiderivative size = 322, normalized size of antiderivative = 5.46, number of steps
used = 17, number of rules used = 8, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.320, Rules used = {2081, 6857,
730, 1117, 948, 175, 552, 551} \begin {gather*} -\frac {4 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}} \Pi \left (\frac {1}{2} \left (1-i \sqrt {3}\right );\text {ArcSin}\left (\frac {1}{2} \left (1-i \sqrt {3}\right ) \sqrt {x}\right )|\frac {i+\sqrt {3}}{i-\sqrt {3}}\right )}{\left (1-i \sqrt {3}\right ) \sqrt {x^3+x^2+x}}-\frac {4 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}} \Pi \left (\frac {1}{2} \left (-1+i \sqrt {3}\right );\text {ArcSin}\left (\frac {1}{2} \left (1-i \sqrt {3}\right ) \sqrt {x}\right )|\frac {i+\sqrt {3}}{i-\sqrt {3}}\right )}{\left (1-i \sqrt {3}\right ) \sqrt {x^3+x^2+x}}+\frac {\sqrt {x} (x+1) \sqrt {\frac {x^2+x+1}{(x+1)^2}} F\left (2 \text {ArcTan}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x^3+x^2+x}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 175
Rule 551
Rule 552
Rule 730
Rule 948
Rule 1117
Rule 2081
Rule 6857
Rubi steps
\begin {align*} \int \frac {1+x^2}{\left (-1+x^2\right ) \sqrt {x+x^2+x^3}} \, dx &=\frac {\left (\sqrt {x} \sqrt {1+x+x^2}\right ) \int \frac {1+x^2}{\sqrt {x} \left (-1+x^2\right ) \sqrt {1+x+x^2}} \, dx}{\sqrt {x+x^2+x^3}}\\ &=\frac {\left (\sqrt {x} \sqrt {1+x+x^2}\right ) \int \left (\frac {1}{\sqrt {x} \sqrt {1+x+x^2}}+\frac {2}{\sqrt {x} \left (-1+x^2\right ) \sqrt {1+x+x^2}}\right ) \, dx}{\sqrt {x+x^2+x^3}}\\ &=\frac {\left (\sqrt {x} \sqrt {1+x+x^2}\right ) \int \frac {1}{\sqrt {x} \sqrt {1+x+x^2}} \, dx}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+x+x^2}\right ) \int \frac {1}{\sqrt {x} \left (-1+x^2\right ) \sqrt {1+x+x^2}} \, dx}{\sqrt {x+x^2+x^3}}\\ &=\frac {\left (2 \sqrt {x} \sqrt {1+x+x^2}\right ) \int \left (-\frac {1}{2 (1-x) \sqrt {x} \sqrt {1+x+x^2}}-\frac {1}{2 \sqrt {x} (1+x) \sqrt {1+x+x^2}}\right ) \, dx}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+x+x^2}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1+x^2+x^4}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}-\frac {\left (\sqrt {x} \sqrt {1+x+x^2}\right ) \int \frac {1}{(1-x) \sqrt {x} \sqrt {1+x+x^2}} \, dx}{\sqrt {x+x^2+x^3}}-\frac {\left (\sqrt {x} \sqrt {1+x+x^2}\right ) \int \frac {1}{\sqrt {x} (1+x) \sqrt {1+x+x^2}} \, dx}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}-\frac {\left (\sqrt {x} \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}\right ) \int \frac {1}{(1-x) \sqrt {x} \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}} \, dx}{\sqrt {x+x^2+x^3}}-\frac {\left (\sqrt {x} \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}\right ) \int \frac {1}{\sqrt {x} (1+x) \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}} \, dx}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}\right ) \text {Subst}\left (\int \frac {1}{\left (-1-x^2\right ) \sqrt {1-i \sqrt {3}+2 x^2} \sqrt {1+i \sqrt {3}+2 x^2}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1-i \sqrt {3}+2 x} \sqrt {1+i \sqrt {3}+2 x}\right ) \text {Subst}\left (\int \frac {1}{\left (-1+x^2\right ) \sqrt {1-i \sqrt {3}+2 x^2} \sqrt {1+i \sqrt {3}+2 x^2}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+i \sqrt {3}+2 x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}}\right ) \text {Subst}\left (\int \frac {1}{\left (-1-x^2\right ) \sqrt {1+i \sqrt {3}+2 x^2} \sqrt {1+\frac {2 x^2}{1-i \sqrt {3}}}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+i \sqrt {3}+2 x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}}\right ) \text {Subst}\left (\int \frac {1}{\left (-1+x^2\right ) \sqrt {1+i \sqrt {3}+2 x^2} \sqrt {1+\frac {2 x^2}{1-i \sqrt {3}}}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}}\right ) \text {Subst}\left (\int \frac {1}{\left (-1-x^2\right ) \sqrt {1+\frac {2 x^2}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x^2}{1+i \sqrt {3}}}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}+\frac {\left (2 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}}\right ) \text {Subst}\left (\int \frac {1}{\left (-1+x^2\right ) \sqrt {1+\frac {2 x^2}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x^2}{1+i \sqrt {3}}}} \, dx,x,\sqrt {x}\right )}{\sqrt {x+x^2+x^3}}\\ &=\frac {\sqrt {x} (1+x) \sqrt {\frac {1+x+x^2}{(1+x)^2}} F\left (2 \tan ^{-1}\left (\sqrt {x}\right )|\frac {1}{4}\right )}{\sqrt {x+x^2+x^3}}-\frac {4 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}} \Pi \left (\frac {1}{2} \left (1-i \sqrt {3}\right );\sin ^{-1}\left (\frac {1}{2} \left (1-i \sqrt {3}\right ) \sqrt {x}\right )|\frac {i+\sqrt {3}}{i-\sqrt {3}}\right )}{\left (1-i \sqrt {3}\right ) \sqrt {x+x^2+x^3}}-\frac {4 \sqrt {x} \sqrt {1+\frac {2 x}{1-i \sqrt {3}}} \sqrt {1+\frac {2 x}{1+i \sqrt {3}}} \Pi \left (\frac {1}{2} \left (-1+i \sqrt {3}\right );\sin ^{-1}\left (\frac {1}{2} \left (1-i \sqrt {3}\right ) \sqrt {x}\right )|\frac {i+\sqrt {3}}{i-\sqrt {3}}\right )}{\left (1-i \sqrt {3}\right ) \sqrt {x+x^2+x^3}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.22, size = 79, normalized size = 1.34 \begin {gather*} -\frac {\sqrt {x} \sqrt {1+x+x^2} \left (3 \text {ArcTan}\left (\frac {\sqrt {x}}{\sqrt {1+x+x^2}}\right )+\sqrt {3} \tanh ^{-1}\left (\frac {\sqrt {3} \sqrt {x}}{\sqrt {1+x+x^2}}\right )\right )}{3 \sqrt {x \left (1+x+x^2\right )}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains higher order function than in optimal. Order 4 vs. order
3.
time = 1.28, size = 420, normalized size = 7.12 Too large to display
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 [A]
time = 0.38, size = 89, normalized size = 1.51 \begin {gather*} \frac {1}{12} \, \sqrt {3} \log \left (\frac {x^{4} + 20 \, x^{3} - 4 \, \sqrt {3} \sqrt {x^{3} + x^{2} + x} {\left (x^{2} + 4 \, x + 1\right )} + 30 \, x^{2} + 20 \, x + 1}{x^{4} - 4 \, x^{3} + 6 \, x^{2} - 4 \, x + 1}\right ) + \frac {1}{2} \, \arctan \left (\frac {x^{2} + 1}{2 \, \sqrt {x^{3} + x^{2} + x}}\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 {x^{2} + 1}{\sqrt {x \left (x^{2} + x + 1\right )} \left (x - 1\right ) \left (x + 1\right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.17, size = 223, normalized size = 3.78 \begin {gather*} -\frac {\sqrt {\frac {x}{-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\,\sqrt {-\frac {x+\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}{-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\,\sqrt {\frac {x+\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}{\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\,\left (\sqrt {3}+1{}\mathrm {i}\right )\,\left (-\mathrm {F}\left (\mathrm {asin}\left (\sqrt {\frac {x}{-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\right )\middle |-\frac {-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}{\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}\right )+\Pi \left (\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2};\mathrm {asin}\left (\sqrt {\frac {x}{-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\right )\middle |-\frac {-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}{\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}\right )+\Pi \left (-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2};\mathrm {asin}\left (\sqrt {\frac {x}{-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}}\right )\middle |-\frac {-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}{\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}}\right )\right )\,1{}\mathrm {i}}{\sqrt {x^3+x^2-\left (-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,x}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________