### 3.159 $$\int \frac{1+x^2+x^3}{(-1+x) x (1+x^2)^3 (1+x+x^2)} \, dx$$

Optimal. Leaf size=103 $-\frac{3 (1-x)}{8 \left (x^2+1\right )}+\frac{3 x}{16 \left (x^2+1\right )}+\frac{x+1}{8 \left (x^2+1\right )^2}+\frac{15}{16} \log \left (x^2+1\right )-\frac{1}{2} \log \left (x^2+x+1\right )+\frac{1}{8} \log (1-x)-\log (x)+\frac{7}{16} \tan ^{-1}(x)-\frac{\tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{\sqrt{3}}$

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.536711, antiderivative size = 103, normalized size of antiderivative = 1., number of steps used = 14, number of rules used = 10, integrand size = 32, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.312, Rules used = {6728, 639, 199, 203, 635, 260, 634, 618, 204, 628} $-\frac{3 (1-x)}{8 \left (x^2+1\right )}+\frac{3 x}{16 \left (x^2+1\right )}+\frac{x+1}{8 \left (x^2+1\right )^2}+\frac{15}{16} \log \left (x^2+1\right )-\frac{1}{2} \log \left (x^2+x+1\right )+\frac{1}{8} \log (1-x)-\log (x)+\frac{7}{16} \tan ^{-1}(x)-\frac{\tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )}{\sqrt{3}}$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

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

Rule 6728

Int[(u_)/((a_.) + (b_.)*(x_)^(n_.) + (c_.)*(x_)^(n2_.)), x_Symbol] :> With[{v = RationalFunctionExpand[u/(a +
b*x^n + c*x^(2*n)), x]}, Int[v, x] /; SumQ[v]] /; FreeQ[{a, b, c}, x] && EqQ[n2, 2*n] && IGtQ[n, 0]

Rule 639

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

Rule 199

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> -Simp[(x*(a + b*x^n)^(p + 1))/(a*n*(p + 1)), x] + Dist[(n*(p +
1) + 1)/(a*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x] /; FreeQ[{a, b}, x] && IGtQ[n, 0] && LtQ[p, -1] && (In
tegerQ[2*p] || (n == 2 && IntegerQ[4*p]) || (n == 2 && IntegerQ[3*p]) || Denominator[p + 1/n] < Denominator[p]
)

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

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

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

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

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

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

Mathematica [A]  time = 0.0439117, size = 93, normalized size = 0.9 $\frac{1}{48} \left (\frac{6 (x+1)}{\left (x^2+1\right )^2}+\frac{9 (3 x-2)}{x^2+1}+45 \log \left (x^2+1\right )-10 \log \left (x^2+x+1\right )-14 \log \left (1-x^3\right )+20 \log (1-x)-48 \log (x)+21 \tan ^{-1}(x)-16 \sqrt{3} \tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

((6*(1 + x))/(1 + x^2)^2 + (9*(-2 + 3*x))/(1 + x^2) + 21*ArcTan[x] - 16*Sqrt[3]*ArcTan[(1 + 2*x)/Sqrt[3]] + 20
*Log[1 - x] - 48*Log[x] + 45*Log[1 + x^2] - 10*Log[1 + x + x^2] - 14*Log[1 - x^3])/48

________________________________________________________________________________________

Maple [A]  time = 0.01, size = 73, normalized size = 0.7 \begin{align*}{\frac{1}{8\, \left ({x}^{2}+1 \right ) ^{2}} \left ({\frac{9\,{x}^{3}}{2}}-3\,{x}^{2}+{\frac{11\,x}{2}}-2 \right ) }+{\frac{15\,\ln \left ({x}^{2}+1 \right ) }{16}}+{\frac{7\,\arctan \left ( x \right ) }{16}}-\ln \left ( x \right ) +{\frac{\ln \left ( -1+x \right ) }{8}}-{\frac{\ln \left ({x}^{2}+x+1 \right ) }{2}}-{\frac{\sqrt{3}}{3}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) } \end{align*}

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

[In]

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

[Out]

1/8*(9/2*x^3-3*x^2+11/2*x-2)/(x^2+1)^2+15/16*ln(x^2+1)+7/16*arctan(x)-ln(x)+1/8*ln(-1+x)-1/2*ln(x^2+x+1)-1/3*a
rctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)

________________________________________________________________________________________

Maxima [A]  time = 1.41266, size = 104, normalized size = 1.01 \begin{align*} -\frac{1}{3} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{9 \, x^{3} - 6 \, x^{2} + 11 \, x - 4}{16 \,{\left (x^{4} + 2 \, x^{2} + 1\right )}} + \frac{7}{16} \, \arctan \left (x\right ) - \frac{1}{2} \, \log \left (x^{2} + x + 1\right ) + \frac{15}{16} \, \log \left (x^{2} + 1\right ) + \frac{1}{8} \, \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^3+x^2+1)/(-1+x)/x/(x^2+1)^3/(x^2+x+1),x, algorithm="maxima")

[Out]

-1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/16*(9*x^3 - 6*x^2 + 11*x - 4)/(x^4 + 2*x^2 + 1) + 7/16*arctan(x
) - 1/2*log(x^2 + x + 1) + 15/16*log(x^2 + 1) + 1/8*log(x - 1) - log(x)

________________________________________________________________________________________

Fricas [A]  time = 2.1198, size = 387, normalized size = 3.76 \begin{align*} \frac{27 \, x^{3} - 16 \, \sqrt{3}{\left (x^{4} + 2 \, x^{2} + 1\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) - 18 \, x^{2} + 21 \,{\left (x^{4} + 2 \, x^{2} + 1\right )} \arctan \left (x\right ) - 24 \,{\left (x^{4} + 2 \, x^{2} + 1\right )} \log \left (x^{2} + x + 1\right ) + 45 \,{\left (x^{4} + 2 \, x^{2} + 1\right )} \log \left (x^{2} + 1\right ) + 6 \,{\left (x^{4} + 2 \, x^{2} + 1\right )} \log \left (x - 1\right ) - 48 \,{\left (x^{4} + 2 \, x^{2} + 1\right )} \log \left (x\right ) + 33 \, x - 12}{48 \,{\left (x^{4} + 2 \, x^{2} + 1\right )}} \end{align*}

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

[In]

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

[Out]

1/48*(27*x^3 - 16*sqrt(3)*(x^4 + 2*x^2 + 1)*arctan(1/3*sqrt(3)*(2*x + 1)) - 18*x^2 + 21*(x^4 + 2*x^2 + 1)*arct
an(x) - 24*(x^4 + 2*x^2 + 1)*log(x^2 + x + 1) + 45*(x^4 + 2*x^2 + 1)*log(x^2 + 1) + 6*(x^4 + 2*x^2 + 1)*log(x
- 1) - 48*(x^4 + 2*x^2 + 1)*log(x) + 33*x - 12)/(x^4 + 2*x^2 + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.460151, size = 88, normalized size = 0.85 \begin{align*} - \log{\left (x \right )} + \frac{\log{\left (x - 1 \right )}}{8} + \frac{15 \log{\left (x^{2} + 1 \right )}}{16} - \frac{\log{\left (x^{2} + x + 1 \right )}}{2} + \frac{7 \operatorname{atan}{\left (x \right )}}{16} - \frac{\sqrt{3} \operatorname{atan}{\left (\frac{2 \sqrt{3} x}{3} + \frac{\sqrt{3}}{3} \right )}}{3} + \frac{9 x^{3} - 6 x^{2} + 11 x - 4}{16 x^{4} + 32 x^{2} + 16} \end{align*}

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

[In]

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

[Out]

-log(x) + log(x - 1)/8 + 15*log(x**2 + 1)/16 - log(x**2 + x + 1)/2 + 7*atan(x)/16 - sqrt(3)*atan(2*sqrt(3)*x/3
+ sqrt(3)/3)/3 + (9*x**3 - 6*x**2 + 11*x - 4)/(16*x**4 + 32*x**2 + 16)

________________________________________________________________________________________

Giac [A]  time = 1.05815, size = 100, normalized size = 0.97 \begin{align*} -\frac{1}{3} \, \sqrt{3} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{9 \, x^{3} - 6 \, x^{2} + 11 \, x - 4}{16 \,{\left (x^{2} + 1\right )}^{2}} + \frac{7}{16} \, \arctan \left (x\right ) - \frac{1}{2} \, \log \left (x^{2} + x + 1\right ) + \frac{15}{16} \, \log \left (x^{2} + 1\right ) + \frac{1}{8} \, \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^3+x^2+1)/(-1+x)/x/(x^2+1)^3/(x^2+x+1),x, algorithm="giac")

[Out]

-1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/16*(9*x^3 - 6*x^2 + 11*x - 4)/(x^2 + 1)^2 + 7/16*arctan(x) - 1/
2*log(x^2 + x + 1) + 15/16*log(x^2 + 1) + 1/8*log(abs(x - 1)) - log(abs(x))