3.466 \(\int \frac{-4+x^2}{2+x} \, dx\)

Optimal. Leaf size=11 \[ \frac{x^2}{2}-2 x \]

[Out]

-2*x + x^2/2

________________________________________________________________________________________

Rubi [A]  time = 0.0037104, antiderivative size = 11, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 11, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.091, Rules used = {627} \[ \frac{x^2}{2}-2 x \]

Antiderivative was successfully verified.

[In]

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

[Out]

-2*x + x^2/2

Rule 627

Int[((d_) + (e_.)*(x_))^(m_.)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[(d + e*x)^(m + p)*(a/d + (c*x)/e)^
p, x] /; FreeQ[{a, c, d, e, m, p}, x] && EqQ[c*d^2 + a*e^2, 0] && (IntegerQ[p] || (GtQ[a, 0] && GtQ[d, 0] && I
ntegerQ[m + p]))

Rubi steps

\begin{align*} \int \frac{-4+x^2}{2+x} \, dx &=\int (-2+x) \, dx\\ &=-2 x+\frac{x^2}{2}\\ \end{align*}

Mathematica [A]  time = 0.0003356, size = 11, normalized size = 1. \[ \frac{x^2}{2}-2 x \]

Antiderivative was successfully verified.

[In]

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

[Out]

-2*x + x^2/2

________________________________________________________________________________________

Maple [A]  time = 0., size = 10, normalized size = 0.9 \begin{align*} -2\,x+{\frac{{x}^{2}}{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2-4)/(2+x),x)

[Out]

-2*x+1/2*x^2

________________________________________________________________________________________

Maxima [A]  time = 1.05379, size = 12, normalized size = 1.09 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*x^2 - 2*x

________________________________________________________________________________________

Fricas [A]  time = 1.13777, size = 20, normalized size = 1.82 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*x^2 - 2*x

________________________________________________________________________________________

Sympy [A]  time = 0.053813, size = 7, normalized size = 0.64 \begin{align*} \frac{x^{2}}{2} - 2 x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2/2 - 2*x

________________________________________________________________________________________

Giac [A]  time = 1.10592, size = 12, normalized size = 1.09 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*x^2 - 2*x