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

   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 = 16, antiderivative size = 19 \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=\frac {3-e^2+e^x-\frac {2 x}{3}}{x} \]

[Out]

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

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 19, 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.125, Rules used = {14, 2228} \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=\frac {e^x}{x}+\frac {3-e^2}{x} \]

[In]

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

[Out]

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

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

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
]

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

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.74 \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=\frac {3-e^2+e^x}{x} \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.33 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68

method result size
norman \(\frac {-{\mathrm e}^{2}+3+{\mathrm e}^{x}}{x}\) \(13\)
parallelrisch \(-\frac {{\mathrm e}^{2}-3-{\mathrm e}^{x}}{x}\) \(14\)
parts \(-\frac {{\mathrm e}^{2}-3}{x}+\frac {{\mathrm e}^{x}}{x}\) \(17\)
default \(-\frac {{\mathrm e}^{2}}{x}+\frac {3}{x}+\frac {{\mathrm e}^{x}}{x}\) \(20\)
risch \(-\frac {{\mathrm e}^{2}}{x}+\frac {3}{x}+\frac {{\mathrm e}^{x}}{x}\) \(20\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68 \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=-\frac {e^{2} - e^{x} - 3}{x} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

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

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68 \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=-\frac {e^{2} - e^{x} - 3}{x} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.07 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.63 \[ \int \frac {-3+e^2+e^x (-1+x)}{x^2} \, dx=\frac {{\mathrm {e}}^x-{\mathrm {e}}^2+3}{x} \]

[In]

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

[Out]

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