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

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

Optimal result

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

[Out]

ln(5)-ln(exp(2+x)/x)+x^2/exp(x)

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.62, number of steps used = 11, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {6874, 45, 2227, 2207, 2225} \[ \int \frac {e^{-x} \left (e^x (1-x)+2 x^2-x^3\right )}{x} \, dx=e^{-x} x^2-x+\log (x) \]

[In]

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

[Out]

-x + x^2/E^x + Log[x]

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

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 2227

Int[(F_)^((c_.)*(v_))*(u_), x_Symbol] :> Int[ExpandIntegrand[F^(c*ExpandToSum[v, x]), u, x], x] /; FreeQ[{F, c
}, x] && PolynomialQ[u, x] && LinearQ[v, x] &&  !TrueQ[$UseGamma]

Rule 6874

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

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.62

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

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 12.15 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.58 \[ \int \frac {e^{-x} \left (e^x (1-x)+2 x^2-x^3\right )}{x} \, dx=\ln \left (x\right )-x+x^2\,{\mathrm {e}}^{-x} \]

[In]

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

[Out]

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