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

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

Optimal result

Integrand size = 99, antiderivative size = 26 \[ \int e^{-x} \left (e^x \left (4+4 e^2+e^4\right )+e^{e^{-x} \left (-x+e^x (2+x)\right )} \left (-4 x+4 x^2+e^4 \left (-x+x^2\right )+e^2 \left (-4 x+4 x^2\right )+e^x \left (4+4 x+e^4 (1+x)+e^2 (4+4 x)\right )\right )\right ) \, dx=\left (2+e^2\right )^2 \left (-3+x+e^{2+x-e^{-x} x} x\right ) \]

[Out]

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

Rubi [F]

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

[In]

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

[Out]

(2 + E^2)^2*x + (2 + E^2)^2*Defer[Int][E^(2 + x - x/E^x), x] - (2 + E^2)^2*Defer[Int][E^(2 - x/E^x)*x, x] + (2
 + E^2)^2*Defer[Int][E^(2 + x - x/E^x)*x, x] + (2 + E^2)^2*Defer[Int][E^(2 - x/E^x)*x^2, x]

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

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.92 \[ \int e^{-x} \left (e^x \left (4+4 e^2+e^4\right )+e^{e^{-x} \left (-x+e^x (2+x)\right )} \left (-4 x+4 x^2+e^4 \left (-x+x^2\right )+e^2 \left (-4 x+4 x^2\right )+e^x \left (4+4 x+e^4 (1+x)+e^2 (4+4 x)\right )\right )\right ) \, dx=\left (2+e^2\right )^2 \left (1+e^{2+x-e^{-x} x}\right ) x \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.19 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.62

method result size
risch \(4 \,{\mathrm e}^{2} x +x \,{\mathrm e}^{4}+4 x +x \left ({\mathrm e}^{4}+4 \,{\mathrm e}^{2}+4\right ) {\mathrm e}^{\left ({\mathrm e}^{x} x +2 \,{\mathrm e}^{x}-x \right ) {\mathrm e}^{-x}}\) \(42\)
norman \(\left (\left ({\mathrm e}^{4}+4 \,{\mathrm e}^{2}+4\right ) x \,{\mathrm e}^{x}+\left ({\mathrm e}^{4}+4 \,{\mathrm e}^{2}+4\right ) x \,{\mathrm e}^{x} {\mathrm e}^{\left (\left (2+x \right ) {\mathrm e}^{x}-x \right ) {\mathrm e}^{-x}}\right ) {\mathrm e}^{-x}\) \(51\)
parallelrisch \({\mathrm e}^{4} {\mathrm e}^{\left (\left (2+x \right ) {\mathrm e}^{x}-x \right ) {\mathrm e}^{-x}} x +x \,{\mathrm e}^{4}+4 \,{\mathrm e}^{2} {\mathrm e}^{\left (\left (2+x \right ) {\mathrm e}^{x}-x \right ) {\mathrm e}^{-x}} x +4 \,{\mathrm e}^{2} x +4 \,{\mathrm e}^{\left (\left (2+x \right ) {\mathrm e}^{x}-x \right ) {\mathrm e}^{-x}} x +4 x\) \(78\)

[In]

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

[Out]

4*exp(2)*x+x*exp(4)+4*x+x*(exp(4)+4*exp(2)+4)*exp((exp(x)*x+2*exp(x)-x)*exp(-x))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.65 \[ \int e^{-x} \left (e^x \left (4+4 e^2+e^4\right )+e^{e^{-x} \left (-x+e^x (2+x)\right )} \left (-4 x+4 x^2+e^4 \left (-x+x^2\right )+e^2 \left (-4 x+4 x^2\right )+e^x \left (4+4 x+e^4 (1+x)+e^2 (4+4 x)\right )\right )\right ) \, dx=x e^{4} + 4 \, x e^{2} + {\left (x e^{4} + 4 \, x e^{2} + 4 \, x\right )} e^{\left ({\left ({\left (x + 2\right )} e^{x} - x\right )} e^{\left (-x\right )}\right )} + 4 \, x \]

[In]

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

[Out]

x*e^4 + 4*x*e^2 + (x*e^4 + 4*x*e^2 + 4*x)*e^(((x + 2)*e^x - x)*e^(-x)) + 4*x

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

x*(4 + 4*exp(2) + exp(4)) + (4*x + 4*x*exp(2) + x*exp(4))*exp((-x + (x + 2)*exp(x))*exp(-x))

Maxima [F]

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

[In]

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

[Out]

x*e^4 + 4*x*e^2 + 4*x + integrate((x^2*(e^6 + 4*e^4 + 4*e^2) - x*(e^6 + 4*e^4 + 4*e^2) + (x*(e^6 + 4*e^4 + 4*e
^2) + e^6 + 4*e^4 + 4*e^2)*e^x)*e^(-x*e^(-x)), x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 54 vs. \(2 (23) = 46\).

Time = 0.28 (sec) , antiderivative size = 54, normalized size of antiderivative = 2.08 \[ \int e^{-x} \left (e^x \left (4+4 e^2+e^4\right )+e^{e^{-x} \left (-x+e^x (2+x)\right )} \left (-4 x+4 x^2+e^4 \left (-x+x^2\right )+e^2 \left (-4 x+4 x^2\right )+e^x \left (4+4 x+e^4 (1+x)+e^2 (4+4 x)\right )\right )\right ) \, dx=x e^{4} + 4 \, x e^{2} + x e^{\left (-x e^{\left (-x\right )} + x + 6\right )} + 4 \, x e^{\left (-x e^{\left (-x\right )} + x + 4\right )} + 4 \, x e^{\left (-x e^{\left (-x\right )} + x + 2\right )} + 4 \, x \]

[In]

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

[Out]

x*e^4 + 4*x*e^2 + x*e^(-x*e^(-x) + x + 6) + 4*x*e^(-x*e^(-x) + x + 4) + 4*x*e^(-x*e^(-x) + x + 2) + 4*x

Mupad [B] (verification not implemented)

Time = 9.17 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.81 \[ \int e^{-x} \left (e^x \left (4+4 e^2+e^4\right )+e^{e^{-x} \left (-x+e^x (2+x)\right )} \left (-4 x+4 x^2+e^4 \left (-x+x^2\right )+e^2 \left (-4 x+4 x^2\right )+e^x \left (4+4 x+e^4 (1+x)+e^2 (4+4 x)\right )\right )\right ) \, dx=x\,\left ({\mathrm {e}}^{x-x\,{\mathrm {e}}^{-x}+2}+1\right )\,{\left ({\mathrm {e}}^2+2\right )}^2 \]

[In]

int(exp(-x)*(exp(x)*(4*exp(2) + exp(4) + 4) - exp(-exp(-x)*(x - exp(x)*(x + 2)))*(4*x - exp(x)*(4*x + exp(4)*(
x + 1) + exp(2)*(4*x + 4) + 4) + exp(2)*(4*x - 4*x^2) + exp(4)*(x - x^2) - 4*x^2)),x)

[Out]

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