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

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

[Out]

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

_______________________________________________________________________________________

Rubi [A]  time = 0.0609606, antiderivative size = 30, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.034 \[ \frac{x^2}{2}+x+\frac{2}{1-x}+\log (1-x)-\log (x+1) \]

Antiderivative was successfully verified.

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

[Out]

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

_______________________________________________________________________________________

Rubi in Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \[ \text{Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((x**4-2*x**2+4*x+1)/(x**3-x**2-x+1),x)

[Out]

Timed out

_______________________________________________________________________________________

Mathematica [A]  time = 0.0261004, size = 29, normalized size = 0.97 \[ \frac{1}{2} (x+1)^2-\frac{2}{x-1}+\log (1-x)-\log (x+1) \]

Antiderivative was successfully verified.

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

[Out]

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

_______________________________________________________________________________________

Maple [A]  time = 0.01, size = 25, normalized size = 0.8 \[ x+{\frac{{x}^{2}}{2}}+\ln \left ( -1+x \right ) -2\, \left ( -1+x \right ) ^{-1}-\ln \left ( 1+x \right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Maxima [A]  time = 0.797626, size = 32, normalized size = 1.07 \[ \frac{1}{2} \, x^{2} + x - \frac{2}{x - 1} - \log \left (x + 1\right ) + \log \left (x - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Fricas [A]  time = 0.253166, size = 49, normalized size = 1.63 \[ \frac{x^{3} + x^{2} - 2 \,{\left (x - 1\right )} \log \left (x + 1\right ) + 2 \,{\left (x - 1\right )} \log \left (x - 1\right ) - 2 \, x - 4}{2 \,{\left (x - 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

Sympy [A]  time = 0.194386, size = 20, normalized size = 0.67 \[ \frac{x^{2}}{2} + x + \log{\left (x - 1 \right )} - \log{\left (x + 1 \right )} - \frac{2}{x - 1} \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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

_______________________________________________________________________________________

GIAC/XCAS [A]  time = 0.260329, size = 35, normalized size = 1.17 \[ \frac{1}{2} \, x^{2} + x - \frac{2}{x - 1} -{\rm ln}\left ({\left | x + 1 \right |}\right ) +{\rm ln}\left ({\left | x - 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

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

[Out]

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