3.20.48 \(\int \frac {e^{-x} (-2-2 x-x^2+e^5 x^2-2 e^x x^2)}{2 x^2} \, dx\) [1948]

Optimal. Leaf size=30 \[ 4-x+\frac {1}{2} e^{-x} \left (-2-e^5+\frac {2+3 x}{x}\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.21, antiderivative size = 29, normalized size of antiderivative = 0.97, number of steps used = 10, number of rules used = 7, integrand size = 37, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.189, Rules used = {6, 12, 6874, 2230, 2225, 2208, 2209} \begin {gather*} -x+\frac {1}{2} \left (1-e^5\right ) e^{-x}+\frac {e^{-x}}{x} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 6

Int[(u_.)*((w_.) + (a_.)*(v_) + (b_.)*(v_))^(p_.), x_Symbol] :> Int[u*((a + b)*v + w)^p, x] /; FreeQ[{a, b}, x
] &&  !FreeQ[v, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 2208

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_), x_Symbol] :> Simp[(c + d*x)^(m
+ 1)*((b*F^(g*(e + f*x)))^n/(d*(m + 1))), x] - Dist[f*g*n*(Log[F]/(d*(m + 1))), 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] && LtQ[m, -1] && IntegerQ[2*m] &&  !TrueQ[$UseGamm
a]

Rule 2209

Int[(F_)^((g_.)*((e_.) + (f_.)*(x_)))/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[(F^(g*(e - c*(f/d)))/d)*ExpInteg
ralEi[f*g*(c + d*x)*(Log[F]/d)], x] /; FreeQ[{F, c, d, e, f, g}, x] &&  !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 2230

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

Rule 6874

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

Rubi steps

\begin {gather*} \begin {aligned} \text {integral} &=\int \frac {e^{-x} \left (-2-2 x-2 e^x x^2+\left (-1+e^5\right ) x^2\right )}{2 x^2} \, dx\\ &=\frac {1}{2} \int \frac {e^{-x} \left (-2-2 x-2 e^x x^2+\left (-1+e^5\right ) x^2\right )}{x^2} \, dx\\ &=\frac {1}{2} \int \left (-2+\frac {e^{-x} \left (-2-2 x-\left (1-e^5\right ) x^2\right )}{x^2}\right ) \, dx\\ &=-x+\frac {1}{2} \int \frac {e^{-x} \left (-2-2 x-\left (1-e^5\right ) x^2\right )}{x^2} \, dx\\ &=-x+\frac {1}{2} \int \left (e^{-x} \left (-1+e^5\right )-\frac {2 e^{-x}}{x^2}-\frac {2 e^{-x}}{x}\right ) \, dx\\ &=-x+\frac {1}{2} \left (-1+e^5\right ) \int e^{-x} \, dx-\int \frac {e^{-x}}{x^2} \, dx-\int \frac {e^{-x}}{x} \, dx\\ &=\frac {1}{2} e^{-x} \left (1-e^5\right )+\frac {e^{-x}}{x}-x-\text {Ei}(-x)+\int \frac {e^{-x}}{x} \, dx\\ &=\frac {1}{2} e^{-x} \left (1-e^5\right )+\frac {e^{-x}}{x}-x\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.38, size = 31, normalized size = 1.03 \begin {gather*} \frac {1}{2} \left (-2 x-\frac {e^{-x} \left (-2 x+\left (-1+e^5\right ) x^2\right )}{x^2}\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.25, size = 45, normalized size = 1.50

method result size
risch \(-x -\frac {\left (x \,{\mathrm e}^{5}-x -2\right ) {\mathrm e}^{-x}}{2 x}\) \(23\)
norman \(\frac {\left (2+\left (1-{\mathrm e}^{5}\right ) x -x^{2} {\mathrm e}^{\ln \left (2\right )+x}\right ) {\mathrm e}^{-x}}{2 x}\) \(32\)
derivativedivides \(-{\mathrm e}^{5} {\mathrm e}^{-x -\ln \left (2\right )}-\ln \left (2\right )-x +\frac {2 \,{\mathrm e}^{-x -\ln \left (2\right )}}{x}+{\mathrm e}^{-x -\ln \left (2\right )}\) \(45\)
default \(-{\mathrm e}^{5} {\mathrm e}^{-x -\ln \left (2\right )}-\ln \left (2\right )-x +\frac {2 \,{\mathrm e}^{-x -\ln \left (2\right )}}{x}+{\mathrm e}^{-x -\ln \left (2\right )}\) \(45\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-x^2*exp(ln(2)+x)+x^2*exp(5)-x^2-2*x-2)/x^2/exp(ln(2)+x),x,method=_RETURNVERBOSE)

[Out]

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

________________________________________________________________________________________

Maxima [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.28, size = 27, normalized size = 0.90 \begin {gather*} -x - {\rm Ei}\left (-x\right ) + \frac {1}{2} \, e^{\left (-x\right )} - \frac {1}{2} \, e^{\left (-x + 5\right )} + \Gamma \left (-1, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x - Ei(-x) + 1/2*e^(-x) - 1/2*e^(-x + 5) + gamma(-1, x)

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 32, normalized size = 1.07 \begin {gather*} -\frac {{\left (x^{2} e^{\left (x + \log \left (2\right )\right )} + x e^{5} - x - 2\right )} e^{\left (-x - \log \left (2\right )\right )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.04, size = 15, normalized size = 0.50 \begin {gather*} - x + \frac {\left (- x e^{5} + x + 2\right ) e^{- x}}{2 x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((-x**2*exp(ln(2)+x)+x**2*exp(5)-x**2-2*x-2)/x**2/exp(ln(2)+x),x)

[Out]

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

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 87 vs. \(2 (30) = 60\).
time = 0.38, size = 87, normalized size = 2.90 \begin {gather*} -\frac {{\left (x + \log \left (2\right )\right )}^{2} + {\left (x + \log \left (2\right )\right )} e^{\left (-x - \log \left (2\right ) + 5\right )} - {\left (x + \log \left (2\right )\right )} e^{\left (-x - \log \left (2\right )\right )} - {\left (x + \log \left (2\right )\right )} \log \left (2\right ) - e^{\left (-x - \log \left (2\right ) + 5\right )} \log \left (2\right ) + e^{\left (-x - \log \left (2\right )\right )} \log \left (2\right ) - 2 \, e^{\left (-x - \log \left (2\right )\right )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 1.19, size = 24, normalized size = 0.80 \begin {gather*} \frac {{\mathrm {e}}^{-x}}{x}-x-{\mathrm {e}}^{-x}\,\left (\frac {{\mathrm {e}}^5}{2}-\frac {1}{2}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(exp(- x - log(2))*(2*x - x^2*exp(5) + x^2 + x^2*exp(x + log(2)) + 2))/x^2,x)

[Out]

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

________________________________________________________________________________________