3.308 \(\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/8*(1+x)/(x^2+1)^2-3/8*(1-x)/(x^2+1)+3/16*x/(x^2+1)+7/16*arctan(x)+1/8*ln(1-x)-ln(x)+15/16*ln(x^2+1)-1/2*ln(x
^2+x+1)-1/3*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.48, antiderivative size = 103, normalized size of antiderivative = 1.00, 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 verified.

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

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

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.04, size = 93, normalized size = 0.90 \[ \frac {1}{48} \left (-14 \log \left (1-x^3\right )+\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 )+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 verified.

[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

________________________________________________________________________________________

fricas [A]  time = 0.70, size = 136, normalized size = 1.32 \[ \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 \relax (x) - 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 \relax (x) + 33 \, x - 12}{48 \, {\left (x^{4} + 2 \, x^{2} + 1\right )}} \]

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

________________________________________________________________________________________

giac [A]  time = 0.34, size = 74, normalized size = 0.72 \[ -\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 \relax (x) - \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 ) \]

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

________________________________________________________________________________________

maple [A]  time = 0.01, size = 73, normalized size = 0.71 \[ \frac {7 \arctan \relax (x )}{16}-\frac {\sqrt {3}\, \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right )}{3}-\ln \relax (x )+\frac {\ln \left (x -1\right )}{8}+\frac {15 \ln \left (x^{2}+1\right )}{16}-\frac {\ln \left (x^{2}+x +1\right )}{2}+\frac {\frac {9}{2} x^{3}-3 x^{2}+\frac {11}{2} x -2}{8 \left (x^{2}+1\right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/8*ln(x-1)+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/2*ln(x^2+x+1)-1/3*3^
(1/2)*arctan(1/3*(2*x+1)*3^(1/2))

________________________________________________________________________________________

maxima [A]  time = 2.25, size = 77, normalized size = 0.75 \[ -\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 \relax (x) - \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 \relax (x) \]

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

________________________________________________________________________________________

mupad [B]  time = 2.20, size = 96, normalized size = 0.93 \[ \frac {\ln \left (x-1\right )}{8}-\ln \relax (x)+\ln \left (x+\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{6}\right )-\ln \left (x+\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{6}\right )+\frac {\frac {9\,x^3}{16}-\frac {3\,x^2}{8}+\frac {11\,x}{16}-\frac {1}{4}}{x^4+2\,x^2+1}+\ln \left (x-\mathrm {i}\right )\,\left (\frac {15}{16}-\frac {7}{32}{}\mathrm {i}\right )+\ln \left (x+1{}\mathrm {i}\right )\,\left (\frac {15}{16}+\frac {7}{32}{}\mathrm {i}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 0.51, size = 88, normalized size = 0.85 \[ - \log {\relax (x )} + \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}{\relax (x )}}{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} \]

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

________________________________________________________________________________________