\(\int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx\) [5218]

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

[Out]

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

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.83, number of steps used = 8, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {14, 2228, 2341} \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=4 x+\frac {4 e^x}{x}+\frac {8}{x}-\frac {4 \log (x)}{x} \]

[In]

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

[Out]

8/x + (4*E^x)/x + 4*x - (4*Log[x])/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
]

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

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

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.59 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=\frac {4 \left (2+e^x+x^2-\log (x)\right )}{x} \]

[In]

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

[Out]

(4*(2 + E^x + x^2 - Log[x]))/x

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.69

method result size
norman \(\frac {8+4 x^{2}+4 \,{\mathrm e}^{x}-4 \ln \left (x \right )}{x}\) \(20\)
parallelrisch \(\frac {8+4 x^{2}+4 \,{\mathrm e}^{x}-4 \ln \left (x \right )}{x}\) \(20\)
risch \(-\frac {4 \ln \left (x \right )}{x}+\frac {4 x^{2}+4 \,{\mathrm e}^{x}+8}{x}\) \(21\)
default \(4 x +\frac {8}{x}-\frac {4 \ln \left (x \right )}{x}+\frac {4 \,{\mathrm e}^{x}}{x}\) \(24\)
parts \(4 x +\frac {8}{x}-\frac {4 \ln \left (x \right )}{x}+\frac {4 \,{\mathrm e}^{x}}{x}\) \(24\)

[In]

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

[Out]

(8+4*x^2+4*exp(x)-4*ln(x))/x

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.55 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=\frac {4 \, {\left (x^{2} + e^{x} - \log \left (x\right ) + 2\right )}}{x} \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.66 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=4 x + \frac {4 e^{x}}{x} - \frac {4 \log {\left (x \right )}}{x} + \frac {8}{x} \]

[In]

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

[Out]

4*x + 4*exp(x)/x - 4*log(x)/x + 8/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 = 27, normalized size of antiderivative = 0.93 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=4 \, x - \frac {4 \, \log \left (x\right )}{x} + \frac {8}{x} + 4 \, {\rm Ei}\left (x\right ) - 4 \, \Gamma \left (-1, -x\right ) \]

[In]

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

[Out]

4*x - 4*log(x)/x + 8/x + 4*Ei(x) - 4*gamma(-1, -x)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.55 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=\frac {4 \, {\left (x^{2} + e^{x} - \log \left (x\right ) + 2\right )}}{x} \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 12.14 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.55 \[ \int \frac {-12+4 x^2+e^x (-4+4 x)+4 \log (x)}{x^2} \, dx=\frac {4\,\left ({\mathrm {e}}^x-\ln \left (x\right )+x^2+2\right )}{x} \]

[In]

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

[Out]

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