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

Optimal. Leaf size=16 \[ 2+3 x-x^2+\log (-2+x)+\log (x) \]

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 17, normalized size of antiderivative = 1.06, number of steps used = 3, number of rules used = 2, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.080, Rules used = {1593, 1620} \begin {gather*} -x^2+3 x+\log (2-x)+\log (x) \end {gather*}

Antiderivative was successfully verified.

[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 1593

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 1620

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 {gather*} \begin {aligned} \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 {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 17, normalized size = 1.06 \begin {gather*} 3 x-x^2+\log (2-x)+\log (x) \end {gather*}

Antiderivative was successfully verified.

[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]

________________________________________________________________________________________

fricas [A]  time = 0.56, size = 17, normalized size = 1.06 \begin {gather*} -x^{2} + 3 \, x + \log \left (x^{2} - 2 \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________

giac [A]  time = 0.17, size = 17, normalized size = 1.06 \begin {gather*} -x^{2} + 3 \, x + \log \left ({\left | x - 2 \right |}\right ) + \log \left ({\left | x \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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))

________________________________________________________________________________________

maple [A]  time = 0.40, size = 16, normalized size = 1.00




method result size



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



Verification of antiderivative is not currently implemented for this CAS.

[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(x-2)

________________________________________________________________________________________

maxima [A]  time = 0.42, size = 15, normalized size = 0.94 \begin {gather*} -x^{2} + 3 \, x + \log \left (x - 2\right ) + \log \relax (x) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________

mupad [B]  time = 1.45, size = 15, normalized size = 0.94 \begin {gather*} 3\,x+\ln \left (x\,\left (x-2\right )\right )-x^2 \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

sympy [A]  time = 0.08, size = 14, normalized size = 0.88 \begin {gather*} - x^{2} + 3 x + \log {\left (x^{2} - 2 x \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________