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

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

[Out]

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

Rubi [A] (verified)

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

[In]

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

[Out]

x + x^2/2 - Log[x] + Log[1 - x^2]/2

Rule 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

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-x-x^2+x^3+x^4}{x \left (-1+x^2\right )} \, dx \\ & = \int \left (1-\frac {1}{x}+x+\frac {x}{-1+x^2}\right ) \, dx \\ & = x+\frac {x^2}{2}-\log (x)+\int \frac {x}{-1+x^2} \, dx \\ & = x+\frac {x^2}{2}-\log (x)+\frac {1}{2} \log \left (1-x^2\right ) \\ \end{align*}

Mathematica [A] (verified)

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

[In]

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

[Out]

x + x^2/2 - Log[x] + Log[1 - x^2]/2

Maple [A] (verified)

Time = 0.84 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.80

method result size
risch \(\frac {x^{2}}{2}+x -\ln \left (x \right )+\frac {\ln \left (x^{2}-1\right )}{2}\) \(20\)
default \(\frac {x^{2}}{2}+x -\ln \left (x \right )+\frac {\ln \left (x +1\right )}{2}+\frac {\ln \left (x -1\right )}{2}\) \(24\)
norman \(\frac {x^{2}}{2}+x -\ln \left (x \right )+\frac {\ln \left (x +1\right )}{2}+\frac {\ln \left (x -1\right )}{2}\) \(24\)
parallelrisch \(\frac {x^{2}}{2}+x -\ln \left (x \right )+\frac {\ln \left (x +1\right )}{2}+\frac {\ln \left (x -1\right )}{2}\) \(24\)
meijerg \(\frac {\ln \left (-x^{2}+1\right )}{2}-\ln \left (x \right )-\frac {i \pi }{2}+\frac {x^{2}}{2}-\frac {i \left (2 i x -2 i \operatorname {arctanh}\left (x \right )\right )}{2}+\operatorname {arctanh}\left (x \right )\) \(40\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

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

[In]

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

[Out]

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