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

   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 [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 34 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=\frac {3}{2 (1-x)}-\frac {5}{4} \log (1-x)+2 \log (x)-\frac {3}{4} \log (1+x) \]

[Out]

3/2/(1-x)-5/4*ln(1-x)+2*ln(x)-3/4*ln(1+x)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {1626} \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=\frac {3}{2 (1-x)}-\frac {5}{4} \log (1-x)+2 \log (x)-\frac {3}{4} \log (x+1) \]

[In]

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

[Out]

3/(2*(1 - x)) - (5*Log[1 - x])/4 + 2*Log[x] - (3*Log[1 + x])/4

Rule 1626

Int[(Px_)*((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[E
xpandIntegrand[Px*(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && Poly
Q[Px, x] && IntegersQ[m, n]

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 32, normalized size of antiderivative = 0.94 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=-\frac {3}{2 (-1+x)}-\frac {5}{4} \log (1-x)+2 \log (x)-\frac {3}{4} \log (1+x) \]

[In]

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

[Out]

-3/(2*(-1 + x)) - (5*Log[1 - x])/4 + 2*Log[x] - (3*Log[1 + x])/4

Maple [A] (verified)

Time = 0.79 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.74

method result size
default \(2 \ln \left (x \right )-\frac {3 \ln \left (x +1\right )}{4}-\frac {3}{2 \left (x -1\right )}-\frac {5 \ln \left (x -1\right )}{4}\) \(25\)
norman \(2 \ln \left (x \right )-\frac {3 \ln \left (x +1\right )}{4}-\frac {3}{2 \left (x -1\right )}-\frac {5 \ln \left (x -1\right )}{4}\) \(25\)
risch \(2 \ln \left (x \right )-\frac {3 \ln \left (x +1\right )}{4}-\frac {3}{2 \left (x -1\right )}-\frac {5 \ln \left (x -1\right )}{4}\) \(25\)
parallelrisch \(\frac {8 \ln \left (x \right ) x -5 \ln \left (x -1\right ) x -3 \ln \left (x +1\right ) x -6-8 \ln \left (x \right )+5 \ln \left (x -1\right )+3 \ln \left (x +1\right )}{4 x -4}\) \(45\)

[In]

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

[Out]

2*ln(x)-3/4*ln(x+1)-3/2/(x-1)-5/4*ln(x-1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.00 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=-\frac {3 \, {\left (x - 1\right )} \log \left (x + 1\right ) + 5 \, {\left (x - 1\right )} \log \left (x - 1\right ) - 8 \, {\left (x - 1\right )} \log \left (x\right ) + 6}{4 \, {\left (x - 1\right )}} \]

[In]

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

[Out]

-1/4*(3*(x - 1)*log(x + 1) + 5*(x - 1)*log(x - 1) - 8*(x - 1)*log(x) + 6)/(x - 1)

Sympy [A] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.79 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=2 \log {\left (x \right )} - \frac {5 \log {\left (x - 1 \right )}}{4} - \frac {3 \log {\left (x + 1 \right )}}{4} - \frac {3}{2 x - 2} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.71 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=-\frac {3}{2 \, {\left (x - 1\right )}} - \frac {3}{4} \, \log \left (x + 1\right ) - \frac {5}{4} \, \log \left (x - 1\right ) + 2 \, \log \left (x\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

-3/2/(x - 1) + 2*log(abs(-1/(x - 1) - 1)) - 3/4*log(abs(-2/(x - 1) - 1))

Mupad [B] (verification not implemented)

Time = 9.38 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.76 \[ \int \frac {2+x^2}{(-1+x)^2 x (1+x)} \, dx=2\,\ln \left (x\right )-\frac {3\,\ln \left (x+1\right )}{4}-\frac {5\,\ln \left (x-1\right )}{4}-\frac {3}{2\,\left (x-1\right )} \]

[In]

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

[Out]

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