3.29.28 \(\int \frac {2 x-3 x^3+(2 x-2 x^2) \log (1-x)+(-2+2 x) \log (x)+(-1+x) \log ^2(x)}{-1+x} \, dx\) [2828]

Optimal. Leaf size=24 \[ 6+x^2+x \left (-x (2+x+\log (1-x))+\log ^2(x)\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 28, normalized size of antiderivative = 1.17, number of steps used = 10, number of rules used = 6, integrand size = 47, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.128, Rules used = {6820, 786, 2442, 45, 2332, 2333} \begin {gather*} -x^3-x^2-x^2 \log (1-x)+x \log ^2(x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-x^2 - x^3 - x^2*Log[1 - x] + x*Log[x]^2

Rule 45

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, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 786

Int[((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegr
and[(d + e*x)^m*(f + g*x)*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IGtQ[p, 0]

Rule 2332

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 2333

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

Rule 2442

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

Rule 6820

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

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int \left (\frac {x \left (2-3 x^2\right )}{-1+x}-2 x \log (1-x)+2 \log (x)+\log ^2(x)\right ) \, dx\\ &=-(2 \int x \log (1-x) \, dx)+2 \int \log (x) \, dx+\int \frac {x \left (2-3 x^2\right )}{-1+x} \, dx+\int \log ^2(x) \, dx\\ &=-2 x-x^2 \log (1-x)+2 x \log (x)+x \log ^2(x)-2 \int \log (x) \, dx-\int \frac {x^2}{1-x} \, dx+\int \left (-1+\frac {1}{1-x}-3 x-3 x^2\right ) \, dx\\ &=-x-\frac {3 x^2}{2}-x^3-\log (1-x)-x^2 \log (1-x)+x \log ^2(x)-\int \left (-1+\frac {1}{1-x}-x\right ) \, dx\\ &=-x^2-x^3-x^2 \log (1-x)+x \log ^2(x)\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 39, normalized size = 1.62 \begin {gather*} \frac {7}{2}-x^2-x^3-\left (-1+x^2\right ) \log (1-x)-\log (-1+x)+x \log ^2(x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(52\) vs. \(2(24)=48\).
time = 0.34, size = 53, normalized size = 2.21

method result size
risch \(-x^{3}-x^{2} \ln \left (1-x \right )+x \ln \left (x \right )^{2}-x^{2}\) \(29\)
default \(x \ln \left (x \right )^{2}+2 \left (1-x \right ) \ln \left (1-x \right )-\frac {3}{2}-\left (1-x \right )^{2} \ln \left (1-x \right )-x^{2}-x^{3}-\ln \left (x -1\right )\) \(53\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.31, size = 52, normalized size = 2.17 \begin {gather*} -x^{3} + x \log \left (x\right )^{2} - x^{2} - {\left (x^{2} + 2 \, x + 2 \, \log \left (x - 1\right )\right )} \log \left (-x + 1\right ) + 2 \, {\left (x + \log \left (x - 1\right )\right )} \log \left (-x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.45, size = 28, normalized size = 1.17 \begin {gather*} -x^{3} + x \log \left (x\right )^{2} - x^{2} \log \left (-x + 1\right ) - x^{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.23, size = 31, normalized size = 1.29 \begin {gather*} - x^{3} - x^{2} + x \log {\left (x \right )}^{2} + \left (\frac {1}{3} - x^{2}\right ) \log {\left (1 - x \right )} - \frac {\log {\left (x - 1 \right )}}{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 28, normalized size = 1.17 \begin {gather*} -x^{3} + x \log \left (x\right )^{2} - x^{2} \log \left (-x + 1\right ) - x^{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 1.94, size = 25, normalized size = 1.04 \begin {gather*} x\,{\ln \left (x\right )}^2-x^2\,\left (\ln \left (1-x\right )+1\right )-x^3 \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________