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

   Optimal result
   Rubi [A] (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 = 38, antiderivative size = 20 \[ \int \frac {e^{-x} \left (e^{3-x} (1+2 x)+e^x \left (x^2+e^4 x^2\right )\right )}{x^2} \, dx=6-\frac {e^{3-2 x}}{x}+x+e^4 x \]

[Out]

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

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {6820, 2228} \[ \int \frac {e^{-x} \left (e^{3-x} (1+2 x)+e^x \left (x^2+e^4 x^2\right )\right )}{x^2} \, dx=\left (1+e^4\right ) x-\frac {e^{3-2 x}}{x} \]

[In]

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

[Out]

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

Rule 2228

Int[(F_)^((c_.)*(v_))*(u_)^(m_.)*(w_), x_Symbol] :> With[{b = Coefficient[v, x, 1], d = Coefficient[u, x, 0],
e = Coefficient[u, x, 1], f = Coefficient[w, x, 0], g = Coefficient[w, x, 1]}, Simp[g*u^(m + 1)*(F^(c*v)/(b*c*
e*Log[F])), x] /; EqQ[e*g*(m + 1) - b*c*(e*f - d*g)*Log[F], 0]] /; FreeQ[{F, c, m}, x] && LinearQ[{u, v, w}, x
]

Rule 6820

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

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.90

method result size
risch \(x +x \,{\mathrm e}^{4}-\frac {{\mathrm e}^{3-2 x}}{x}\) \(18\)
norman \(\frac {\left (\left ({\mathrm e}^{4}+1\right ) x^{2} {\mathrm e}^{2 x}-{\mathrm e}^{3}\right ) {\mathrm e}^{-2 x}}{x}\) \(26\)
parallelrisch \(\frac {\left (x^{2} {\mathrm e}^{4} {\mathrm e}^{x}+{\mathrm e}^{x} x^{2}-{\mathrm e}^{-x +3}\right ) {\mathrm e}^{-x}}{x}\) \(32\)
default \(x +{\mathrm e}^{3} \left (-\frac {{\mathrm e}^{-2 x}}{x}+2 \,\operatorname {Ei}_{1}\left (2 x \right )\right )-2 \,{\mathrm e}^{3} \operatorname {Ei}_{1}\left (2 x \right )+x \,{\mathrm e}^{4}\) \(36\)
parts \(x +{\mathrm e}^{3} \left (-\frac {{\mathrm e}^{-2 x}}{x}+2 \,\operatorname {Ei}_{1}\left (2 x \right )\right )-2 \,{\mathrm e}^{3} \operatorname {Ei}_{1}\left (2 x \right )+x \,{\mathrm e}^{4}\) \(36\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.75 \[ \int \frac {e^{-x} \left (e^{3-x} (1+2 x)+e^x \left (x^2+e^4 x^2\right )\right )}{x^2} \, dx=x \left (1 + e^{4}\right ) - \frac {e^{3} e^{- 2 x}}{x} \]

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

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

Time = 0.24 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.15 \[ \int \frac {e^{-x} \left (e^{3-x} (1+2 x)+e^x \left (x^2+e^4 x^2\right )\right )}{x^2} \, dx=x e^{4} + 2 \, {\rm Ei}\left (-2 \, x\right ) e^{3} - 2 \, e^{3} \Gamma \left (-1, 2 \, x\right ) + x \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 14.44 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.90 \[ \int \frac {e^{-x} \left (e^{3-x} (1+2 x)+e^x \left (x^2+e^4 x^2\right )\right )}{x^2} \, dx=x\,\left ({\mathrm {e}}^4+1\right )-\frac {{\mathrm {e}}^{3-2\,x}}{x} \]

[In]

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

[Out]

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