\(\int \frac {-2 x^3+e^{-3+x} (4-4 x+x^2+x^3)+e^{2 x} (-4 x^2+e^{-3+x} (-2+6 x))+e^{e^{-1+x}+2 x} (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} (5 e^{-3+x} x-5 x^2))}{x^2} \, dx\) [2606]

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

Optimal result

Integrand size = 99, antiderivative size = 35 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=\left (e^{-3+x}-x\right ) \left (\frac {-4+e^{2 x} \left (2+5 e^{e^{-1+x}}\right )}{x}+x\right ) \]

[Out]

(exp(-3+x)-x)*((exp(2*x)*(5*exp(exp(-1+x))+2)-4)/x+x)

Rubi [F]

\[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=\int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx \]

[In]

Int[(-2*x^3 + E^(-3 + x)*(4 - 4*x + x^2 + x^3) + E^(2*x)*(-4*x^2 + E^(-3 + x)*(-2 + 6*x)) + E^(E^(-1 + x) + 2*
x)*(-10*x^2 + E^(-3 + x)*(-5 + 15*x) + E^(-1 + x)*(5*E^(-3 + x)*x - 5*x^2)))/x^2,x]

[Out]

-2*E^(2*x) - 5*E^(E^(-1 + x) + 2*x) - (4*E^(-3 + x))/x + (2*E^(-3 + 3*x))/x + E^(-3 + x)*x - x^2 - 5*Defer[Int
][E^(-3 + E^(-1 + x) + 3*x)/x^2, x] + 15*Defer[Int][E^(-3 + E^(-1 + x) + 3*x)/x, x] + 5*Defer[Int][E^(-4 + E^(
-1 + x) + 4*x)/x, x]

Rubi steps \begin{align*} \text {integral}& = \int \left (-2 e^{2 x} \left (2+5 e^{e^{-1+x}}\right )+\frac {5 e^{-4+e^{-1+x}+4 x}}{x}-2 x-\frac {e^{-3+3 x} \left (2+5 e^{e^{-1+x}}-6 x-15 e^{e^{-1+x}} x+5 e^{2+e^{-1+x}} x^2\right )}{x^2}+\frac {e^{-3+x} \left (4-4 x+x^2+x^3\right )}{x^2}\right ) \, dx \\ & = -x^2-2 \int e^{2 x} \left (2+5 e^{e^{-1+x}}\right ) \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx-\int \frac {e^{-3+3 x} \left (2+5 e^{e^{-1+x}}-6 x-15 e^{e^{-1+x}} x+5 e^{2+e^{-1+x}} x^2\right )}{x^2} \, dx+\int \frac {e^{-3+x} \left (4-4 x+x^2+x^3\right )}{x^2} \, dx \\ & = -x^2-2 \text {Subst}\left (\int \left (2+5 e^{\frac {x}{e}}\right ) x \, dx,x,e^x\right )+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx+\int \left (e^{-3+x}+\frac {4 e^{-3+x}}{x^2}-\frac {4 e^{-3+x}}{x}+e^{-3+x} x\right ) \, dx-\int \left (-\frac {2 e^{-3+3 x} (-1+3 x)}{x^2}+\frac {5 e^{-3+e^{-1+x}+3 x} \left (1-3 x+e^2 x^2\right )}{x^2}\right ) \, dx \\ & = -x^2+2 \int \frac {e^{-3+3 x} (-1+3 x)}{x^2} \, dx-2 \text {Subst}\left (\int \left (2 x+5 e^{\frac {x}{e}} x\right ) \, dx,x,e^x\right )+4 \int \frac {e^{-3+x}}{x^2} \, dx-4 \int \frac {e^{-3+x}}{x} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx-5 \int \frac {e^{-3+e^{-1+x}+3 x} \left (1-3 x+e^2 x^2\right )}{x^2} \, dx+\int e^{-3+x} \, dx+\int e^{-3+x} x \, dx \\ & = e^{-3+x}-2 e^{2 x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-\frac {4 \operatorname {ExpIntegralEi}(x)}{e^3}+4 \int \frac {e^{-3+x}}{x} \, dx-5 \int \left (e^{-1+e^{-1+x}+3 x}+\frac {e^{-3+e^{-1+x}+3 x}}{x^2}-\frac {3 e^{-3+e^{-1+x}+3 x}}{x}\right ) \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx-10 \text {Subst}\left (\int e^{\frac {x}{e}} x \, dx,x,e^x\right )-\int e^{-3+x} \, dx \\ & = -2 e^{2 x}-10 e^{1+e^{-1+x}+x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-5 \int e^{-1+e^{-1+x}+3 x} \, dx-5 \int \frac {e^{-3+e^{-1+x}+3 x}}{x^2} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx+15 \int \frac {e^{-3+e^{-1+x}+3 x}}{x} \, dx+(10 e) \text {Subst}\left (\int e^{\frac {x}{e}} \, dx,x,e^x\right ) \\ & = 10 e^{2+e^{-1+x}}-2 e^{2 x}-10 e^{1+e^{-1+x}+x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-5 \int \frac {e^{-3+e^{-1+x}+3 x}}{x^2} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx-5 \text {Subst}\left (\int e^{-1+\frac {x}{e}} x^2 \, dx,x,e^x\right )+15 \int \frac {e^{-3+e^{-1+x}+3 x}}{x} \, dx \\ & = 10 e^{2+e^{-1+x}}-2 e^{2 x}-10 e^{1+e^{-1+x}+x}-5 e^{e^{-1+x}+2 x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-5 \int \frac {e^{-3+e^{-1+x}+3 x}}{x^2} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx+15 \int \frac {e^{-3+e^{-1+x}+3 x}}{x} \, dx+(10 e) \text {Subst}\left (\int e^{-1+\frac {x}{e}} x \, dx,x,e^x\right ) \\ & = 10 e^{2+e^{-1+x}}-2 e^{2 x}-5 e^{e^{-1+x}+2 x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-5 \int \frac {e^{-3+e^{-1+x}+3 x}}{x^2} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx+15 \int \frac {e^{-3+e^{-1+x}+3 x}}{x} \, dx-\left (10 e^2\right ) \text {Subst}\left (\int e^{-1+\frac {x}{e}} \, dx,x,e^x\right ) \\ & = -2 e^{2 x}-5 e^{e^{-1+x}+2 x}-\frac {4 e^{-3+x}}{x}+\frac {2 e^{-3+3 x}}{x}+e^{-3+x} x-x^2-5 \int \frac {e^{-3+e^{-1+x}+3 x}}{x^2} \, dx+5 \int \frac {e^{-4+e^{-1+x}+4 x}}{x} \, dx+15 \int \frac {e^{-3+e^{-1+x}+3 x}}{x} \, dx \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(71\) vs. \(2(35)=70\).

Time = 0.16 (sec) , antiderivative size = 71, normalized size of antiderivative = 2.03 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=-2 e^{2 x}+e^{e^{-1+x}} \left (-5 e^{2 x}+\frac {5 e^{-3+3 x}}{x}\right )+\frac {2 e^{-3+3 x}}{x}-x^2+e^x \left (-\frac {4}{e^3 x}+\frac {x}{e^3}\right ) \]

[In]

Integrate[(-2*x^3 + E^(-3 + x)*(4 - 4*x + x^2 + x^3) + E^(2*x)*(-4*x^2 + E^(-3 + x)*(-2 + 6*x)) + E^(E^(-1 + x
) + 2*x)*(-10*x^2 + E^(-3 + x)*(-5 + 15*x) + E^(-1 + x)*(5*E^(-3 + x)*x - 5*x^2)))/x^2,x]

[Out]

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

Maple [A] (verified)

Time = 0.46 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.69

method result size
risch \(-x^{2}+\frac {2 \,{\mathrm e}^{-3+3 x}}{x}-2 \,{\mathrm e}^{2 x}+\frac {\left (x^{2}-4\right ) {\mathrm e}^{-3+x}}{x}+\frac {5 \left ({\mathrm e}^{-3+x}-x \right ) {\mathrm e}^{{\mathrm e}^{-1+x}+2 x}}{x}\) \(59\)
parallelrisch \(-\frac {x^{3}-x^{2} {\mathrm e}^{-3+x}+5 x \,{\mathrm e}^{2 x} {\mathrm e}^{{\mathrm e}^{-1+x}}-5 \,{\mathrm e}^{-3+x} {\mathrm e}^{2 x} {\mathrm e}^{{\mathrm e}^{-1+x}}+2 x \,{\mathrm e}^{2 x}-2 \,{\mathrm e}^{-3+x} {\mathrm e}^{2 x}+4 \,{\mathrm e}^{-3+x}}{x}\) \(69\)

[In]

int((((5*x*exp(-3+x)-5*x^2)*exp(-1+x)+(15*x-5)*exp(-3+x)-10*x^2)*exp(2*x)*exp(exp(-1+x))+((6*x-2)*exp(-3+x)-4*
x^2)*exp(2*x)+(x^3+x^2-4*x+4)*exp(-3+x)-2*x^3)/x^2,x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.83 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=-\frac {{\left (x^{3} e^{2} + 5 \, {\left (x e^{2} - e^{\left (x - 1\right )}\right )} e^{\left (2 \, x + e^{\left (x - 1\right )}\right )} + 2 \, x e^{\left (2 \, x + 2\right )} - {\left (x^{2} - 4\right )} e^{\left (x - 1\right )} - 2 \, e^{\left (3 \, x - 1\right )}\right )} e^{\left (-2\right )}}{x} \]

[In]

integrate((((5*x*exp(-3+x)-5*x^2)*exp(-1+x)+(15*x-5)*exp(-3+x)-10*x^2)*exp(2*x)*exp(exp(-1+x))+((6*x-2)*exp(-3
+x)-4*x^2)*exp(2*x)+(x^3+x^2-4*x+4)*exp(-3+x)-2*x^3)/x^2,x, algorithm="fricas")

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 100 vs. \(2 (26) = 52\).

Time = 0.19 (sec) , antiderivative size = 100, normalized size of antiderivative = 2.86 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=- x^{2} + \frac {\left (- 5 x e^{3} e^{2 x} + 5 \left (e^{2 x}\right )^{\frac {3}{2}}\right ) e^{\frac {\sqrt {e^{2 x}}}{e}}}{x e^{3}} + \frac {- 2 x^{2} e^{6} e^{2 x} + 2 x e^{3} \left (e^{2 x}\right )^{\frac {3}{2}} + \left (x^{3} e^{3} - 4 x e^{3}\right ) \sqrt {e^{2 x}}}{x^{2} e^{6}} \]

[In]

integrate((((5*x*exp(-3+x)-5*x**2)*exp(-1+x)+(15*x-5)*exp(-3+x)-10*x**2)*exp(2*x)*exp(exp(-1+x))+((6*x-2)*exp(
-3+x)-4*x**2)*exp(2*x)+(x**3+x**2-4*x+4)*exp(-3+x)-2*x**3)/x**2,x)

[Out]

-x**2 + (-5*x*exp(3)*exp(2*x) + 5*exp(2*x)**(3/2))*exp(-3)*exp(exp(-1)*sqrt(exp(2*x)))/x + (-2*x**2*exp(6)*exp
(2*x) + 2*x*exp(3)*exp(2*x)**(3/2) + (x**3*exp(3) - 4*x*exp(3))*sqrt(exp(2*x)))*exp(-6)/x**2

Maxima [C] (verification not implemented)

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

Time = 0.38 (sec) , antiderivative size = 111, normalized size of antiderivative = 3.17 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=-x^{2} + 6 \, {\rm Ei}\left (3 \, x\right ) e^{\left (-3\right )} - 4 \, {\rm Ei}\left (x\right ) e^{\left (-3\right )} + {\left (x - 1\right )} e^{\left (x - 3\right )} + 10 \, {\left (e^{2} - e^{\left (x + 1\right )}\right )} e^{\left (e^{\left (x - 1\right )}\right )} + 4 \, e^{\left (-3\right )} \Gamma \left (-1, -x\right ) - 6 \, e^{\left (-3\right )} \Gamma \left (-1, -3 \, x\right ) - \frac {5 \, {\left (2 \, x e^{5} + x e^{\left (2 \, x + 3\right )} - 2 \, x e^{\left (x + 4\right )} - e^{\left (3 \, x\right )}\right )} e^{\left (e^{\left (x - 1\right )} - 3\right )}}{x} - 2 \, e^{\left (2 \, x\right )} + e^{\left (x - 3\right )} \]

[In]

integrate((((5*x*exp(-3+x)-5*x^2)*exp(-1+x)+(15*x-5)*exp(-3+x)-10*x^2)*exp(2*x)*exp(exp(-1+x))+((6*x-2)*exp(-3
+x)-4*x^2)*exp(2*x)+(x^3+x^2-4*x+4)*exp(-3+x)-2*x^3)/x^2,x, algorithm="maxima")

[Out]

-x^2 + 6*Ei(3*x)*e^(-3) - 4*Ei(x)*e^(-3) + (x - 1)*e^(x - 3) + 10*(e^2 - e^(x + 1))*e^(e^(x - 1)) + 4*e^(-3)*g
amma(-1, -x) - 6*e^(-3)*gamma(-1, -3*x) - 5*(2*x*e^5 + x*e^(2*x + 3) - 2*x*e^(x + 4) - e^(3*x))*e^(e^(x - 1) -
 3)/x - 2*e^(2*x) + e^(x - 3)

Giac [F(-1)]

Timed out. \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=\text {Timed out} \]

[In]

integrate((((5*x*exp(-3+x)-5*x^2)*exp(-1+x)+(15*x-5)*exp(-3+x)-10*x^2)*exp(2*x)*exp(exp(-1+x))+((6*x-2)*exp(-3
+x)-4*x^2)*exp(2*x)+(x^3+x^2-4*x+4)*exp(-3+x)-2*x^3)/x^2,x, algorithm="giac")

[Out]

Timed out

Mupad [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.91 \[ \int \frac {-2 x^3+e^{-3+x} \left (4-4 x+x^2+x^3\right )+e^{2 x} \left (-4 x^2+e^{-3+x} (-2+6 x)\right )+e^{e^{-1+x}+2 x} \left (-10 x^2+e^{-3+x} (-5+15 x)+e^{-1+x} \left (5 e^{-3+x} x-5 x^2\right )\right )}{x^2} \, dx=x\,{\mathrm {e}}^{x-3}-{\mathrm {e}}^{-3}\,\left (5\,{\mathrm {e}}^{2\,x+{\mathrm {e}}^{-1}\,{\mathrm {e}}^x+3}+2\,{\mathrm {e}}^{2\,x+3}\right )-x^2+\frac {{\mathrm {e}}^{-3}\,\left (2\,{\mathrm {e}}^{3\,x}+5\,{\mathrm {e}}^{3\,x+{\mathrm {e}}^{-1}\,{\mathrm {e}}^x}-4\,{\mathrm {e}}^x\right )}{x} \]

[In]

int((exp(2*x)*(exp(x - 3)*(6*x - 2) - 4*x^2) + exp(x - 3)*(x^2 - 4*x + x^3 + 4) - 2*x^3 + exp(2*x)*exp(exp(x -
 1))*(exp(x - 1)*(5*x*exp(x - 3) - 5*x^2) + exp(x - 3)*(15*x - 5) - 10*x^2))/x^2,x)

[Out]

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