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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0083317, 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}-x+2 \log (x+1) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x + x^2/2 + 2*Log[1 + 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{1+x^2}{1+x} \, dx &=\int \left (-1+x+\frac{2}{1+x}\right ) \, dx\\ &=-x+\frac{x^2}{2}+2 \log (1+x)\\ \end{align*}

Mathematica [A]  time = 0.0027629, size = 18, normalized size = 1.06 \[ \frac{1}{2} \left (x^2-2 x+4 \log (x+1)-3\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(-3 - 2*x + x^2 + 4*Log[1 + x])/2

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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