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

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

[Out]

(6+exp(x)-exp(2*x-ln(2))-4*x)/x

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.19, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.074, Rules used = {14, 2228} \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=\frac {e^x}{x}-\frac {e^{2 x}}{2 x}+\frac {6}{x} \]

[In]

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

[Out]

6/x + E^x/x - E^(2*x)/(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 {6}{x^2}+\frac {e^x (-1+x)}{x^2}-\frac {e^{2 x} (-1+2 x)}{2 x^2}\right ) \, dx \\ & = \frac {6}{x}-\frac {1}{2} \int \frac {e^{2 x} (-1+2 x)}{x^2} \, dx+\int \frac {e^x (-1+x)}{x^2} \, dx \\ & = \frac {6}{x}+\frac {e^x}{x}-\frac {e^{2 x}}{2 x} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.00 \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=\frac {12+2 e^x-e^{2 x}}{2 x} \]

[In]

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

[Out]

(12 + 2*E^x - E^(2*x))/(2*x)

Maple [A] (verified)

Time = 0.07 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.71

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

[In]

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

[Out]

(6-1/2*exp(x)^2+exp(x))/x

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.71 \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=-\frac {e^{\left (2 \, x\right )} - 2 \, e^{x} - 12}{2 \, x} \]

[In]

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

[Out]

-1/2*(e^(2*x) - 2*e^x - 12)/x

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [C] (verification not implemented)

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

Time = 0.25 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.24 \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=\frac {6}{x} - {\rm Ei}\left (2 \, x\right ) + {\rm Ei}\left (x\right ) - \Gamma \left (-1, -x\right ) + \Gamma \left (-1, -2 \, x\right ) \]

[In]

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

[Out]

6/x - Ei(2*x) + Ei(x) - gamma(-1, -x) + gamma(-1, -2*x)

Giac [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.71 \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=-\frac {e^{\left (2 \, x\right )} - 2 \, e^{x} - 12}{2 \, x} \]

[In]

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

[Out]

-1/2*(e^(2*x) - 2*e^x - 12)/x

Mupad [B] (verification not implemented)

Time = 8.96 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.81 \[ \int \frac {-6+\frac {1}{2} e^{2 x} (1-2 x)+e^x (-1+x)}{x^2} \, dx=\frac {2\,{\mathrm {e}}^x-{\mathrm {e}}^{2\,x}+12}{2\,x} \]

[In]

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

[Out]

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