### 3.167 $$\int \frac{1-x-x^2+x^3+x^4}{-x+x^3} \, dx$$

Optimal. Leaf size=25 $\frac{x^2}{2}+\frac{1}{2} \log \left (1-x^2\right )+x-\log (x)$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0501107, antiderivative size = 25, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 26, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.115, Rules used = {1593, 1802, 260} $\frac{x^2}{2}+\frac{1}{2} \log \left (1-x^2\right )+x-\log (x)$

Antiderivative was successfully veriﬁed.

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

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]

Rule 260

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]

Rubi steps

\begin{align*} \int \frac{1-x-x^2+x^3+x^4}{-x+x^3} \, dx &=\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]  time = 0.0052752, size = 25, normalized size = 1. $\frac{x^2}{2}+\frac{1}{2} \log \left (1-x^2\right )+x-\log (x)$

Antiderivative was successfully veriﬁed.

[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]  time = 0.007, size = 24, normalized size = 1. \begin{align*} x+{\frac{{x}^{2}}{2}}-\ln \left ( x \right ) +{\frac{\ln \left ( 1+x \right ) }{2}}+{\frac{\ln \left ( -1+x \right ) }{2}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 0.925505, size = 31, normalized size = 1.24 \begin{align*} \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 ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

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

________________________________________________________________________________________

Fricas [A]  time = 1.9284, size = 55, normalized size = 2.2 \begin{align*} \frac{1}{2} \, x^{2} + x + \frac{1}{2} \, \log \left (x^{2} - 1\right ) - \log \left (x\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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]  time = 0.086741, size = 17, normalized size = 0.68 \begin{align*} \frac{x^{2}}{2} + x - \log{\left (x \right )} + \frac{\log{\left (x^{2} - 1 \right )}}{2} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

Giac [A]  time = 1.05335, size = 35, normalized size = 1.4 \begin{align*} \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 ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

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