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

Optimal. Leaf size=25 \[ 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]
time = 0.03, antiderivative size = 25, normalized size of antiderivative = 1.00, 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 = {1607, 1816, 266} \begin {gather*} \frac {x^2}{2}+\frac {1}{2} \log \left (1-x^2\right )+x-\log (x) \end {gather*}

Antiderivative was successfully verified.

[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*} \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.00, size = 25, normalized size = 1.00 \begin {gather*} x+\frac {x^2}{2}-\log (x)+\frac {1}{2} \log \left (1-x^2\right ) \end {gather*}

Antiderivative was successfully verified.

[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.06, size = 24, normalized size = 0.96

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 2.74, size = 23, normalized size = 0.92 \begin {gather*} \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 {gather*}

Verification 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 = 0.44, size = 19, normalized size = 0.76 \begin {gather*} \frac {1}{2} \, x^{2} + x + \frac {1}{2} \, \log \left (x^{2} - 1\right ) - \log \left (x\right ) \end {gather*}

Verification 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.03, size = 17, normalized size = 0.68 \begin {gather*} \frac {x^{2}}{2} + x - \log {\left (x \right )} + \frac {\log {\left (x^{2} - 1 \right )}}{2} \end {gather*}

Verification 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 = 0.61, size = 26, normalized size = 1.04 \begin {gather*} \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 {gather*}

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

________________________________________________________________________________________

Mupad [B]
time = 0.17, size = 19, normalized size = 0.76 \begin {gather*} x+\frac {\ln \left (x^2-1\right )}{2}-\ln \left (x\right )+\frac {x^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________