### 3.172 $$\int \frac{-4+3 x+x^2}{-8-2 x+x^2} \, dx$$

Optimal. Leaf size=14 $x+4 \log (4-x)+\log (x+2)$

[Out]

x + 4*Log[4 - x] + Log[2 + x]

________________________________________________________________________________________

Rubi [A]  time = 0.0165158, antiderivative size = 14, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 3, integrand size = 19, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.158, Rules used = {1657, 632, 31} $x+4 \log (4-x)+\log (x+2)$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

x + 4*Log[4 - x] + Log[2 + x]

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 632

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[
(c*d - e*(b/2 - q/2))/q, Int[1/(b/2 - q/2 + c*x), x], x] - Dist[(c*d - e*(b/2 + q/2))/q, Int[1/(b/2 + q/2 + c*
x), x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] && NiceSqrtQ[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{-4+3 x+x^2}{-8-2 x+x^2} \, dx &=\int \left (1+\frac{4+5 x}{-8-2 x+x^2}\right ) \, dx\\ &=x+\int \frac{4+5 x}{-8-2 x+x^2} \, dx\\ &=x+4 \int \frac{1}{-4+x} \, dx+\int \frac{1}{2+x} \, dx\\ &=x+4 \log (4-x)+\log (2+x)\\ \end{align*}

Mathematica [A]  time = 0.0051096, size = 14, normalized size = 1. $x+4 \log (4-x)+\log (x+2)$

Antiderivative was successfully veriﬁed.

[In]

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

[Out]

x + 4*Log[4 - x] + Log[2 + x]

________________________________________________________________________________________

Maple [A]  time = 0.049, size = 13, normalized size = 0.9 \begin{align*} x+\ln \left ( 2+x \right ) +4\,\ln \left ( x-4 \right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x+ln(2+x)+4*ln(x-4)

________________________________________________________________________________________

Maxima [A]  time = 0.990675, size = 16, normalized size = 1.14 \begin{align*} x + \log \left (x + 2\right ) + 4 \, \log \left (x - 4\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + log(x + 2) + 4*log(x - 4)

________________________________________________________________________________________

Fricas [A]  time = 1.61126, size = 42, normalized size = 3. \begin{align*} x + \log \left (x + 2\right ) + 4 \, \log \left (x - 4\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + log(x + 2) + 4*log(x - 4)

________________________________________________________________________________________

Sympy [A]  time = 0.097405, size = 12, normalized size = 0.86 \begin{align*} x + 4 \log{\left (x - 4 \right )} + \log{\left (x + 2 \right )} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((x**2+3*x-4)/(x**2-2*x-8),x)

[Out]

x + 4*log(x - 4) + log(x + 2)

________________________________________________________________________________________

Giac [A]  time = 1.24607, size = 19, normalized size = 1.36 \begin{align*} x + \log \left ({\left | x + 2 \right |}\right ) + 4 \, \log \left ({\left | x - 4 \right |}\right ) \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x + log(abs(x + 2)) + 4*log(abs(x - 4))