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

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

[Out]

-2/(1 + x) - (7 + 5*x)/(3*(1 + x + x^2)) - (25*ArcTan[(1 + 2*x)/Sqrt[3]])/(3*Sqr
t[3]) - Log[1 + x] + Log[1 + x + x^2]/2

_______________________________________________________________________________________

Rubi [A]  time = 0.142791, antiderivative size = 63, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 6, integrand size = 22, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.273 \[ -\frac{5 x+7}{3 \left (x^2+x+1\right )}+\frac{1}{2} \log \left (x^2+x+1\right )-\frac{2}{x+1}-\log (x+1)-\frac{25 \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{3 \sqrt{3}} \]

Antiderivative was successfully verified.

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

[Out]

-2/(1 + x) - (7 + 5*x)/(3*(1 + x + x^2)) - (25*ArcTan[(1 + 2*x)/Sqrt[3]])/(3*Sqr
t[3]) - Log[1 + x] + Log[1 + x + x^2]/2

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 7.24958, size = 58, normalized size = 0.92 \[ - \frac{5 x + 7}{3 \left (x^{2} + x + 1\right )} - \log{\left (x + 1 \right )} + \frac{\log{\left (x^{2} + x + 1 \right )}}{2} - \frac{25 \sqrt{3} \operatorname{atan}{\left (\sqrt{3} \left (\frac{2 x}{3} + \frac{1}{3}\right ) \right )}}{9} - \frac{2}{x + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-(5*x + 7)/(3*(x**2 + x + 1)) - log(x + 1) + log(x**2 + x + 1)/2 - 25*sqrt(3)*at
an(sqrt(3)*(2*x/3 + 1/3))/9 - 2/(x + 1)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0558649, size = 63, normalized size = 1. \[ -\frac{5 x+7}{3 \left (x^2+x+1\right )}+\frac{1}{2} \log \left (x^2+x+1\right )-\frac{2}{x+1}-\log (x+1)-\frac{25 \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{3 \sqrt{3}} \]

Antiderivative was successfully verified.

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

[Out]

-2/(1 + x) - (7 + 5*x)/(3*(1 + x + x^2)) - (25*ArcTan[(1 + 2*x)/Sqrt[3]])/(3*Sqr
t[3]) - Log[1 + x] + Log[1 + x + x^2]/2

_______________________________________________________________________________________

Maple [A]  time = 0.013, size = 54, normalized size = 0.9 \[ -2\, \left ( 1+x \right ) ^{-1}-\ln \left ( 1+x \right ) +{\frac{1}{{x}^{2}+x+1} \left ( -{\frac{5\,x}{3}}-{\frac{7}{3}} \right ) }+{\frac{\ln \left ({x}^{2}+x+1 \right ) }{2}}-{\frac{25\,\sqrt{3}}{9}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) } \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-2/(1+x)-ln(1+x)+(-5/3*x-7/3)/(x^2+x+1)+1/2*ln(x^2+x+1)-25/9*arctan(1/3*(1+2*x)*
3^(1/2))*3^(1/2)

_______________________________________________________________________________________

Maxima [A]  time = 1.59144, size = 80, normalized size = 1.27 \[ -\frac{25}{9} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) - \frac{11 \, x^{2} + 18 \, x + 13}{3 \,{\left (x^{3} + 2 \, x^{2} + 2 \, x + 1\right )}} + \frac{1}{2} \, \log \left (x^{2} + x + 1\right ) - \log \left (x + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-25/9*sqrt(3)*arctan(1/3*sqrt(3)*(2*x + 1)) - 1/3*(11*x^2 + 18*x + 13)/(x^3 + 2*
x^2 + 2*x + 1) + 1/2*log(x^2 + x + 1) - log(x + 1)

_______________________________________________________________________________________

Fricas [A]  time = 0.224771, size = 147, normalized size = 2.33 \[ \frac{\sqrt{3}{\left (3 \, \sqrt{3}{\left (x^{3} + 2 \, x^{2} + 2 \, x + 1\right )} \log \left (x^{2} + x + 1\right ) - 6 \, \sqrt{3}{\left (x^{3} + 2 \, x^{2} + 2 \, x + 1\right )} \log \left (x + 1\right ) - 50 \,{\left (x^{3} + 2 \, x^{2} + 2 \, x + 1\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) - 2 \, \sqrt{3}{\left (11 \, x^{2} + 18 \, x + 13\right )}\right )}}{18 \,{\left (x^{3} + 2 \, x^{2} + 2 \, x + 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

1/18*sqrt(3)*(3*sqrt(3)*(x^3 + 2*x^2 + 2*x + 1)*log(x^2 + x + 1) - 6*sqrt(3)*(x^
3 + 2*x^2 + 2*x + 1)*log(x + 1) - 50*(x^3 + 2*x^2 + 2*x + 1)*arctan(1/3*sqrt(3)*
(2*x + 1)) - 2*sqrt(3)*(11*x^2 + 18*x + 13))/(x^3 + 2*x^2 + 2*x + 1)

_______________________________________________________________________________________

Sympy [A]  time = 0.238796, size = 66, normalized size = 1.05 \[ - \frac{11 x^{2} + 18 x + 13}{3 x^{3} + 6 x^{2} + 6 x + 3} - \log{\left (x + 1 \right )} + \frac{\log{\left (x^{2} + x + 1 \right )}}{2} - \frac{25 \sqrt{3} \operatorname{atan}{\left (\frac{2 \sqrt{3} x}{3} + \frac{\sqrt{3}}{3} \right )}}{9} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-(11*x**2 + 18*x + 13)/(3*x**3 + 6*x**2 + 6*x + 3) - log(x + 1) + log(x**2 + x +
 1)/2 - 25*sqrt(3)*atan(2*sqrt(3)*x/3 + sqrt(3)/3)/9

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.214229, size = 97, normalized size = 1.54 \[ -\frac{25}{9} \, \sqrt{3} \arctan \left (-\frac{1}{3} \, \sqrt{3}{\left (\frac{2}{x + 1} - 1\right )}\right ) + \frac{\frac{7}{x + 1} - 2}{3 \,{\left (\frac{1}{x + 1} - \frac{1}{{\left (x + 1\right )}^{2}} - 1\right )}} - \frac{2}{x + 1} + \frac{1}{2} \,{\rm ln}\left (-\frac{1}{x + 1} + \frac{1}{{\left (x + 1\right )}^{2}} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

-25/9*sqrt(3)*arctan(-1/3*sqrt(3)*(2/(x + 1) - 1)) + 1/3*(7/(x + 1) - 2)/(1/(x +
 1) - 1/(x + 1)^2 - 1) - 2/(x + 1) + 1/2*ln(-1/(x + 1) + 1/(x + 1)^2 + 1)