3.448 \(\int \frac{2+x^2}{2+x} \, dx\)

Optimal. Leaf size=17 \[ \frac{x^2}{2}-2 x+6 \log (x+2) \]

[Out]

-2*x + x^2/2 + 6*Log[2 + x]

________________________________________________________________________________________

Rubi [A]  time = 0.0082738, antiderivative size = 17, 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 = {697} \[ \frac{x^2}{2}-2 x+6 \log (x+2) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-2*x + x^2/2 + 6*Log[2 + x]

Rule 697

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

Rubi steps

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

Mathematica [A]  time = 0.0034374, size = 18, normalized size = 1.06 \[ \frac{x^2}{2}-2 x+6 \log (x+2)-6 \]

Antiderivative was successfully verified.

[In]

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

[Out]

-6 - 2*x + x^2/2 + 6*Log[2 + x]

________________________________________________________________________________________

Maple [A]  time = 0.002, size = 16, normalized size = 0.9 \begin{align*} -2\,x+{\frac{{x}^{2}}{2}}+6\,\ln \left ( 2+x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-2*x+1/2*x^2+6*ln(2+x)

________________________________________________________________________________________

Maxima [A]  time = 0.968912, size = 20, normalized size = 1.18 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x + 6 \, \log \left (x + 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 0.964359, size = 41, normalized size = 2.41 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x + 6 \, \log \left (x + 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 0.070396, size = 14, normalized size = 0.82 \begin{align*} \frac{x^{2}}{2} - 2 x + 6 \log{\left (x + 2 \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x**2/2 - 2*x + 6*log(x + 2)

________________________________________________________________________________________

Giac [A]  time = 1.13121, size = 22, normalized size = 1.29 \begin{align*} \frac{1}{2} \, x^{2} - 2 \, x + 6 \, \log \left ({\left | x + 2 \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*x^2 - 2*x + 6*log(abs(x + 2))