\(\int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx\) [9113]

   Optimal result
   Rubi [C] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 55, antiderivative size = 15 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=x-\frac {\log ^2(x)}{\left (x+x^2\right )^2} \]

[Out]

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

Rubi [C] (verified)

Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.

Time = 0.27 (sec) , antiderivative size = 77, normalized size of antiderivative = 5.13, number of steps used = 25, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.255, Rules used = {6820, 46, 2393, 2341, 2351, 31, 2379, 2438, 2404, 2342, 2356, 2389, 2355, 2354} \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=-4 \operatorname {PolyLog}\left (2,-\frac {1}{x}\right )-4 \operatorname {PolyLog}(2,-x)-\frac {\log ^2(x)}{x^2}+x+\frac {2 \log ^2(x)}{x}+\frac {2 x \log ^2(x)}{x+1}-\frac {\log ^2(x)}{(x+1)^2}+4 \log \left (\frac {1}{x}+1\right ) \log (x)-4 \log (x+1) \log (x) \]

[In]

Int[(x^3 + 3*x^4 + 3*x^5 + x^6 + (-2 - 2*x)*Log[x] + (2 + 4*x)*Log[x]^2)/(x^3 + 3*x^4 + 3*x^5 + x^6),x]

[Out]

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

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2351

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_) + (e_.)*(x_)^(r_.))^(q_), x_Symbol] :> Simp[x*(d + e*x^r)^(q +
 1)*((a + b*Log[c*x^n])/d), x] - Dist[b*(n/d), Int[(d + e*x^r)^(q + 1), x], x] /; FreeQ[{a, b, c, d, e, n, q,
r}, x] && EqQ[r*(q + 1) + 1, 0]

Rule 2354

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[Log[1 + e*(x/d)]*((a +
b*Log[c*x^n])^p/e), x] - Dist[b*n*(p/e), Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[
{a, b, c, d, e, n}, x] && IGtQ[p, 0]

Rule 2355

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

Rule 2356

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_) + (e_.)*(x_))^(q_.), x_Symbol] :> Simp[(d + e*x)^(q + 1)
*((a + b*Log[c*x^n])^p/(e*(q + 1))), x] - Dist[b*n*(p/(e*(q + 1))), Int[((d + e*x)^(q + 1)*(a + b*Log[c*x^n])^
(p - 1))/x, x], x] /; FreeQ[{a, b, c, d, e, n, p, q}, x] && GtQ[p, 0] && NeQ[q, -1] && (EqQ[p, 1] || (Integers
Q[2*p, 2*q] &&  !IGtQ[q, 0]) || (EqQ[p, 2] && NeQ[q, 1]))

Rule 2379

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((x_)*((d_) + (e_.)*(x_)^(r_.))), x_Symbol] :> Simp[(-Log[1 +
d/(e*x^r)])*((a + b*Log[c*x^n])^p/(d*r)), x] + Dist[b*n*(p/(d*r)), Int[Log[1 + d/(e*x^r)]*((a + b*Log[c*x^n])^
(p - 1)/x), x], x] /; FreeQ[{a, b, c, d, e, n, r}, x] && IGtQ[p, 0]

Rule 2389

Int[(((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_) + (e_.)*(x_))^(q_))/(x_), x_Symbol] :> Dist[1/d, Int[(d
 + e*x)^(q + 1)*((a + b*Log[c*x^n])^p/x), x], x] - Dist[e/d, Int[(d + e*x)^q*(a + b*Log[c*x^n])^p, x], x] /; F
reeQ[{a, b, c, d, e, n}, x] && IGtQ[p, 0] && LtQ[q, -1] && IntegerQ[2*q]

Rule 2393

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol] :> Wit
h[{u = ExpandIntegrand[a + b*Log[c*x^n], (f*x)^m*(d + e*x^r)^q, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c,
d, e, f, m, n, q, r}, x] && IntegerQ[q] && (GtQ[q, 0] || (IntegerQ[m] && IntegerQ[r]))

Rule 2404

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(RFx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*x^
n])^p, RFx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, n}, x] && RationalFunctionQ[RFx, x] && IGtQ[p, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 6820

Int[u_, x_Symbol] :> With[{v = SimplifyIntegrand[u, x]}, Int[v, x] /; SimplerIntegrandQ[v, u, x]]

Rubi steps \begin{align*} \text {integral}& = \int \left (1-\frac {2 \log (x)}{x^3 (1+x)^2}+\frac {(2+4 x) \log ^2(x)}{x^3 (1+x)^3}\right ) \, dx \\ & = x-2 \int \frac {\log (x)}{x^3 (1+x)^2} \, dx+\int \frac {(2+4 x) \log ^2(x)}{x^3 (1+x)^3} \, dx \\ & = x-2 \int \left (\frac {\log (x)}{x^3}-\frac {2 \log (x)}{x^2}-\frac {\log (x)}{(1+x)^2}+\frac {3 \log (x)}{x (1+x)}\right ) \, dx+\int \left (\frac {2 \log ^2(x)}{x^3}-\frac {2 \log ^2(x)}{x^2}+\frac {2 \log ^2(x)}{(1+x)^3}+\frac {2 \log ^2(x)}{(1+x)^2}\right ) \, dx \\ & = x-2 \int \frac {\log (x)}{x^3} \, dx+2 \int \frac {\log (x)}{(1+x)^2} \, dx+2 \int \frac {\log ^2(x)}{x^3} \, dx-2 \int \frac {\log ^2(x)}{x^2} \, dx+2 \int \frac {\log ^2(x)}{(1+x)^3} \, dx+2 \int \frac {\log ^2(x)}{(1+x)^2} \, dx+4 \int \frac {\log (x)}{x^2} \, dx-6 \int \frac {\log (x)}{x (1+x)} \, dx \\ & = \frac {1}{2 x^2}-\frac {4}{x}+x+\frac {\log (x)}{x^2}-\frac {4 \log (x)}{x}+\frac {2 x \log (x)}{1+x}+6 \log \left (1+\frac {1}{x}\right ) \log (x)-\frac {\log ^2(x)}{x^2}+\frac {2 \log ^2(x)}{x}-\frac {\log ^2(x)}{(1+x)^2}+\frac {2 x \log ^2(x)}{1+x}-2 \int \frac {1}{1+x} \, dx+2 \int \frac {\log (x)}{x^3} \, dx+2 \int \frac {\log (x)}{x (1+x)^2} \, dx-4 \int \frac {\log (x)}{x^2} \, dx-4 \int \frac {\log (x)}{1+x} \, dx-6 \int \frac {\log \left (1+\frac {1}{x}\right )}{x} \, dx \\ & = x+\frac {2 x \log (x)}{1+x}+6 \log \left (1+\frac {1}{x}\right ) \log (x)-\frac {\log ^2(x)}{x^2}+\frac {2 \log ^2(x)}{x}-\frac {\log ^2(x)}{(1+x)^2}+\frac {2 x \log ^2(x)}{1+x}-2 \log (1+x)-4 \log (x) \log (1+x)-6 \operatorname {PolyLog}\left (2,-\frac {1}{x}\right )-2 \int \frac {\log (x)}{(1+x)^2} \, dx+2 \int \frac {\log (x)}{x (1+x)} \, dx+4 \int \frac {\log (1+x)}{x} \, dx \\ & = x+4 \log \left (1+\frac {1}{x}\right ) \log (x)-\frac {\log ^2(x)}{x^2}+\frac {2 \log ^2(x)}{x}-\frac {\log ^2(x)}{(1+x)^2}+\frac {2 x \log ^2(x)}{1+x}-2 \log (1+x)-4 \log (x) \log (1+x)-6 \operatorname {PolyLog}\left (2,-\frac {1}{x}\right )-4 \operatorname {PolyLog}(2,-x)+2 \int \frac {1}{1+x} \, dx+2 \int \frac {\log \left (1+\frac {1}{x}\right )}{x} \, dx \\ & = x+4 \log \left (1+\frac {1}{x}\right ) \log (x)-\frac {\log ^2(x)}{x^2}+\frac {2 \log ^2(x)}{x}-\frac {\log ^2(x)}{(1+x)^2}+\frac {2 x \log ^2(x)}{1+x}-4 \log (x) \log (1+x)-4 \operatorname {PolyLog}\left (2,-\frac {1}{x}\right )-4 \operatorname {PolyLog}(2,-x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.67 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=\frac {x^3 (1+x)^2-\log ^2(x)}{x^2 (1+x)^2} \]

[In]

Integrate[(x^3 + 3*x^4 + 3*x^5 + x^6 + (-2 - 2*x)*Log[x] + (2 + 4*x)*Log[x]^2)/(x^3 + 3*x^4 + 3*x^5 + x^6),x]

[Out]

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

Maple [A] (verified)

Time = 0.24 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.47

method result size
risch \(-\frac {\ln \left (x \right )^{2}}{x^{2} \left (x^{2}+2 x +1\right )}+x\) \(22\)
norman \(\frac {x^{5}-3 x^{3}-2 x^{2}-\ln \left (x \right )^{2}}{x^{2} \left (1+x \right )^{2}}\) \(30\)
parallelrisch \(\frac {x^{5}-3 x^{3}-2 x^{2}-\ln \left (x \right )^{2}}{x^{2} \left (x^{2}+2 x +1\right )}\) \(35\)

[In]

int(((4*x+2)*ln(x)^2+(-2-2*x)*ln(x)+x^6+3*x^5+3*x^4+x^3)/(x^6+3*x^5+3*x^4+x^3),x,method=_RETURNVERBOSE)

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 33 vs. \(2 (15) = 30\).

Time = 0.26 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.20 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=\frac {x^{5} + 2 \, x^{4} + x^{3} - \log \left (x\right )^{2}}{x^{4} + 2 \, x^{3} + x^{2}} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=x - \frac {\log {\left (x \right )}^{2}}{x^{4} + 2 x^{3} + x^{2}} \]

[In]

integrate(((4*x+2)*ln(x)**2+(-2-2*x)*ln(x)+x**6+3*x**5+3*x**4+x**3)/(x**6+3*x**5+3*x**4+x**3),x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 85 vs. \(2 (15) = 30\).

Time = 0.24 (sec) , antiderivative size = 85, normalized size of antiderivative = 5.67 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=x - \frac {\log \left (x\right )^{2}}{x^{4} + 2 \, x^{3} + x^{2}} - \frac {6 \, x + 5}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} + \frac {3 \, {\left (4 \, x + 3\right )}}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} - \frac {3 \, {\left (2 \, x + 1\right )}}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} - \frac {1}{2 \, {\left (x^{2} + 2 \, x + 1\right )}} \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 35 vs. \(2 (15) = 30\).

Time = 0.28 (sec) , antiderivative size = 35, normalized size of antiderivative = 2.33 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=-{\left (\frac {2 \, x + 3}{x^{2} + 2 \, x + 1} - \frac {2 \, x - 1}{x^{2}}\right )} \log \left (x\right )^{2} + x \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 13.15 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07 \[ \int \frac {x^3+3 x^4+3 x^5+x^6+(-2-2 x) \log (x)+(2+4 x) \log ^2(x)}{x^3+3 x^4+3 x^5+x^6} \, dx=x-\frac {{\ln \left (x\right )}^2}{x^2\,{\left (x+1\right )}^2} \]

[In]

int((x^3 - log(x)*(2*x + 2) + 3*x^4 + 3*x^5 + x^6 + log(x)^2*(4*x + 2))/(x^3 + 3*x^4 + 3*x^5 + x^6),x)

[Out]

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