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

Optimal. Leaf size=49 \[ \frac {1}{2 \left (x^2+2\right )}+\frac {1}{3} \log \left (x^2+2\right )+\frac {1}{3} \log (1-x)-\frac {\tan ^{-1}\left (\frac {x}{\sqrt {2}}\right )}{3 \sqrt {2}} \]

[Out]

1/2/(x^2+2)+1/3*ln(1-x)+1/3*ln(x^2+2)-1/6*arctan(1/2*x*2^(1/2))*2^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.07, antiderivative size = 49, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {1647, 1629, 635, 203, 260} \[ \frac {1}{2 \left (x^2+2\right )}+\frac {1}{3} \log \left (x^2+2\right )+\frac {1}{3} \log (1-x)-\frac {\tan ^{-1}\left (\frac {x}{\sqrt {2}}\right )}{3 \sqrt {2}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

1/(2*(2 + x^2)) - ArcTan[x/Sqrt[2]]/(3*Sqrt[2]) + Log[1 - x]/3 + Log[2 + x^2]/3

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

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]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 1629

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

Rule 1647

Int[(Pq_)*((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[(d +
 e*x)^m*Pq, a + c*x^2, x], f = Coeff[PolynomialRemainder[(d + e*x)^m*Pq, a + c*x^2, x], x, 0], g = Coeff[Polyn
omialRemainder[(d + e*x)^m*Pq, a + c*x^2, x], x, 1]}, Simp[((a*g - c*f*x)*(a + c*x^2)^(p + 1))/(2*a*c*(p + 1))
, x] + Dist[1/(2*a*c*(p + 1)), Int[(d + e*x)^m*(a + c*x^2)^(p + 1)*ExpandToSum[(2*a*c*(p + 1)*Q)/(d + e*x)^m +
 (c*f*(2*p + 3))/(d + e*x)^m, x], x], x]] /; FreeQ[{a, c, d, e}, x] && PolyQ[Pq, x] && NeQ[c*d^2 + a*e^2, 0] &
& LtQ[p, -1] && ILtQ[m, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 61, normalized size = 1.24 \[ \frac {1}{2 \left ((x-1)^2+2 (x-1)+3\right )}+\frac {1}{3} \log \left ((x-1)^2+2 (x-1)+3\right )+\frac {1}{3} \log (x-1)-\frac {\tan ^{-1}\left (\frac {x}{\sqrt {2}}\right )}{3 \sqrt {2}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

1/(2*(3 + 2*(-1 + x) + (-1 + x)^2)) - ArcTan[x/Sqrt[2]]/(3*Sqrt[2]) + Log[3 + 2*(-1 + x) + (-1 + x)^2]/3 + Log
[-1 + x]/3

________________________________________________________________________________________

fricas [A]  time = 0.40, size = 51, normalized size = 1.04 \[ -\frac {\sqrt {2} {\left (x^{2} + 2\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) - 2 \, {\left (x^{2} + 2\right )} \log \left (x^{2} + 2\right ) - 2 \, {\left (x^{2} + 2\right )} \log \left (x - 1\right ) - 3}{6 \, {\left (x^{2} + 2\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/6*(sqrt(2)*(x^2 + 2)*arctan(1/2*sqrt(2)*x) - 2*(x^2 + 2)*log(x^2 + 2) - 2*(x^2 + 2)*log(x - 1) - 3)/(x^2 +
2)

________________________________________________________________________________________

giac [A]  time = 0.01, size = 37, normalized size = 0.76 \[ -\frac {1}{6} \, \sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) + \frac {1}{2 \, {\left (x^{2} + 2\right )}} + \frac {1}{3} \, \log \left (x^{2} + 2\right ) + \frac {1}{3} \, \log \left ({\left | x - 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/6*sqrt(2)*arctan(1/2*sqrt(2)*x) + 1/2/(x^2 + 2) + 1/3*log(x^2 + 2) + 1/3*log(abs(x - 1))

________________________________________________________________________________________

maple [A]  time = 0.01, size = 37, normalized size = 0.76 \[ -\frac {\sqrt {2}\, \arctan \left (\frac {\sqrt {2}\, x}{2}\right )}{6}+\frac {\ln \left (x -1\right )}{3}+\frac {\ln \left (x^{2}+2\right )}{3}+\frac {1}{2 x^{2}+4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2/(x^2+2)+1/3*ln(x^2+2)-1/6*arctan(1/2*x*2^(1/2))*2^(1/2)+1/3*ln(x-1)

________________________________________________________________________________________

maxima [A]  time = 1.30, size = 36, normalized size = 0.73 \[ -\frac {1}{6} \, \sqrt {2} \arctan \left (\frac {1}{2} \, \sqrt {2} x\right ) + \frac {1}{2 \, {\left (x^{2} + 2\right )}} + \frac {1}{3} \, \log \left (x^{2} + 2\right ) + \frac {1}{3} \, \log \left (x - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/6*sqrt(2)*arctan(1/2*sqrt(2)*x) + 1/2/(x^2 + 2) + 1/3*log(x^2 + 2) + 1/3*log(x - 1)

________________________________________________________________________________________

mupad [B]  time = 0.10, size = 53, normalized size = 1.08 \[ \frac {\ln \left (x-1\right )}{3}+\ln \left (x-\sqrt {2}\,1{}\mathrm {i}\right )\,\left (\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{12}\right )-\ln \left (x+\sqrt {2}\,1{}\mathrm {i}\right )\,\left (-\frac {1}{3}+\frac {\sqrt {2}\,1{}\mathrm {i}}{12}\right )+\frac {1}{2\,\left (x^2+2\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.17, size = 14, normalized size = 0.29 \[ \frac {\log {\left (x - 1 \right )}}{3} + \frac {1}{2 x^{2} + 4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________