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

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 57, antiderivative size = 22 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=\left (x+e^x x\right )^2-\left (4+\log \left (\frac {x}{3}\right )\right )^2 \]

[Out]

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

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.68, number of steps used = 21, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {14, 2227, 2207, 2225, 2338} \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=2 e^x x^2+e^{2 x} x^2+x^2-\log ^2(x)-2 (4-\log (3)) \log (x) \]

[In]

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

[Out]

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

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 2207

Int[((b_.)*(F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(c + d*x)^m*
((b*F^(g*(e + f*x)))^n/(f*g*n*Log[F])), x] - Dist[d*(m/(f*g*n*Log[F])), 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] && GtQ[m, 0] && IntegerQ[2*m] &&  !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 2227

Int[(F_)^((c_.)*(v_))*(u_), x_Symbol] :> Int[ExpandIntegrand[F^(c*ExpandToSum[v, x]), u, x], x] /; FreeQ[{F, c
}, x] && PolynomialQ[u, x] && LinearQ[v, x] &&  !TrueQ[$UseGamma]

Rule 2338

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))/(x_), x_Symbol] :> Simp[(a + b*Log[c*x^n])^2/(2*b*n), x] /; FreeQ[{a
, b, c, n}, x]

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

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.41 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=-16+\left (1+e^x\right )^2 x^2-8 \log \left (\frac {x}{3}\right )-\log ^2\left (\frac {x}{3}\right ) \]

[In]

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

[Out]

-16 + (1 + E^x)^2*x^2 - 8*Log[x/3] - Log[x/3]^2

Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.64

method result size
risch \(-\ln \left (x \right )^{2}+x^{2}+2 \ln \left (3\right ) \ln \left (x \right )-8 \ln \left (x \right )+{\mathrm e}^{2 x} x^{2}+2 \,{\mathrm e}^{x} x^{2}\) \(36\)
default \(x^{2}-8 \ln \left (x \right )-\ln \left (\frac {x}{3}\right )^{2}+2 \,{\mathrm e}^{x} x^{2}+{\mathrm e}^{2 x} x^{2}\) \(37\)
parts \(x^{2}-8 \ln \left (x \right )-\ln \left (\frac {x}{3}\right )^{2}+2 \,{\mathrm e}^{x} x^{2}+{\mathrm e}^{2 x} x^{2}\) \(37\)
parallelrisch \({\mathrm e}^{2 x} x^{2}+2 x^{3} {\mathrm e}^{x -\ln \left (x \right )}-\ln \left (\frac {x}{3}\right )^{2}-8 \ln \left (x \right )+x^{2}\) \(42\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 55 vs. \(2 (26) = 52\).

Time = 0.25 (sec) , antiderivative size = 55, normalized size of antiderivative = 2.50 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=x^{4} e^{\left (2 \, x - 2 \, \log \left (3\right ) - 2 \, \log \left (\frac {1}{3} \, x\right )\right )} + 2 \, x^{3} e^{\left (x - \log \left (3\right ) - \log \left (\frac {1}{3} \, x\right )\right )} + x^{2} - \log \left (\frac {1}{3} \, x\right )^{2} - 8 \, \log \left (\frac {1}{3} \, x\right ) \]

[In]

integrate(((2*x^5+2*x^4)*exp(x-log(x))^2+(2*x^4+4*x^3)*exp(x-log(x))-2*log(1/3*x)+2*x^2-8)/x,x, algorithm="fri
cas")

[Out]

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 31 vs. \(2 (15) = 30\).

Time = 0.14 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.41 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=x^{2} e^{2 x} + 2 x^{2} e^{x} + x^{2} - \log {\left (\frac {x}{3} \right )}^{2} - 8 \log {\left (x \right )} \]

[In]

integrate(((2*x**5+2*x**4)*exp(x-ln(x))**2+(2*x**4+4*x**3)*exp(x-ln(x))-2*ln(1/3*x)+2*x**2-8)/x,x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (26) = 52\).

Time = 0.19 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.82 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=x^{2} + \frac {1}{2} \, {\left (2 \, x^{2} - 2 \, x + 1\right )} e^{\left (2 \, x\right )} + \frac {1}{2} \, {\left (2 \, x - 1\right )} e^{\left (2 \, x\right )} + 2 \, {\left (x^{2} - 2 \, x + 2\right )} e^{x} + 4 \, {\left (x - 1\right )} e^{x} - \log \left (\frac {1}{3} \, x\right )^{2} - 8 \, \log \left (x\right ) \]

[In]

integrate(((2*x^5+2*x^4)*exp(x-log(x))^2+(2*x^4+4*x^3)*exp(x-log(x))-2*log(1/3*x)+2*x^2-8)/x,x, algorithm="max
ima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.59 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=x^{2} e^{\left (2 \, x\right )} + 2 \, x^{2} e^{x} + x^{2} + 2 \, \log \left (3\right ) \log \left (x\right ) - \log \left (x\right )^{2} - 8 \, \log \left (x\right ) \]

[In]

integrate(((2*x^5+2*x^4)*exp(x-log(x))^2+(2*x^4+4*x^3)*exp(x-log(x))-2*log(1/3*x)+2*x^2-8)/x,x, algorithm="gia
c")

[Out]

x^2*e^(2*x) + 2*x^2*e^x + x^2 + 2*log(3)*log(x) - log(x)^2 - 8*log(x)

Mupad [B] (verification not implemented)

Time = 11.85 (sec) , antiderivative size = 34, normalized size of antiderivative = 1.55 \[ \int \frac {-8+2 x^2+\frac {e^x \left (4 x^3+2 x^4\right )}{x}+\frac {e^{2 x} \left (2 x^4+2 x^5\right )}{x^2}-2 \log \left (\frac {x}{3}\right )}{x} \, dx=2\,x^2\,{\mathrm {e}}^x-8\,\ln \left (x\right )-{\left (\ln \left (3\right )-\ln \left (x\right )\right )}^2+x^2\,{\mathrm {e}}^{2\,x}+x^2 \]

[In]

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

[Out]

2*x^2*exp(x) - 8*log(x) - (log(3) - log(x))^2 + x^2*exp(2*x) + x^2