\(\int \frac {e^{-x} (4 x^2-8 x^3+2 x^4+e^2 (3+3 x+3 x^4-x^5))}{x^2} \, dx\) [1542]

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

Optimal result

Integrand size = 44, antiderivative size = 27 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=e^{-x} \left (-x (-4+2 x)+\frac {e^2 \left (-3+x^4\right )}{x}\right ) \]

[Out]

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

Rubi [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(116\) vs. \(2(27)=54\).

Time = 0.11 (sec) , antiderivative size = 116, normalized size of antiderivative = 4.30, number of steps used = 15, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.114, Rules used = {2230, 2225, 2208, 2209, 2207} \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=e^{2-x} x^3+3 e^{2-x} x^2-\left (2+3 e^2\right ) e^{-x} x^2+6 e^{2-x} x+8 e^{-x} x-2 \left (2+3 e^2\right ) e^{-x} x+6 e^{2-x}+4 e^{-x}-2 \left (2+3 e^2\right ) e^{-x}-\frac {3 e^{2-x}}{x} \]

[In]

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

[Out]

6*E^(2 - x) + 4/E^x - (2*(2 + 3*E^2))/E^x - (3*E^(2 - x))/x + 6*E^(2 - x)*x + (8*x)/E^x - (2*(2 + 3*E^2)*x)/E^
x + 3*E^(2 - x)*x^2 - ((2 + 3*E^2)*x^2)/E^x + E^(2 - x)*x^3

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 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]

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

Mathematica [A] (verified)

Time = 1.29 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=\frac {e^{-x} \left (-2 (-2+x) x^2+e^2 \left (-3+x^4\right )\right )}{x} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.11

method result size
gosper \(\frac {\left (x^{4} {\mathrm e}^{2}-2 x^{3}+4 x^{2}-3 \,{\mathrm e}^{2}\right ) {\mathrm e}^{-x}}{x}\) \(30\)
norman \(\frac {\left (x^{4} {\mathrm e}^{2}-2 x^{3}+4 x^{2}-3 \,{\mathrm e}^{2}\right ) {\mathrm e}^{-x}}{x}\) \(30\)
risch \(\frac {\left (x^{4} {\mathrm e}^{2}-2 x^{3}+4 x^{2}-3 \,{\mathrm e}^{2}\right ) {\mathrm e}^{-x}}{x}\) \(30\)
parallelrisch \(\frac {\left (x^{4} {\mathrm e}^{2}-2 x^{3}+4 x^{2}-3 \,{\mathrm e}^{2}\right ) {\mathrm e}^{-x}}{x}\) \(30\)
default \(4 x \,{\mathrm e}^{-x}-2 x^{2} {\mathrm e}^{-x}+3 \,{\mathrm e}^{2} \left (-\frac {{\mathrm e}^{-x}}{x}+\operatorname {Ei}_{1}\left (x \right )\right )-3 \,{\mathrm e}^{2} \operatorname {Ei}_{1}\left (x \right )+3 \,{\mathrm e}^{2} \left (-x^{2} {\mathrm e}^{-x}-2 x \,{\mathrm e}^{-x}-2 \,{\mathrm e}^{-x}\right )-{\mathrm e}^{2} \left (-x^{3} {\mathrm e}^{-x}-3 x^{2} {\mathrm e}^{-x}-6 x \,{\mathrm e}^{-x}-6 \,{\mathrm e}^{-x}\right )\) \(105\)
meijerg \(-4+4 \left (2+2 x \right ) {\mathrm e}^{-x}-4 \,{\mathrm e}^{-x}-{\mathrm e}^{2} \left (6-\frac {\left (4 x^{3}+12 x^{2}+24 x +24\right ) {\mathrm e}^{-x}}{4}\right )+\left (3 \,{\mathrm e}^{2}+2\right ) \left (2-\frac {\left (3 x^{2}+6 x +6\right ) {\mathrm e}^{-x}}{3}\right )-3 \,{\mathrm e}^{2} \operatorname {Ei}_{1}\left (x \right )+3 \,{\mathrm e}^{2} \left (-\frac {1}{x}+1+\frac {2-2 x}{2 x}-\frac {{\mathrm e}^{-x}}{x}+\operatorname {Ei}_{1}\left (x \right )\right )\) \(112\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.07 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=-\frac {{\left (2 \, x^{3} - 4 \, x^{2} - {\left (x^{4} - 3\right )} e^{2}\right )} e^{\left (-x\right )}}{x} \]

[In]

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

[Out]

-(2*x^3 - 4*x^2 - (x^4 - 3)*e^2)*e^(-x)/x

Sympy [A] (verification not implemented)

Time = 0.06 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.96 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=\frac {\left (x^{4} e^{2} - 2 x^{3} + 4 x^{2} - 3 e^{2}\right ) e^{- x}}{x} \]

[In]

integrate(((-x**5+3*x**4+3*x+3)*exp(2)+2*x**4-8*x**3+4*x**2)/exp(x)/x**2,x)

[Out]

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

Maxima [C] (verification not implemented)

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

Time = 0.22 (sec) , antiderivative size = 95, normalized size of antiderivative = 3.52 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=3 \, {\rm Ei}\left (-x\right ) e^{2} + {\left (x^{3} e^{2} + 3 \, x^{2} e^{2} + 6 \, x e^{2} + 6 \, e^{2}\right )} e^{\left (-x\right )} - 3 \, {\left (x^{2} e^{2} + 2 \, x e^{2} + 2 \, e^{2}\right )} e^{\left (-x\right )} - 2 \, {\left (x^{2} + 2 \, x + 2\right )} e^{\left (-x\right )} + 8 \, {\left (x + 1\right )} e^{\left (-x\right )} - 3 \, e^{2} \Gamma \left (-1, x\right ) - 4 \, e^{\left (-x\right )} \]

[In]

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

[Out]

3*Ei(-x)*e^2 + (x^3*e^2 + 3*x^2*e^2 + 6*x*e^2 + 6*e^2)*e^(-x) - 3*(x^2*e^2 + 2*x*e^2 + 2*e^2)*e^(-x) - 2*(x^2
+ 2*x + 2)*e^(-x) + 8*(x + 1)*e^(-x) - 3*e^2*gamma(-1, x) - 4*e^(-x)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.52 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=\frac {x^{4} e^{\left (-x + 2\right )} - 2 \, x^{3} e^{\left (-x\right )} + 4 \, x^{2} e^{\left (-x\right )} - 3 \, e^{\left (-x + 2\right )}}{x} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.15 \[ \int \frac {e^{-x} \left (4 x^2-8 x^3+2 x^4+e^2 \left (3+3 x+3 x^4-x^5\right )\right )}{x^2} \, dx=-\frac {{\mathrm {e}}^{-x}\,\left (-{\mathrm {e}}^2\,x^4+2\,x^3-4\,x^2+3\,{\mathrm {e}}^2\right )}{x} \]

[In]

int((exp(-x)*(exp(2)*(3*x + 3*x^4 - x^5 + 3) + 4*x^2 - 8*x^3 + 2*x^4))/x^2,x)

[Out]

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