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

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 11, antiderivative size = 17 \[ \int \frac {1+x^2}{1+x} \, dx=-x+\frac {x^2}{2}+2 \log (1+x) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {711} \[ \int \frac {1+x^2}{1+x} \, dx=\frac {x^2}{2}-x+2 \log (x+1) \]

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

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.06 \[ \int \frac {1+x^2}{1+x} \, dx=\frac {1}{2} \left (-3-2 x+x^2+4 \log (1+x)\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.82 (sec) , antiderivative size = 16, normalized size of antiderivative = 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 (6-3 x \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\)

[In]

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

[Out]

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

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88 \[ \int \frac {1+x^2}{1+x} \, dx=\frac {1}{2} \, x^{2} - x + 2 \, \log \left (x + 1\right ) \]

[In]

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

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.71 \[ \int \frac {1+x^2}{1+x} \, dx=\frac {x^{2}}{2} - x + 2 \log {\left (x + 1 \right )} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.19 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88 \[ \int \frac {1+x^2}{1+x} \, dx=\frac {1}{2} \, x^{2} - x + 2 \, \log \left (x + 1\right ) \]

[In]

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

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.94 \[ \int \frac {1+x^2}{1+x} \, dx=\frac {1}{2} \, x^{2} - x + 2 \, \log \left ({\left | x + 1 \right |}\right ) \]

[In]

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

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.01 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88 \[ \int \frac {1+x^2}{1+x} \, dx=2\,\ln \left (x+1\right )-x+\frac {x^2}{2} \]

[In]

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

[Out]

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