3.325 \(\int \frac{2+5 x+3 x^2+2 x^3}{1+x+x^2} \, dx\)

Optimal. Leaf size=12 \[ x^2+\log \left (x^2+x+1\right )+x \]

[Out]

x + x^2 + Log[1 + x + x^2]

________________________________________________________________________________________

Rubi [A]  time = 0.0162013, antiderivative size = 12, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 24, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.083, Rules used = {1657, 628} \[ x^2+\log \left (x^2+x+1\right )+x \]

Antiderivative was successfully verified.

[In]

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

[Out]

x + x^2 + Log[1 + x + x^2]

Rule 1657

Int[(Pq_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[Pq*(a + b*x + c*x^2)^p, x
], x] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

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

Mathematica [A]  time = 0.0053581, size = 12, normalized size = 1. \[ x^2+\log \left (x^2+x+1\right )+x \]

Antiderivative was successfully verified.

[In]

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

[Out]

x + x^2 + Log[1 + x + x^2]

________________________________________________________________________________________

Maple [A]  time = 0.001, size = 13, normalized size = 1.1 \begin{align*} x+{x}^{2}+\ln \left ({x}^{2}+x+1 \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x+x^2+ln(x^2+x+1)

________________________________________________________________________________________

Maxima [A]  time = 1.04541, size = 16, normalized size = 1.33 \begin{align*} x^{2} + x + \log \left (x^{2} + x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x^2 + x + log(x^2 + x + 1)

________________________________________________________________________________________

Fricas [A]  time = 1.52452, size = 38, normalized size = 3.17 \begin{align*} x^{2} + x + \log \left (x^{2} + x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x^2 + x + log(x^2 + x + 1)

________________________________________________________________________________________

Sympy [A]  time = 0.079665, size = 12, normalized size = 1. \begin{align*} x^{2} + x + \log{\left (x^{2} + x + 1 \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2*x**3+3*x**2+5*x+2)/(x**2+x+1),x)

[Out]

x**2 + x + log(x**2 + x + 1)

________________________________________________________________________________________

Giac [A]  time = 1.12055, size = 16, normalized size = 1.33 \begin{align*} x^{2} + x + \log \left (x^{2} + x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x^2 + x + log(x^2 + x + 1)