\(\int \frac {2 x-3 x^2-20 x^4+e^{2-x} (4+9 x+14 x^3-6 x^4)+(-5 x^2-6 x^4+e^{2-x} (2+4 x-3 x^2+4 x^3-2 x^4)) \log (x)+(-x^2-e^{2-x} x^2) \log ^2(x)}{x^2} \, dx\) [6602]

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

Optimal result

Integrand size = 106, antiderivative size = 29 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=\left (e^{2-x}-x\right ) (3+\log (x)) \left (-\frac {2}{x}+2 x^2+\log (x)\right ) \]

[Out]

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

Rubi [F]

\[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=\int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx \]

[In]

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

[Out]

(-6*E^(2 - x))/x + 6*E^(2 - x)*x^2 - 6*x^3 + 2*E^2*x*HypergeometricPFQ[{1, 1, 1}, {2, 2, 2}, -x] + 2*Log[x] +
3*E^(2 - x)*Log[x] - 2*E^2*EulerGamma*Log[x] - (2*E^(2 - x)*Log[x])/x - 3*x*Log[x] + 2*E^(2 - x)*x^2*Log[x] -
2*x^3*Log[x] + 2*E^2*ExpIntegralEi[-x]*Log[x] - 2*E^2*(ExpIntegralE[1, x] + ExpIntegralEi[-x])*Log[x] - E^2*Lo
g[x]^2 - x*Log[x]^2 - Defer[Int][E^(2 - x)*Log[x]^2, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {2-3 x-20 x^3-5 x \log (x)-6 x^3 \log (x)-x \log ^2(x)}{x}-\frac {e^{2-x} \left (-4-9 x-14 x^3+6 x^4-2 \log (x)-4 x \log (x)+3 x^2 \log (x)-4 x^3 \log (x)+2 x^4 \log (x)+x^2 \log ^2(x)\right )}{x^2}\right ) \, dx \\ & = \int \frac {2-3 x-20 x^3-5 x \log (x)-6 x^3 \log (x)-x \log ^2(x)}{x} \, dx-\int \frac {e^{2-x} \left (-4-9 x-14 x^3+6 x^4-2 \log (x)-4 x \log (x)+3 x^2 \log (x)-4 x^3 \log (x)+2 x^4 \log (x)+x^2 \log ^2(x)\right )}{x^2} \, dx \\ & = \int \left (\frac {2-3 x-20 x^3}{x}-\left (5+6 x^2\right ) \log (x)-\log ^2(x)\right ) \, dx-\int \left (\frac {e^{2-x} \left (-4-9 x-14 x^3+6 x^4\right )}{x^2}+\frac {e^{2-x} \left (-2-4 x+3 x^2-4 x^3+2 x^4\right ) \log (x)}{x^2}+e^{2-x} \log ^2(x)\right ) \, dx \\ & = \int \frac {2-3 x-20 x^3}{x} \, dx-\int \frac {e^{2-x} \left (-4-9 x-14 x^3+6 x^4\right )}{x^2} \, dx-\int \left (5+6 x^2\right ) \log (x) \, dx-\int \frac {e^{2-x} \left (-2-4 x+3 x^2-4 x^3+2 x^4\right ) \log (x)}{x^2} \, dx-\int \log ^2(x) \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = 3 e^{2-x} \log (x)-\frac {2 e^{2-x} \log (x)}{x}-5 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-x \log ^2(x)+2 \int \log (x) \, dx+\int \left (-3+\frac {2}{x}-20 x^2\right ) \, dx+\int \left (5+2 x^2\right ) \, dx-\int \left (-\frac {4 e^{2-x}}{x^2}-\frac {9 e^{2-x}}{x}-14 e^{2-x} x+6 e^{2-x} x^2\right ) \, dx+\int \frac {e^{2-x} \left (2-3 x-2 x^3-2 e^x x \text {Ei}(-x)\right )}{x^2} \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -6 x^3+2 \log (x)+3 e^{2-x} \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-x \log ^2(x)+4 \int \frac {e^{2-x}}{x^2} \, dx-6 \int e^{2-x} x^2 \, dx+9 \int \frac {e^{2-x}}{x} \, dx+14 \int e^{2-x} x \, dx+\int \left (\frac {e^{2-x} \left (2-3 x-2 x^3\right )}{x^2}-\frac {2 e^2 \text {Ei}(-x)}{x}\right ) \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -\frac {4 e^{2-x}}{x}-14 e^{2-x} x+6 e^{2-x} x^2-6 x^3+9 e^2 \text {Ei}(-x)+2 \log (x)+3 e^{2-x} \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-x \log ^2(x)-4 \int \frac {e^{2-x}}{x} \, dx-12 \int e^{2-x} x \, dx+14 \int e^{2-x} \, dx-\left (2 e^2\right ) \int \frac {\text {Ei}(-x)}{x} \, dx+\int \frac {e^{2-x} \left (2-3 x-2 x^3\right )}{x^2} \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -14 e^{2-x}-\frac {4 e^{2-x}}{x}-2 e^{2-x} x+6 e^{2-x} x^2-6 x^3+5 e^2 \text {Ei}(-x)+2 \log (x)+3 e^{2-x} \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-2 e^2 (E_1(x)+\text {Ei}(-x)) \log (x)-x \log ^2(x)-12 \int e^{2-x} \, dx+\left (2 e^2\right ) \int \frac {E_1(x)}{x} \, dx+\int \left (\frac {2 e^{2-x}}{x^2}-\frac {3 e^{2-x}}{x}-2 e^{2-x} x\right ) \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -2 e^{2-x}-\frac {4 e^{2-x}}{x}-2 e^{2-x} x+6 e^{2-x} x^2-6 x^3+5 e^2 \text {Ei}(-x)+2 e^2 x \, _3F_3(1,1,1;2,2,2;-x)+2 \log (x)+3 e^{2-x} \log (x)-2 e^2 \gamma \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-2 e^2 (E_1(x)+\text {Ei}(-x)) \log (x)-e^2 \log ^2(x)-x \log ^2(x)+2 \int \frac {e^{2-x}}{x^2} \, dx-2 \int e^{2-x} x \, dx-3 \int \frac {e^{2-x}}{x} \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -2 e^{2-x}-\frac {6 e^{2-x}}{x}+6 e^{2-x} x^2-6 x^3+2 e^2 \text {Ei}(-x)+2 e^2 x \, _3F_3(1,1,1;2,2,2;-x)+2 \log (x)+3 e^{2-x} \log (x)-2 e^2 \gamma \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-2 e^2 (E_1(x)+\text {Ei}(-x)) \log (x)-e^2 \log ^2(x)-x \log ^2(x)-2 \int e^{2-x} \, dx-2 \int \frac {e^{2-x}}{x} \, dx-\int e^{2-x} \log ^2(x) \, dx \\ & = -\frac {6 e^{2-x}}{x}+6 e^{2-x} x^2-6 x^3+2 e^2 x \, _3F_3(1,1,1;2,2,2;-x)+2 \log (x)+3 e^{2-x} \log (x)-2 e^2 \gamma \log (x)-\frac {2 e^{2-x} \log (x)}{x}-3 x \log (x)+2 e^{2-x} x^2 \log (x)-2 x^3 \log (x)+2 e^2 \text {Ei}(-x) \log (x)-2 e^2 (E_1(x)+\text {Ei}(-x)) \log (x)-e^2 \log ^2(x)-x \log ^2(x)-\int e^{2-x} \log ^2(x) \, dx \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(67\) vs. \(2(29)=58\).

Time = 0.09 (sec) , antiderivative size = 67, normalized size of antiderivative = 2.31 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=\frac {e^{-x} \left (-6 e^x x^4+6 e^2 \left (-1+x^3\right )+\left (e^2-e^x x\right ) \left (-2+3 x+2 x^3\right ) \log (x)+x \left (e^2-e^x x\right ) \log ^2(x)\right )}{x} \]

[In]

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

[Out]

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

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(96\) vs. \(2(28)=56\).

Time = 0.13 (sec) , antiderivative size = 97, normalized size of antiderivative = 3.34

method result size
risch \(\left ({\mathrm e}^{2-x}-x \right ) \ln \left (x \right )^{2}-\frac {\left (2 x^{4}-2 x^{3} {\mathrm e}^{2-x}+3 x^{2}-3 x \,{\mathrm e}^{2-x}+2 \,{\mathrm e}^{2-x}\right ) \ln \left (x \right )}{x}+\frac {-6 x^{4}+6 x^{3} {\mathrm e}^{2-x}+2 x \ln \left (x \right )-6 \,{\mathrm e}^{2-x}}{x}\) \(97\)
parallelrisch \(-\frac {2 x^{4} \ln \left (x \right )-2 \ln \left (x \right ) {\mathrm e}^{2-x} x^{3}+6 x^{4}-6 x^{3} {\mathrm e}^{2-x}+x^{2} \ln \left (x \right )^{2}-\ln \left (x \right )^{2} x \,{\mathrm e}^{2-x}+3 x^{2} \ln \left (x \right )-3 \ln \left (x \right ) {\mathrm e}^{2-x} x -2 x \ln \left (x \right )+2 \,{\mathrm e}^{2-x} \ln \left (x \right )+6 \,{\mathrm e}^{2-x}}{x}\) \(105\)

[In]

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

[Out]

(exp(2-x)-x)*ln(x)^2-(2*x^4-2*x^3*exp(2-x)+3*x^2-3*x*exp(2-x)+2*exp(2-x))/x*ln(x)+2*(-3*x^4+3*x^3*exp(2-x)+x*l
n(x)-3*exp(2-x))/x

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 77 vs. \(2 (29) = 58\).

Time = 0.47 (sec) , antiderivative size = 77, normalized size of antiderivative = 2.66 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=-\frac {6 \, x^{4} + {\left (x^{2} - x e^{\left (-x + 2\right )}\right )} \log \left (x\right )^{2} - 6 \, {\left (x^{3} - 1\right )} e^{\left (-x + 2\right )} + {\left (2 \, x^{4} + 3 \, x^{2} - {\left (2 \, x^{3} + 3 \, x - 2\right )} e^{\left (-x + 2\right )} - 2 \, x\right )} \log \left (x\right )}{x} \]

[In]

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

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (22) = 44\).

Time = 0.16 (sec) , antiderivative size = 70, normalized size of antiderivative = 2.41 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=- 6 x^{3} - x \log {\left (x \right )}^{2} + \left (- 2 x^{3} - 3 x\right ) \log {\left (x \right )} + 2 \log {\left (x \right )} + \frac {\left (2 x^{3} \log {\left (x \right )} + 6 x^{3} + x \log {\left (x \right )}^{2} + 3 x \log {\left (x \right )} - 2 \log {\left (x \right )} - 6\right ) e^{2 - x}}{x} \]

[In]

integrate(((-x**2*exp(2-x)-x**2)*ln(x)**2+((-2*x**4+4*x**3-3*x**2+4*x+2)*exp(2-x)-6*x**4-5*x**2)*ln(x)+(-6*x**
4+14*x**3+9*x+4)*exp(2-x)-20*x**4-3*x**2+2*x)/x**2,x)

[Out]

-6*x**3 - x*log(x)**2 + (-2*x**3 - 3*x)*log(x) + 2*log(x) + (2*x**3*log(x) + 6*x**3 + x*log(x)**2 + 3*x*log(x)
 - 2*log(x) - 6)*exp(2 - x)/x

Maxima [F]

\[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=\int { -\frac {20 \, x^{4} + {\left (x^{2} e^{\left (-x + 2\right )} + x^{2}\right )} \log \left (x\right )^{2} + 3 \, x^{2} + {\left (6 \, x^{4} - 14 \, x^{3} - 9 \, x - 4\right )} e^{\left (-x + 2\right )} + {\left (6 \, x^{4} + 5 \, x^{2} + {\left (2 \, x^{4} - 4 \, x^{3} + 3 \, x^{2} - 4 \, x - 2\right )} e^{\left (-x + 2\right )}\right )} \log \left (x\right ) - 2 \, x}{x^{2}} \,d x } \]

[In]

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

[Out]

-2*x^3*log(x) - 6*x^3 + 6*Ei(-x)*e^2 + 6*(x^2*e^2 + 2*x*e^2 + 2*e^2)*e^(-x) - 14*(x*e^2 + e^2)*e^(-x) - 4*e^2*
gamma(-1, x) - 5*x*log(x) + 3*e^(-x + 2)*log(x) + 2*x - (x^2*log(x)^2 - 2*x^2*log(x) + 2*x^2 - (x*e^2*log(x)^2
 + 2*(x^3*e^2 - e^2)*log(x))*e^(-x))/x - integrate(2*(x^3*e^2 - e^2)*e^(-x)/x^2, x) + 2*log(x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 104 vs. \(2 (29) = 58\).

Time = 0.29 (sec) , antiderivative size = 104, normalized size of antiderivative = 3.59 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=-\frac {2 \, x^{4} \log \left (x\right ) - 2 \, x^{3} e^{\left (-x + 2\right )} \log \left (x\right ) + 6 \, x^{4} - 6 \, x^{3} e^{\left (-x + 2\right )} + x^{2} \log \left (x\right )^{2} - x e^{\left (-x + 2\right )} \log \left (x\right )^{2} + 3 \, x^{2} \log \left (x\right ) - 3 \, x e^{\left (-x + 2\right )} \log \left (x\right ) - 2 \, x \log \left (x\right ) + 2 \, e^{\left (-x + 2\right )} \log \left (x\right ) + 6 \, e^{\left (-x + 2\right )}}{x} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 11.42 (sec) , antiderivative size = 83, normalized size of antiderivative = 2.86 \[ \int \frac {2 x-3 x^2-20 x^4+e^{2-x} \left (4+9 x+14 x^3-6 x^4\right )+\left (-5 x^2-6 x^4+e^{2-x} \left (2+4 x-3 x^2+4 x^3-2 x^4\right )\right ) \log (x)+\left (-x^2-e^{2-x} x^2\right ) \log ^2(x)}{x^2} \, dx=2\,\ln \left (x\right )-{\ln \left (x\right )}^2\,\left (x-{\mathrm {e}}^{2-x}\right )-6\,x^3-\ln \left (x\right )\,\left (3\,x-{\mathrm {e}}^{2-x}\,\left (\frac {2\,x^3+3\,x}{x}-\frac {2}{x}\right )+2\,x^3\right )+\frac {{\mathrm {e}}^{2-x}\,\left (6\,x^3-6\right )}{x} \]

[In]

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

[Out]

2*log(x) - log(x)^2*(x - exp(2 - x)) - 6*x^3 - log(x)*(3*x - exp(2 - x)*((3*x + 2*x^3)/x - 2/x) + 2*x^3) + (ex
p(2 - x)*(6*x^3 - 6))/x