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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0444875, antiderivative size = 46, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.25, Rules used = {1629, 635, 203, 260} \[ \frac{x^2}{2}-\frac{2}{3} \log \left (x^2+2\right )+x+\frac{1}{3} \log (1-x)-\frac{2}{3} \sqrt{2} \tan ^{-1}\left (\frac{x}{\sqrt{2}}\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

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 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 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]

Rubi steps

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

Mathematica [A]  time = 0.0164217, size = 43, normalized size = 0.93 \[ \frac{1}{6} \left (3 x^2-4 \log \left (x^2+2\right )+6 x+2 \log (x-1)-4 \sqrt{2} \tan ^{-1}\left (\frac{x}{\sqrt{2}}\right )-9\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 34, normalized size = 0.7 \begin{align*}{\frac{{x}^{2}}{2}}+x+{\frac{\ln \left ( x-1 \right ) }{3}}-{\frac{2\,\ln \left ({x}^{2}+2 \right ) }{3}}-{\frac{2\,\sqrt{2}}{3}\arctan \left ({\frac{x\sqrt{2}}{2}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.47715, size = 45, normalized size = 0.98 \begin{align*} \frac{1}{2} \, x^{2} - \frac{2}{3} \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + x - \frac{2}{3} \, \log \left (x^{2} + 2\right ) + \frac{1}{3} \, \log \left (x - 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.52902, size = 115, normalized size = 2.5 \begin{align*} \frac{1}{2} \, x^{2} - \frac{2}{3} \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + x - \frac{2}{3} \, \log \left (x^{2} + 2\right ) + \frac{1}{3} \, \log \left (x - 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.127096, size = 41, normalized size = 0.89 \begin{align*} \frac{x^{2}}{2} + x + \frac{\log{\left (x - 1 \right )}}{3} - \frac{2 \log{\left (x^{2} + 2 \right )}}{3} - \frac{2 \sqrt{2} \operatorname{atan}{\left (\frac{\sqrt{2} x}{2} \right )}}{3} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2/2 + x + log(x - 1)/3 - 2*log(x**2 + 2)/3 - 2*sqrt(2)*atan(sqrt(2)*x/2)/3

________________________________________________________________________________________

Giac [A]  time = 1.2218, size = 46, normalized size = 1. \begin{align*} \frac{1}{2} \, x^{2} - \frac{2}{3} \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} x\right ) + x - \frac{2}{3} \, \log \left (x^{2} + 2\right ) + \frac{1}{3} \, \log \left ({\left | x - 1 \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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