\(\int \frac {-x+x^3}{(-1+x)^2 (1+x^2)} \, dx\) [324]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 20, antiderivative size = 9 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\arctan (x)+\log (1-x) \]

[Out]

arctan(x)+ln(1-x)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {1600, 1607, 1643, 209} \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\arctan (x)+\log (1-x) \]

[In]

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

[Out]

ArcTan[x] + Log[1 - x]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 1600

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 1607

Int[(u_.)*((a_.)*(x_)^(p_.) + (b_.)*(x_)^(q_.))^(n_.), x_Symbol] :> Int[u*x^(n*p)*(a + b*x^(q - p))^n, x] /; F
reeQ[{a, b, p, q}, x] && IntegerQ[n] && PosQ[q - p]

Rule 1643

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*
Pq*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps \begin{align*} \text {integral}& = \int \frac {x+x^2}{(-1+x) \left (1+x^2\right )} \, dx \\ & = \int \frac {x (1+x)}{(-1+x) \left (1+x^2\right )} \, dx \\ & = \int \left (\frac {1}{-1+x}+\frac {1}{1+x^2}\right ) \, dx \\ & = \log (1-x)+\int \frac {1}{1+x^2} \, dx \\ & = \tan ^{-1}(x)+\log (1-x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\arctan (x)+\log (1-x) \]

[In]

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

[Out]

ArcTan[x] + Log[1 - x]

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.89

method result size
default \(\arctan \left (x \right )+\ln \left (x -1\right )\) \(8\)
risch \(\arctan \left (x \right )+\ln \left (x -1\right )\) \(8\)
parallelrisch \(\frac {i \ln \left (x +i\right )}{2}-\frac {i \ln \left (x -i\right )}{2}+\ln \left (x -1\right )\) \(22\)

[In]

int((x^3-x)/(x-1)^2/(x^2+1),x,method=_RETURNVERBOSE)

[Out]

arctan(x)+ln(x-1)

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 7, normalized size of antiderivative = 0.78 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\arctan \left (x\right ) + \log \left (x - 1\right ) \]

[In]

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

[Out]

arctan(x) + log(x - 1)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 7, normalized size of antiderivative = 0.78 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\log {\left (x - 1 \right )} + \operatorname {atan}{\left (x \right )} \]

[In]

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

[Out]

log(x - 1) + atan(x)

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 7, normalized size of antiderivative = 0.78 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\arctan \left (x\right ) + \log \left (x - 1\right ) \]

[In]

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

[Out]

arctan(x) + log(x - 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 28 vs. \(2 (9) = 18\).

Time = 0.30 (sec) , antiderivative size = 28, normalized size of antiderivative = 3.11 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\frac {1}{4} \, \pi - \pi \left \lfloor \frac {\pi + 4 \, \arctan \left (x\right )}{4 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (x\right ) + \log \left ({\left | x - 1 \right |}\right ) \]

[In]

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

[Out]

1/4*pi - pi*floor(1/4*(pi + 4*arctan(x))/pi + 1/2) + arctan(x) + log(abs(x - 1))

Mupad [B] (verification not implemented)

Time = 9.26 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.11 \[ \int \frac {-x+x^3}{(-1+x)^2 \left (1+x^2\right )} \, dx=\ln \left (x-1\right )-\mathrm {atan}\left (\frac {5}{4\,x+2}-\frac {1}{2}\right ) \]

[In]

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

[Out]

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