3.1.28 \(\int \frac {1+x^2}{1+x} \, dx\) [28]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 17, normalized size of antiderivative = 1.00, 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 = {711} \begin {gather*} \frac {x^2}{2}-x+2 \log (x+1) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 711

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 {gather*} \begin {aligned} \text {Integral} &=\int \left (-1+x+\frac {2}{1+x}\right ) \, dx\\ &=-x+\frac {x^2}{2}+2 \log (1+x)\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

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

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.06, size = 16, normalized size = 0.94

method result size
default \(-x +\frac {x^{2}}{2}+2 \ln \left (x +1\right )\) \(16\)
norman \(-x +\frac {x^{2}}{2}+2 \ln \left (x +1\right )\) \(16\)
meijerg \(-\frac {x \left (-3 x +6\right )}{6}+2 \ln \left (x +1\right )\) \(16\)
risch \(-x +\frac {x^{2}}{2}+2 \ln \left (x +1\right )\) \(16\)
parallelrisch \(-x +\frac {x^{2}}{2}+2 \ln \left (x +1\right )\) \(16\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2+1)/(x+1),x,method=_RETURNVERBOSE)

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.33, size = 15, normalized size = 0.88 \begin {gather*} \frac {1}{2} \, x^{2} - x + 2 \, \log \left (x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.56, size = 15, normalized size = 0.88 \begin {gather*} \frac {1}{2} \, x^{2} - x + 2 \, \log \left (x + 1\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.43, size = 16, normalized size = 0.94 \begin {gather*} \frac {1}{2} \, x^{2} - x + 2 \, \log \left ({\left | x + 1 \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.03, size = 15, normalized size = 0.88 \begin {gather*} 2\,\ln \left (x+1\right )-x+\frac {x^2}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Chatgpt [A] valid for real x
time = 1.00, size = 15, normalized size = 0.88 \begin {gather*} \frac {x^{2}}{2}-x +2 \ln \left (x +1\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________