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

Optimal. Leaf size=29 \[ \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]
time = 0.06, antiderivative size = 24, normalized size of antiderivative = 0.83, number of steps used = 8, number of rules used = 3, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {14, 2228, 2341} \begin {gather*} 4 x+\frac {4 e^x}{x}+\frac {8}{x}-\frac {4 \log (x)}{x} \end {gather*}

Antiderivative was successfully verified.

[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 {gather*} \begin {aligned} \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 {aligned} \end {gather*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 17, normalized size = 0.59 \begin {gather*} \frac {4 \left (2+e^x+x^2-\log (x)\right )}{x} \end {gather*}

Antiderivative was successfully verified.

[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]
time = 0.20, size = 24, normalized size = 0.83

method result size
norman \(\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\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [C] Result contains higher order function than in optimal. Order 4 vs. order 3.
time = 0.29, size = 27, normalized size = 0.93 \begin {gather*} 4 \, x - \frac {4 \, \log \left (x\right )}{x} + \frac {8}{x} + 4 \, {\rm Ei}\left (x\right ) - 4 \, \Gamma \left (-1, -x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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)

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 16, normalized size = 0.55 \begin {gather*} \frac {4 \, {\left (x^{2} + e^{x} - \log \left (x\right ) + 2\right )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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]
time = 0.08, size = 19, normalized size = 0.66 \begin {gather*} 4 x + \frac {4 e^{x}}{x} - \frac {4 \log {\left (x \right )}}{x} + \frac {8}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________

Giac [A]
time = 0.40, size = 16, normalized size = 0.55 \begin {gather*} \frac {4 \, {\left (x^{2} + e^{x} - \log \left (x\right ) + 2\right )}}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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]
time = 3.69, size = 16, normalized size = 0.55 \begin {gather*} \frac {4\,\left ({\mathrm {e}}^x-\ln \left (x\right )+x^2+2\right )}{x} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[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

________________________________________________________________________________________