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

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

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {1607, 1816} \[ \int \frac {-1-4 x+2 x^2+x^3}{-x+x^3} \, dx=x-\log (1-x)+\log (x)+2 \log (x+1) \]

[In]

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

[Out]

x - Log[1 - x] + Log[x] + 2*Log[1 + 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 1816

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

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

Mathematica [A] (verified)

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

[In]

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

[Out]

x - Log[1 - x] + Log[x] + 2*Log[1 + x]

Maple [A] (verified)

Time = 0.54 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.94

method result size
default \(x +\ln \left (x \right )+2 \ln \left (1+x \right )-\ln \left (-1+x \right )\) \(17\)
norman \(x +\ln \left (x \right )+2 \ln \left (1+x \right )-\ln \left (-1+x \right )\) \(17\)
risch \(x +\ln \left (x \right )+2 \ln \left (1+x \right )-\ln \left (-1+x \right )\) \(17\)
parallelrisch \(x +\ln \left (x \right )+2 \ln \left (1+x \right )-\ln \left (-1+x \right )\) \(17\)
meijerg \(\ln \left (x \right )+\frac {i \pi }{2}+\frac {\ln \left (-x^{2}+1\right )}{2}-\frac {i \left (2 i x -2 i \operatorname {arctanh}\left (x \right )\right )}{2}+4 \,\operatorname {arctanh}\left (x \right )\) \(35\)

[In]

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

[Out]

x+ln(x)+2*ln(1+x)-ln(-1+x)

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

x + 2*log(abs(x + 1)) - log(abs(x - 1)) + log(abs(x))

Mupad [B] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.22 \[ \int \frac {-1-4 x+2 x^2+x^3}{-x+x^3} \, dx=x+2\,\ln \left (x+1\right )-2\,\mathrm {atanh}\left (\frac {48}{2\,x+6}-7\right ) \]

[In]

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

[Out]

x + 2*log(x + 1) - 2*atanh(48/(2*x + 6) - 7)