3.312 \(\int \frac{2-4 x^2+x^3}{\left (1+x^2\right ) \left (2+x^2\right )} \, dx\)

Optimal. Leaf size=36 \[ -\frac{1}{2} \log \left (x^2+1\right )+\log \left (x^2+2\right )+6 \tan ^{-1}(x)-5 \sqrt{2} \tan ^{-1}\left (\frac{x}{\sqrt{2}}\right ) \]

[Out]

6*ArcTan[x] - 5*Sqrt[2]*ArcTan[x/Sqrt[2]] - Log[1 + x^2]/2 + Log[2 + x^2]

_______________________________________________________________________________________

Rubi [A]  time = 0.217059, antiderivative size = 36, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 4, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.16 \[ -\frac{1}{2} \log \left (x^2+1\right )+\log \left (x^2+2\right )+6 \tan ^{-1}(x)-5 \sqrt{2} \tan ^{-1}\left (\frac{x}{\sqrt{2}}\right ) \]

Antiderivative was successfully verified.

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

[Out]

6*ArcTan[x] - 5*Sqrt[2]*ArcTan[x/Sqrt[2]] - Log[1 + x^2]/2 + Log[2 + x^2]

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 35.1153, size = 36, normalized size = 1. \[ - \frac{\log{\left (x^{2} + 1 \right )}}{2} + \log{\left (x^{2} + 2 \right )} + 6 \operatorname{atan}{\left (x \right )} - 5 \sqrt{2} \operatorname{atan}{\left (\frac{\sqrt{2} x}{2} \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((x**3-4*x**2+2)/(x**2+1)/(x**2+2),x)

[Out]

-log(x**2 + 1)/2 + log(x**2 + 2) + 6*atan(x) - 5*sqrt(2)*atan(sqrt(2)*x/2)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0259529, size = 36, normalized size = 1. \[ -\frac{1}{2} \log \left (x^2+1\right )+\log \left (x^2+2\right )+6 \tan ^{-1}(x)-5 \sqrt{2} \tan ^{-1}\left (\frac{x}{\sqrt{2}}\right ) \]

Antiderivative was successfully verified.

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

[Out]

6*ArcTan[x] - 5*Sqrt[2]*ArcTan[x/Sqrt[2]] - Log[1 + x^2]/2 + Log[2 + x^2]

_______________________________________________________________________________________

Maple [A]  time = 0.005, size = 32, normalized size = 0.9 \[ 6\,\arctan \left ( x \right ) -{\frac{\ln \left ({x}^{2}+1 \right ) }{2}}+\ln \left ({x}^{2}+2 \right ) -5\,\arctan \left ( 1/2\,\sqrt{2}x \right ) \sqrt{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((x^3-4*x^2+2)/(x^2+1)/(x^2+2),x)

[Out]

6*arctan(x)-1/2*ln(x^2+1)+ln(x^2+2)-5*arctan(1/2*2^(1/2)*x)*2^(1/2)

_______________________________________________________________________________________

Maxima [A]  time = 0.896717, size = 42, normalized size = 1.17 \[ -5 \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + 6 \, \arctan \left (x\right ) + \log \left (x^{2} + 2\right ) - \frac{1}{2} \, \log \left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-5*sqrt(2)*arctan(1/2*sqrt(2)*x) + 6*arctan(x) + log(x^2 + 2) - 1/2*log(x^2 + 1)

_______________________________________________________________________________________

Fricas [A]  time = 0.253366, size = 42, normalized size = 1.17 \[ -5 \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + 6 \, \arctan \left (x\right ) + \log \left (x^{2} + 2\right ) - \frac{1}{2} \, \log \left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-5*sqrt(2)*arctan(1/2*sqrt(2)*x) + 6*arctan(x) + log(x^2 + 2) - 1/2*log(x^2 + 1)

_______________________________________________________________________________________

Sympy [A]  time = 0.547452, size = 36, normalized size = 1. \[ - \frac{\log{\left (x^{2} + 1 \right )}}{2} + \log{\left (x^{2} + 2 \right )} + 6 \operatorname{atan}{\left (x \right )} - 5 \sqrt{2} \operatorname{atan}{\left (\frac{\sqrt{2} x}{2} \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((x**3-4*x**2+2)/(x**2+1)/(x**2+2),x)

[Out]

-log(x**2 + 1)/2 + log(x**2 + 2) + 6*atan(x) - 5*sqrt(2)*atan(sqrt(2)*x/2)

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.264769, size = 42, normalized size = 1.17 \[ -5 \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + 6 \, \arctan \left (x\right ) +{\rm ln}\left (x^{2} + 2\right ) - \frac{1}{2} \,{\rm ln}\left (x^{2} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-5*sqrt(2)*arctan(1/2*sqrt(2)*x) + 6*arctan(x) + ln(x^2 + 2) - 1/2*ln(x^2 + 1)