3.183 \(\int \frac{1-12 x+x^2+x^3}{-12+x+x^2} \, dx\)

Optimal. Leaf size=26 \[ \frac{x^2}{2}+\frac{1}{7} \log (3-x)-\frac{1}{7} \log (x+4) \]

[Out]

x^2/2 + Log[3 - x]/7 - Log[4 + x]/7

________________________________________________________________________________________

Rubi [A]  time = 0.0159258, antiderivative size = 26, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 3, integrand size = 20, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.15, Rules used = {1657, 616, 31} \[ \frac{x^2}{2}+\frac{1}{7} \log (3-x)-\frac{1}{7} \log (x+4) \]

Antiderivative was successfully verified.

[In]

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

[Out]

x^2/2 + Log[3 - x]/7 - Log[4 + x]/7

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 616

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

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

Mathematica [A]  time = 0.0050732, size = 26, normalized size = 1. \[ \frac{x^2}{2}+\frac{1}{7} \log (3-x)-\frac{1}{7} \log (x+4) \]

Antiderivative was successfully verified.

[In]

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

[Out]

x^2/2 + Log[3 - x]/7 - Log[4 + x]/7

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 19, normalized size = 0.7 \begin{align*}{\frac{{x}^{2}}{2}}-{\frac{\ln \left ( 4+x \right ) }{7}}+{\frac{\ln \left ( -3+x \right ) }{7}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 0.930975, size = 24, normalized size = 0.92 \begin{align*} \frac{1}{2} \, x^{2} - \frac{1}{7} \, \log \left (x + 4\right ) + \frac{1}{7} \, \log \left (x - 3\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.81161, size = 58, normalized size = 2.23 \begin{align*} \frac{1}{2} \, x^{2} - \frac{1}{7} \, \log \left (x + 4\right ) + \frac{1}{7} \, \log \left (x - 3\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.088192, size = 17, normalized size = 0.65 \begin{align*} \frac{x^{2}}{2} + \frac{\log{\left (x - 3 \right )}}{7} - \frac{\log{\left (x + 4 \right )}}{7} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2/2 + log(x - 3)/7 - log(x + 4)/7

________________________________________________________________________________________

Giac [A]  time = 1.05205, size = 27, normalized size = 1.04 \begin{align*} \frac{1}{2} \, x^{2} - \frac{1}{7} \, \log \left ({\left | x + 4 \right |}\right ) + \frac{1}{7} \, \log \left ({\left | x - 3 \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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