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

Optimal. Leaf size=18 \[ \frac{x^2}{2}-3 x+\frac{1}{x}+3 \log (x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0060952, antiderivative size = 18, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 17, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.059, Rules used = {14} \[ \frac{x^2}{2}-3 x+\frac{1}{x}+3 \log (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rubi steps

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

Mathematica [A]  time = 0.0009972, size = 18, normalized size = 1. \[ \frac{x^2}{2}-3 x+\frac{1}{x}+3 \log (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 17, normalized size = 0.9 \begin{align*}{x}^{-1}-3\,x+{\frac{{x}^{2}}{2}}+3\,\ln \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.08976, size = 22, normalized size = 1.22 \begin{align*} \frac{1}{2} \, x^{2} - 3 \, x + \frac{1}{x} + 3 \, \log \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.29276, size = 51, normalized size = 2.83 \begin{align*} \frac{x^{3} - 6 \, x^{2} + 6 \, x \log \left (x\right ) + 2}{2 \, x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(x^3 - 6*x^2 + 6*x*log(x) + 2)/x

________________________________________________________________________________________

Sympy [A]  time = 0.073847, size = 15, normalized size = 0.83 \begin{align*} \frac{x^{2}}{2} - 3 x + 3 \log{\left (x \right )} + \frac{1}{x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.10959, size = 23, normalized size = 1.28 \begin{align*} \frac{1}{2} \, x^{2} - 3 \, x + \frac{1}{x} + 3 \, \log \left ({\left | x \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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