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

   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 = 42, antiderivative size = 20 \[ \int \frac {-12+2 x^3+e^x \left (-8 x+8 x^2+2 x^3+e^4 \left (-2 x+2 x^2\right )\right )}{x^3} \, dx=\frac {2 \left (3+x \left (4+e^4+x\right ) \left (e^x+x\right )\right )}{x^2} \]

[Out]

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

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.35, number of steps used = 10, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.119, Rules used = {14, 2230, 2225, 2208, 2209} \[ \int \frac {-12+2 x^3+e^x \left (-8 x+8 x^2+2 x^3+e^4 \left (-2 x+2 x^2\right )\right )}{x^3} \, dx=\frac {6}{x^2}+2 x+2 e^x+\frac {2 \left (4+e^4\right ) e^x}{x} \]

[In]

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

[Out]

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

Mathematica [A] (verified)

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

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.05 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.10

method result size
risch \(2 x +\frac {6}{x^{2}}+\frac {2 \left (x +4+{\mathrm e}^{4}\right ) {\mathrm e}^{x}}{x}\) \(22\)
norman \(\frac {6+\left (2 \,{\mathrm e}^{4}+8\right ) x \,{\mathrm e}^{x}+2 x^{3}+2 \,{\mathrm e}^{x} x^{2}}{x^{2}}\) \(29\)
parallelrisch \(\frac {2 x \,{\mathrm e}^{4} {\mathrm e}^{x}+2 x^{3}+2 \,{\mathrm e}^{x} x^{2}+6+8 \,{\mathrm e}^{x} x}{x^{2}}\) \(31\)
default \(2 x +\frac {6}{x^{2}}+\frac {8 \,{\mathrm e}^{x}}{x}-2 \,{\mathrm e}^{4} \left (-\frac {{\mathrm e}^{x}}{x}-\operatorname {Ei}_{1}\left (-x \right )\right )-2 \,{\mathrm e}^{4} \operatorname {Ei}_{1}\left (-x \right )+2 \,{\mathrm e}^{x}\) \(49\)
parts \(2 x +\frac {6}{x^{2}}+\frac {8 \,{\mathrm e}^{x}}{x}-2 \,{\mathrm e}^{4} \left (-\frac {{\mathrm e}^{x}}{x}-\operatorname {Ei}_{1}\left (-x \right )\right )-2 \,{\mathrm e}^{4} \operatorname {Ei}_{1}\left (-x \right )+2 \,{\mathrm e}^{x}\) \(49\)

[In]

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

[Out]

2*x+6/x^2+2*(x+4+exp(4))/x*exp(x)

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

2*x + (2*x + 8 + 2*exp(4))*exp(x)/x + 6/x**2

Maxima [C] (verification not implemented)

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

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 8.40 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.20 \[ \int \frac {-12+2 x^3+e^x \left (-8 x+8 x^2+2 x^3+e^4 \left (-2 x+2 x^2\right )\right )}{x^3} \, dx=2\,x+2\,{\mathrm {e}}^x+\frac {x\,{\mathrm {e}}^x\,\left (2\,{\mathrm {e}}^4+8\right )+6}{x^2} \]

[In]

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

[Out]

2*x + 2*exp(x) + (x*exp(x)*(2*exp(4) + 8) + 6)/x^2