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

   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 = 32, antiderivative size = 14 \[ \int \frac {-2+2 x+x^2+\left (1+2 x+x^2\right ) \log (3 x)}{1+2 x+x^2} \, dx=\frac {3}{1+x}+x \log (3 x) \]

[Out]

3/(1+x)+x*ln(3*x)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {27, 6874, 697, 2332} \[ \int \frac {-2+2 x+x^2+\left (1+2 x+x^2\right ) \log (3 x)}{1+2 x+x^2} \, dx=\frac {3}{x+1}+x \log (3 x) \]

[In]

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

[Out]

3/(1 + x) + x*Log[3*x]

Rule 27

Int[(u_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[u*Cancel[(b/2 + c*x)^(2*p)/c^p], x] /; Fr
eeQ[{a, b, c}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[p]

Rule 697

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d +
 e*x)^m*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && EqQ[2*c*d - b*e,
 0] && IGtQ[p, 0] &&  !(EqQ[m, 3] && NeQ[p, 1])

Rule 2332

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

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

Mathematica [A] (verified)

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

[In]

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

[Out]

3/(1 + x) + x*Log[3*x]

Maple [A] (verified)

Time = 1.72 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.07

method result size
risch \(\frac {3}{1+x}+x \ln \left (3 x \right )\) \(15\)
parts \(\frac {3}{1+x}+x \ln \left (3 x \right )\) \(15\)
derivativedivides \(\frac {9}{3 x +3}+x \ln \left (3 x \right )\) \(17\)
default \(\frac {9}{3 x +3}+x \ln \left (3 x \right )\) \(17\)
norman \(\frac {x \ln \left (3 x \right )+x^{2} \ln \left (3 x \right )+3}{1+x}\) \(23\)
parallelrisch \(\frac {x \ln \left (3 x \right )+x^{2} \ln \left (3 x \right )+3}{1+x}\) \(23\)

[In]

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

[Out]

3/(1+x)+x*ln(3*x)

Fricas [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

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

[In]

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

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 51 vs. \(2 (14) = 28\).

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

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

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

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

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

[In]

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

[Out]

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