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

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

[Out]

(-1 + x)^(-1) + ArcTan[x] + Log[1 - x] - Log[1 + x^2]/2

_______________________________________________________________________________________

Rubi [A]  time = 0.0551849, antiderivative size = 24, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19 \[ -\frac{1}{2} \log \left (x^2+1\right )+\frac{1}{x-1}+\log (1-x)+\tan ^{-1}(x) \]

Antiderivative was successfully verified.

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

[Out]

(-1 + x)^(-1) + ArcTan[x] + Log[1 - x] - Log[1 + x^2]/2

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 3.94718, size = 20, normalized size = 0.83 \[ \log{\left (- x + 1 \right )} - \frac{\log{\left (x^{2} + 1 \right )}}{2} + \operatorname{atan}{\left (x \right )} - \frac{1}{- x + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

log(-x + 1) - log(x**2 + 1)/2 + atan(x) - 1/(-x + 1)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0224286, size = 22, normalized size = 0.92 \[ -\frac{1}{2} \log \left (x^2+1\right )+\frac{1}{x-1}+\log (x-1)+\tan ^{-1}(x) \]

Antiderivative was successfully verified.

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

[Out]

(-1 + x)^(-1) + ArcTan[x] + Log[-1 + x] - Log[1 + x^2]/2

_______________________________________________________________________________________

Maple [A]  time = 0.01, size = 21, normalized size = 0.9 \[ -{\frac{\ln \left ({x}^{2}+1 \right ) }{2}}+\arctan \left ( x \right ) +\ln \left ( -1+x \right ) + \left ( -1+x \right ) ^{-1} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Maxima [A]  time = 1.50396, size = 27, normalized size = 1.12 \[ \frac{1}{x - 1} + \arctan \left (x\right ) - \frac{1}{2} \, \log \left (x^{2} + 1\right ) + \log \left (x - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Fricas [A]  time = 0.199105, size = 49, normalized size = 2.04 \[ \frac{2 \,{\left (x - 1\right )} \arctan \left (x\right ) -{\left (x - 1\right )} \log \left (x^{2} + 1\right ) + 2 \,{\left (x - 1\right )} \log \left (x - 1\right ) + 2}{2 \,{\left (x - 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Sympy [A]  time = 0.157644, size = 20, normalized size = 0.83 \[ \log{\left (x - 1 \right )} - \frac{\log{\left (x^{2} + 1 \right )}}{2} + \operatorname{atan}{\left (x \right )} + \frac{1}{x - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

log(x - 1) - log(x**2 + 1)/2 + atan(x) + 1/(x - 1)

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.210148, size = 63, normalized size = 2.62 \[ \frac{1}{4} \, \pi - \pi \left \lfloor \frac{\pi + 4 \, \arctan \left (x\right )}{4 \, \pi } + \frac{1}{2} \right \rfloor + \frac{1}{x - 1} + \arctan \left (x\right ) - \frac{1}{2} \,{\rm ln}\left (\frac{2}{x - 1} + \frac{2}{{\left (x - 1\right )}^{2}} + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

1/4*pi - pi*floor(1/4*(pi + 4*arctan(x))/pi + 1/2) + 1/(x - 1) + arctan(x) - 1/2
*ln(2/(x - 1) + 2/(x - 1)^2 + 1)