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

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

Optimal result

Integrand size = 23, antiderivative size = 17 \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx=-\frac {2}{5}-x+e^{-x} (2+e) x \]

[Out]

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

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82, number of steps used = 5, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {6874, 2225, 2207} \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx=(2+e) e^{-x} x-x \]

[In]

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

[Out]

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

Rule 2207

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(c + d*x)^m*
((b*F^(g*(e + f*x)))^n/(f*g*n*Log[F])), x] - Dist[d*(m/(f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*(b*F^(g*(e + f*x
)))^n, x], x] /; FreeQ[{F, b, c, d, e, f, g, n}, x] && GtQ[m, 0] && IntegerQ[2*m] &&  !TrueQ[$UseGamma]

Rule 2225

Int[((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.), x_Symbol] :> Simp[(F^(c*(a + b*x)))^n/(b*c*n*Log[F]), x] /; Fre
eQ[{F, a, b, c, n}, x]

Rule 6874

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

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.43 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88

method result size
risch \(-x +\left ({\mathrm e}+2\right ) {\mathrm e}^{-x} x\) \(15\)
norman \(\left (x \left ({\mathrm e}+2\right )-{\mathrm e}^{x} x \right ) {\mathrm e}^{-x}\) \(18\)
parallelrisch \(\left (x \,{\mathrm e}-{\mathrm e}^{x} x +2 x \right ) {\mathrm e}^{-x}\) \(19\)
default \(-x -{\mathrm e}^{-x} {\mathrm e}+2 x \,{\mathrm e}^{-x}-{\mathrm e} \left (-x \,{\mathrm e}^{-x}-{\mathrm e}^{-x}\right )\) \(38\)
parts \(-x -{\mathrm e}^{-x} {\mathrm e}+2 x \,{\mathrm e}^{-x}-{\mathrm e} \left (-x \,{\mathrm e}^{-x}-{\mathrm e}^{-x}\right )\) \(38\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.06 \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx={\left (x e - x e^{x} + 2 \, x\right )} e^{\left (-x\right )} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.71 \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx=- x + \left (2 x + e x\right ) e^{- x} \]

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

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

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.12 \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx=2 \, x e^{\left (-x\right )} + x e^{\left (-x + 1\right )} - x \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.12 \[ \int e^{-x} \left (2-e^x+e (1-x)-2 x\right ) \, dx=2\,x\,{\mathrm {e}}^{-x}-x+x\,{\mathrm {e}}^{-x}\,\mathrm {e} \]

[In]

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

[Out]

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