\(\int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx\) [396]

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

Optimal result

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

[Out]

ln(5*x*exp(ln(3*x)^2/x^2))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.81, number of steps used = 5, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {14, 2341, 2342} \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\frac {\log ^2(3 x)}{x^2}+\log (x) \]

[In]

Int[(x^2 + 2*Log[3*x] - 2*Log[3*x]^2)/x^3,x]

[Out]

Log[x] + Log[3*x]^2/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 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
]

Rule 2342

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

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.81 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\log (x)+\frac {\log ^2(3 x)}{x^2} \]

[In]

Integrate[(x^2 + 2*Log[3*x] - 2*Log[3*x]^2)/x^3,x]

[Out]

Log[x] + Log[3*x]^2/x^2

Maple [A] (verified)

Time = 0.02 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.88

method result size
risch \(\frac {\ln \left (3 x \right )^{2}}{x^{2}}+\ln \left (x \right )\) \(14\)
parts \(\frac {\ln \left (3 x \right )^{2}}{x^{2}}+\ln \left (x \right )\) \(14\)
derivativedivides \(\frac {\ln \left (3 x \right )^{2}}{x^{2}}+\ln \left (3 x \right )\) \(16\)
default \(\frac {\ln \left (3 x \right )^{2}}{x^{2}}+\ln \left (3 x \right )\) \(16\)
norman \(\frac {\ln \left (3 x \right )^{2}+x^{2} \ln \left (3 x \right )}{x^{2}}\) \(20\)
parallelrisch \(\frac {\ln \left (3 x \right )^{2}+x^{2} \ln \left (3 x \right )}{x^{2}}\) \(20\)

[In]

int((-2*ln(3*x)^2+2*ln(3*x)+x^2)/x^3,x,method=_RETURNVERBOSE)

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.19 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\frac {x^{2} \log \left (3 \, x\right ) + \log \left (3 \, x\right )^{2}}{x^{2}} \]

[In]

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

[Out]

(x^2*log(3*x) + log(3*x)^2)/x^2

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.75 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\log {\left (x \right )} + \frac {\log {\left (3 x \right )}^{2}}{x^{2}} \]

[In]

integrate((-2*ln(3*x)**2+2*ln(3*x)+x**2)/x**3,x)

[Out]

log(x) + log(3*x)**2/x**2

Maxima [B] (verification not implemented)

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

Time = 0.21 (sec) , antiderivative size = 38, normalized size of antiderivative = 2.38 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\frac {2 \, \log \left (3 \, x\right )^{2} + 2 \, \log \left (3 \, x\right ) + 1}{2 \, x^{2}} - \frac {\log \left (3 \, x\right )}{x^{2}} - \frac {1}{2 \, x^{2}} + \log \left (x\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.81 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\frac {\log \left (3 \, x\right )^{2}}{x^{2}} + \log \left (x\right ) \]

[In]

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

[Out]

log(3*x)^2/x^2 + log(x)

Mupad [B] (verification not implemented)

Time = 7.36 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.81 \[ \int \frac {x^2+2 \log (3 x)-2 \log ^2(3 x)}{x^3} \, dx=\ln \left (x\right )+\frac {{\ln \left (3\,x\right )}^2}{x^2} \]

[In]

int((2*log(3*x) - 2*log(3*x)^2 + x^2)/x^3,x)

[Out]

log(x) + log(3*x)^2/x^2