\(\int \frac {-1+x+(2 e^{2+2 x}-4 e^{1+x} x+2 x^2) \log (-1+x)+(-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} (2-2 x^2)) \log ^2(-1+x)}{-1+x} \, dx\) [6320]

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

Optimal result

Integrand size = 79, antiderivative size = 20 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=x+\left (-e^{1+x}+x\right )^2 \log ^2(-1+x) \]

[Out]

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

Rubi [F]

\[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=\int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx \]

[In]

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

[Out]

x + 4*E^2*ExpIntegralEi[-1 + x] - 4*E^(1 + x)*Log[-1 + x] - 4*E^2*ExpIntegralEi[-1 + x]*Log[-1 + x] + Log[-1 +
 x]^2 - 2*(1 - x)*Log[-1 + x]^2 + (1 - x)^2*Log[-1 + x]^2 + (E^(2 + 2*x)*Log[-1 + x]*(Log[-1 + x] - x*Log[-1 +
 x]))/(1 - x) + 4*E^2*Defer[Int][ExpIntegralEi[-1 + x]/(-1 + x), x] - 4*Defer[Int][E^(1 + x)*Log[-1 + x]^2, x]
 - 2*Defer[Int][E^(1 + x)*(-1 + x)*Log[-1 + x]^2, x]

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

Mathematica [A] (verified)

Time = 0.60 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=x+\left (e^{1+x}-x\right )^2 \log ^2(-1+x) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.49 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.35

method result size
risch \(\left (x^{2}-2 x \,{\mathrm e}^{1+x}+{\mathrm e}^{2+2 x}\right ) \ln \left (-1+x \right )^{2}+x\) \(27\)
parallelrisch \(\ln \left (-1+x \right )^{2} x^{2}-2 \,{\mathrm e}^{1+x} \ln \left (-1+x \right )^{2} x +\ln \left (-1+x \right )^{2} {\mathrm e}^{2+2 x}+x +\frac {1}{2}\) \(40\)
default \(x +\ln \left (-1+x \right )^{2} {\mathrm e}^{2+2 x}-2 \,{\mathrm e}^{1+x} \ln \left (-1+x \right )^{2} x +\left (-1+x \right )^{2} \ln \left (-1+x \right )^{2}+2 \left (-1+x \right ) \ln \left (-1+x \right )^{2}+\ln \left (-1+x \right )^{2}\) \(58\)
parts \(x +\ln \left (-1+x \right )^{2} {\mathrm e}^{2+2 x}-2 \,{\mathrm e}^{1+x} \ln \left (-1+x \right )^{2} x +\left (-1+x \right )^{2} \ln \left (-1+x \right )^{2}+2 \left (-1+x \right ) \ln \left (-1+x \right )^{2}+\ln \left (-1+x \right )^{2}\) \(58\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.30 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx={\left (x^{2} - 2 \, x e^{\left (x + 1\right )} + e^{\left (2 \, x + 2\right )}\right )} \log \left (x - 1\right )^{2} + x \]

[In]

integrate((((-2+2*x)*exp(1+x)^2+(-2*x^2+2)*exp(1+x)+2*x^2-2*x)*log(-1+x)^2+(2*exp(1+x)^2-4*x*exp(1+x)+2*x^2)*l
og(-1+x)+x-1)/(-1+x),x, algorithm="fricas")

[Out]

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

Sympy [B] (verification not implemented)

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

Time = 0.21 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.95 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=x^{2} \log {\left (x - 1 \right )}^{2} - 2 x e^{x + 1} \log {\left (x - 1 \right )}^{2} + x + e^{2 x + 2} \log {\left (x - 1 \right )}^{2} \]

[In]

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

[Out]

x**2*log(x - 1)**2 - 2*x*exp(x + 1)*log(x - 1)**2 + x + exp(2*x + 2)*log(x - 1)**2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 107 vs. \(2 (19) = 38\).

Time = 0.26 (sec) , antiderivative size = 107, normalized size of antiderivative = 5.35 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=\frac {1}{2} \, {\left (2 \, \log \left (x - 1\right )^{2} - 2 \, \log \left (x - 1\right ) + 1\right )} {\left (x - 1\right )}^{2} - {\left (2 \, x e^{\left (x + 1\right )} - e^{\left (2 \, x + 2\right )}\right )} \log \left (x - 1\right )^{2} + 2 \, {\left (\log \left (x - 1\right )^{2} - 2 \, \log \left (x - 1\right ) + 2\right )} {\left (x - 1\right )} - \frac {1}{2} \, x^{2} + {\left (x^{2} + 2 \, x + 2 \, \log \left (x - 1\right )\right )} \log \left (x - 1\right ) - \log \left (x - 1\right )^{2} - 2 \, x - 3 \, \log \left (x - 1\right ) \]

[In]

integrate((((-2+2*x)*exp(1+x)^2+(-2*x^2+2)*exp(1+x)+2*x^2-2*x)*log(-1+x)^2+(2*exp(1+x)^2-4*x*exp(1+x)+2*x^2)*l
og(-1+x)+x-1)/(-1+x),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.90 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx=x^{2} \log \left (x - 1\right )^{2} - 2 \, x e^{\left (x + 1\right )} \log \left (x - 1\right )^{2} + e^{\left (2 \, x + 2\right )} \log \left (x - 1\right )^{2} + x \]

[In]

integrate((((-2+2*x)*exp(1+x)^2+(-2*x^2+2)*exp(1+x)+2*x^2-2*x)*log(-1+x)^2+(2*exp(1+x)^2-4*x*exp(1+x)+2*x^2)*l
og(-1+x)+x-1)/(-1+x),x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 11.21 (sec) , antiderivative size = 41, normalized size of antiderivative = 2.05 \[ \int \frac {-1+x+\left (2 e^{2+2 x}-4 e^{1+x} x+2 x^2\right ) \log (-1+x)+\left (-2 x+2 x^2+e^{2+2 x} (-2+2 x)+e^{1+x} \left (2-2 x^2\right )\right ) \log ^2(-1+x)}{-1+x} \, dx={\ln \left (x-1\right )}^2\,{\mathrm {e}}^{2\,x+2}-x\,\left (2\,{\ln \left (x-1\right )}^2\,{\mathrm {e}}^{x+1}-1\right )+x^2\,{\ln \left (x-1\right )}^2 \]

[In]

int((x + log(x - 1)*(2*exp(2*x + 2) - 4*x*exp(x + 1) + 2*x^2) - log(x - 1)^2*(2*x - exp(2*x + 2)*(2*x - 2) + e
xp(x + 1)*(2*x^2 - 2) - 2*x^2) - 1)/(x - 1),x)

[Out]

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