Optimal. Leaf size=122 \[ -\frac {4 (-2+x) (1+x)}{3 \sqrt {(-2+x) (1+x)^3}}+\frac {2 \sqrt {-2+x} (1+x)^{3/2} \sinh ^{-1}\left (\frac {\sqrt {-2+x}}{\sqrt {3}}\right )}{\sqrt {(-2+x) (1+x)^3}}-\frac {\sqrt {2} \sqrt {-2+x} (1+x)^{3/2} \tan ^{-1}\left (\frac {\sqrt {2} \sqrt {1+x}}{\sqrt {-2+x}}\right )}{\sqrt {(-2+x) (1+x)^3}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.23, antiderivative size = 133, normalized size of antiderivative = 1.09, number of steps
used = 9, number of rules used = 9, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.474, Rules used = {1607, 6851,
1628, 21, 132, 56, 221, 95, 210} \begin {gather*} -\frac {\sqrt {2} \sqrt {x-2} (x+1)^{3/2} \text {ArcTan}\left (\frac {\sqrt {2} \sqrt {x+1}}{\sqrt {x-2}}\right )}{\sqrt {-\left ((2-x) (x+1)^3\right )}}+\frac {4 (2-x) (x+1)}{3 \sqrt {-\left ((2-x) (x+1)^3\right )}}+\frac {2 \sqrt {x-2} (x+1)^{3/2} \sinh ^{-1}\left (\frac {\sqrt {x-2}}{\sqrt {3}}\right )}{\sqrt {-\left ((2-x) (x+1)^3\right )}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 21
Rule 56
Rule 95
Rule 132
Rule 210
Rule 221
Rule 1607
Rule 1628
Rule 6851
Rubi steps
\begin {align*} \int \frac {\frac {1}{x}+x}{\sqrt {(-2+x) (1+x)^3}} \, dx &=\int \frac {1+x^2}{x \sqrt {(-2+x) (1+x)^3}} \, dx\\ &=\frac {\left (\sqrt {-2+x} (1+x)^{3/2}\right ) \int \frac {1+x^2}{\sqrt {-2+x} x (1+x)^{3/2}} \, dx}{\sqrt {(-2+x) (1+x)^3}}\\ &=\frac {4 (2-x) (1+x)}{3 \sqrt {-(2-x) (1+x)^3}}-\frac {\left (2 \sqrt {-2+x} (1+x)^{3/2}\right ) \int \frac {-\frac {3}{2}-\frac {3 x}{2}}{\sqrt {-2+x} x \sqrt {1+x}} \, dx}{3 \sqrt {(-2+x) (1+x)^3}}\\ &=\frac {4 (2-x) (1+x)}{3 \sqrt {-(2-x) (1+x)^3}}+\frac {\left (\sqrt {-2+x} (1+x)^{3/2}\right ) \int \frac {\sqrt {1+x}}{\sqrt {-2+x} x} \, dx}{\sqrt {(-2+x) (1+x)^3}}\\ &=\frac {4 (2-x) (1+x)}{3 \sqrt {-(2-x) (1+x)^3}}+\frac {\left (\sqrt {-2+x} (1+x)^{3/2}\right ) \int \frac {1}{\sqrt {-2+x} \sqrt {1+x}} \, dx}{\sqrt {(-2+x) (1+x)^3}}+\frac {\left (\sqrt {-2+x} (1+x)^{3/2}\right ) \int \frac {1}{\sqrt {-2+x} x \sqrt {1+x}} \, dx}{\sqrt {(-2+x) (1+x)^3}}\\ &=\frac {4 (2-x) (1+x)}{3 \sqrt {-(2-x) (1+x)^3}}+\frac {\left (2 \sqrt {-2+x} (1+x)^{3/2}\right ) \text {Subst}\left (\int \frac {1}{-1-2 x^2} \, dx,x,\frac {\sqrt {1+x}}{\sqrt {-2+x}}\right )}{\sqrt {(-2+x) (1+x)^3}}+\frac {\left (2 \sqrt {-2+x} (1+x)^{3/2}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {3+x^2}} \, dx,x,\sqrt {-2+x}\right )}{\sqrt {(-2+x) (1+x)^3}}\\ &=\frac {4 (2-x) (1+x)}{3 \sqrt {-(2-x) (1+x)^3}}+\frac {2 \sqrt {-2+x} (1+x)^{3/2} \sinh ^{-1}\left (\frac {\sqrt {-2+x}}{\sqrt {3}}\right )}{\sqrt {-(2-x) (1+x)^3}}-\frac {\sqrt {2} \sqrt {-2+x} (1+x)^{3/2} \tan ^{-1}\left (\frac {\sqrt {2} \sqrt {1+x}}{\sqrt {-2+x}}\right )}{\sqrt {-(2-x) (1+x)^3}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.08, size = 96, normalized size = 0.79 \begin {gather*} -\frac {(1+x) \left (-8+4 x-3 \sqrt {2} \sqrt {-2+x} \sqrt {1+x} \tan ^{-1}\left (\frac {\sqrt {\frac {-2+x}{1+x}}}{\sqrt {2}}\right )-6 \sqrt {-2+x} \sqrt {1+x} \tanh ^{-1}\left (\sqrt {\frac {-2+x}{1+x}}\right )\right )}{3 \sqrt {(-2+x) (1+x)^3}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 118, normalized size = 0.97
method | result | size |
risch | \(-\frac {4 \left (-2+x \right ) \left (1+x \right )}{3 \sqrt {\left (-2+x \right ) \left (1+x \right )^{3}}}+\frac {\left (\ln \left (x -\frac {1}{2}+\sqrt {x^{2}-x -2}\right )+\frac {\sqrt {2}\, \arctan \left (\frac {\left (-4-x \right ) \sqrt {2}}{4 \sqrt {x^{2}-x -2}}\right )}{2}\right ) \left (1+x \right ) \sqrt {\left (1+x \right ) \left (-2+x \right )}}{\sqrt {\left (-2+x \right ) \left (1+x \right )^{3}}}\) | \(86\) |
default | \(\frac {\left (-3 \sqrt {2}\, \arctan \left (\frac {\left (4+x \right ) \sqrt {2}}{4 \sqrt {x^{2}-x -2}}\right ) x +6 \ln \left (x -\frac {1}{2}+\sqrt {x^{2}-x -2}\right ) x -3 \sqrt {2}\, \arctan \left (\frac {\left (4+x \right ) \sqrt {2}}{4 \sqrt {x^{2}-x -2}}\right )+6 \ln \left (x -\frac {1}{2}+\sqrt {x^{2}-x -2}\right )-8 \sqrt {x^{2}-x -2}\right ) \sqrt {\left (1+x \right ) \left (-2+x \right )}}{6 \sqrt {\left (-2+x \right ) \left (1+x \right )^{3}}}\) | \(118\) |
trager | \(-\frac {4 \sqrt {x^{4}+x^{3}-3 x^{2}-5 x -2}}{3 \left (1+x \right )^{2}}+\frac {\RootOf \left (\textit {\_Z}^{2}+2\right ) \ln \left (\frac {\RootOf \left (\textit {\_Z}^{2}+2\right ) x^{2}+5 \RootOf \left (\textit {\_Z}^{2}+2\right ) x +4 \sqrt {x^{4}+x^{3}-3 x^{2}-5 x -2}+4 \RootOf \left (\textit {\_Z}^{2}+2\right )}{x \left (1+x \right )}\right )}{2}-\ln \left (\frac {-2 x^{2}+2 \sqrt {x^{4}+x^{3}-3 x^{2}-5 x -2}-x +1}{1+x}\right )\) | \(132\) |
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.41, size = 142, normalized size = 1.16 \begin {gather*} \frac {3 \, \sqrt {2} {\left (x^{2} + 2 \, x + 1\right )} \arctan \left (-\frac {\sqrt {2} {\left (x^{2} + x\right )} - \sqrt {2} \sqrt {x^{4} + x^{3} - 3 \, x^{2} - 5 \, x - 2}}{2 \, {\left (x + 1\right )}}\right ) - 4 \, x^{2} - 3 \, {\left (x^{2} + 2 \, x + 1\right )} \log \left (-\frac {2 \, x^{2} + x - 2 \, \sqrt {x^{4} + x^{3} - 3 \, x^{2} - 5 \, x - 2} - 1}{x + 1}\right ) - 8 \, x - 4 \, \sqrt {x^{4} + x^{3} - 3 \, x^{2} - 5 \, x - 2} - 4}{3 \, {\left (x^{2} + 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 {x^{2} + 1}{x \sqrt {\left (x - 2\right ) \left (x + 1\right )^{3}}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.58, size = 83, normalized size = 0.68 \begin {gather*} \frac {\sqrt {2} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (x - \sqrt {x^{2} - x - 2}\right )}\right )}{\mathrm {sgn}\left (x + 1\right )} - \frac {\log \left ({\left | -2 \, x + 2 \, \sqrt {x^{2} - x - 2} + 1 \right |}\right )}{\mathrm {sgn}\left (x + 1\right )} - \frac {4}{{\left (x - \sqrt {x^{2} - x - 2} + 1\right )} \mathrm {sgn}\left (x + 1\right )} \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 {x+\frac {1}{x}}{\sqrt {{\left (x+1\right )}^3\,\left (x-2\right )}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________