\(\int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx\) [2604]

   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 = 25, antiderivative size = 16 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=2+3 x-x^2+\log (-2+x)+\log (x) \]

[Out]

ln(-2+x)+2+3*x+ln(x)-x^2

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.080, Rules used = {1607, 1634} \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=-x^2+3 x+\log (2-x)+\log (x) \]

[In]

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

[Out]

3*x - x^2 + Log[2 - x] + Log[x]

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 1634

Int[(Px_)*((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[Px*(a + b*x)
^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && PolyQ[Px, x] && (IntegersQ[m, n] || IGtQ[m, -2]) &&
GtQ[Expon[Px, x], 2]

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=3 x-x^2+\log (2-x)+\log (x) \]

[In]

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

[Out]

3*x - x^2 + Log[2 - x] + Log[x]

Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00

method result size
default \(3 x -x^{2}+\ln \left (x \right )+\ln \left (-2+x \right )\) \(16\)
norman \(3 x -x^{2}+\ln \left (x \right )+\ln \left (-2+x \right )\) \(16\)
parallelrisch \(3 x -x^{2}+\ln \left (x \right )+\ln \left (-2+x \right )\) \(16\)
risch \(-x^{2}+3 x +\ln \left (x^{2}-2 x \right )\) \(18\)
meijerg \(\ln \left (x \right )-\ln \left (2\right )+i \pi +\ln \left (1-\frac {x}{2}\right )-\frac {2 x \left (\frac {3 x}{2}+6\right )}{3}+7 x\) \(29\)

[In]

int((-2*x^3+7*x^2-4*x-2)/(x^2-2*x),x,method=_RETURNVERBOSE)

[Out]

3*x-x^2+ln(x)+ln(-2+x)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.06 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=-x^{2} + 3 \, x + \log \left (x^{2} - 2 \, x\right ) \]

[In]

integrate((-2*x^3+7*x^2-4*x-2)/(x^2-2*x),x, algorithm="fricas")

[Out]

-x^2 + 3*x + log(x^2 - 2*x)

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.88 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=- x^{2} + 3 x + \log {\left (x^{2} - 2 x \right )} \]

[In]

integrate((-2*x**3+7*x**2-4*x-2)/(x**2-2*x),x)

[Out]

-x**2 + 3*x + log(x**2 - 2*x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.94 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=-x^{2} + 3 \, x + \log \left (x - 2\right ) + \log \left (x\right ) \]

[In]

integrate((-2*x^3+7*x^2-4*x-2)/(x^2-2*x),x, algorithm="maxima")

[Out]

-x^2 + 3*x + log(x - 2) + log(x)

Giac [A] (verification not implemented)

none

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

[In]

integrate((-2*x^3+7*x^2-4*x-2)/(x^2-2*x),x, algorithm="giac")

[Out]

-x^2 + 3*x + log(abs(x - 2)) + log(abs(x))

Mupad [B] (verification not implemented)

Time = 8.12 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.94 \[ \int \frac {-2-4 x+7 x^2-2 x^3}{-2 x+x^2} \, dx=3\,x+\ln \left (x\,\left (x-2\right )\right )-x^2 \]

[In]

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

[Out]

3*x + log(x*(x - 2)) - x^2