3.806 \(\int \frac {-1+x+x^2}{1+\sqrt {1+x^2}} \, dx\)

Optimal. Leaf size=65 \[ \frac {1}{2} \sqrt {x^2+1} x+\sqrt {x^2+1}+\frac {\sqrt {x^2+1}}{x}-\log \left (\sqrt {x^2+1}+1\right )-x-\frac {1}{x}-\frac {1}{2} \sinh ^{-1}(x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.16, antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 14, number of rules used = 7, integrand size = 20, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.350, Rules used = {6742, 277, 215, 1591, 190, 43, 195} \[ \frac {1}{2} \sqrt {x^2+1} x+\sqrt {x^2+1}+\frac {\sqrt {x^2+1}}{x}-\log \left (\sqrt {x^2+1}+1\right )-x-\frac {1}{x}-\frac {1}{2} \sinh ^{-1}(x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x^(-1) - x + Sqrt[1 + x^2] + Sqrt[1 + x^2]/x + (x*Sqrt[1 + x^2])/2 - ArcSinh[x]/2 - Log[1 + Sqrt[1 + x^2]]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 190

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Dist[1/n, Subst[Int[x^(1/n - 1)*(a + b*x)^p, x], x, x^n], x] /
; FreeQ[{a, b, p}, x] && FractionQ[n] && IntegerQ[1/n]

Rule 195

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(x*(a + b*x^n)^p)/(n*p + 1), x] + Dist[(a*n*p)/(n*p + 1),
 Int[(a + b*x^n)^(p - 1), x], x] /; FreeQ[{a, b}, x] && IGtQ[n, 0] && GtQ[p, 0] && (IntegerQ[2*p] || (EqQ[n, 2
] && IntegerQ[4*p]) || (EqQ[n, 2] && IntegerQ[3*p]) || LtQ[Denominator[p + 1/n], Denominator[p]])

Rule 215

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSinh[(Rt[b, 2]*x)/Sqrt[a]]/Rt[b, 2], x] /; FreeQ[{a, b},
 x] && GtQ[a, 0] && PosQ[b]

Rule 277

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[((c*x)^(m + 1)*(a + b*x^n)^p)/(c*(m +
1)), x] - Dist[(b*n*p)/(c^n*(m + 1)), Int[(c*x)^(m + n)*(a + b*x^n)^(p - 1), x], x] /; FreeQ[{a, b, c}, x] &&
IGtQ[n, 0] && GtQ[p, 0] && LtQ[m, -1] &&  !ILtQ[(m + n*p + n + 1)/n, 0] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 1591

Int[((a_.) + (b_.)*(Pq_)^(n_.))^(p_.)*(Qr_), x_Symbol] :> With[{q = Expon[Pq, x], r = Expon[Qr, x]}, Dist[Coef
f[Qr, x, r]/(q*Coeff[Pq, x, q]), Subst[Int[(a + b*x^n)^p, x], x, Pq], x] /; EqQ[r, q - 1] && EqQ[Coeff[Qr, x,
r]*D[Pq, x], q*Coeff[Pq, x, q]*Qr]] /; FreeQ[{a, b, n, p}, x] && PolyQ[Pq, x] && PolyQ[Qr, x]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int \frac {-1+x+x^2}{1+\sqrt {1+x^2}} \, dx &=\int \left (-\frac {1}{1+\sqrt {1+x^2}}+\frac {x}{1+\sqrt {1+x^2}}+\frac {x^2}{1+\sqrt {1+x^2}}\right ) \, dx\\ &=-\int \frac {1}{1+\sqrt {1+x^2}} \, dx+\int \frac {x}{1+\sqrt {1+x^2}} \, dx+\int \frac {x^2}{1+\sqrt {1+x^2}} \, dx\\ &=\frac {1}{2} \operatorname {Subst}\left (\int \frac {1}{1+\sqrt {x}} \, dx,x,1+x^2\right )+\int \left (-1+\sqrt {1+x^2}\right ) \, dx-\int \left (-\frac {1}{x^2}+\frac {\sqrt {1+x^2}}{x^2}\right ) \, dx\\ &=-\frac {1}{x}-x+\int \sqrt {1+x^2} \, dx-\int \frac {\sqrt {1+x^2}}{x^2} \, dx+\operatorname {Subst}\left (\int \frac {x}{1+x} \, dx,x,\sqrt {1+x^2}\right )\\ &=-\frac {1}{x}-x+\frac {\sqrt {1+x^2}}{x}+\frac {1}{2} x \sqrt {1+x^2}+\frac {1}{2} \int \frac {1}{\sqrt {1+x^2}} \, dx-\int \frac {1}{\sqrt {1+x^2}} \, dx+\operatorname {Subst}\left (\int \left (1+\frac {1}{-1-x}\right ) \, dx,x,\sqrt {1+x^2}\right )\\ &=-\frac {1}{x}-x+\sqrt {1+x^2}+\frac {\sqrt {1+x^2}}{x}+\frac {1}{2} x \sqrt {1+x^2}-\frac {1}{2} \sinh ^{-1}(x)-\log \left (1+\sqrt {1+x^2}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.08, size = 65, normalized size = 1.00 \[ \frac {1}{2} \sqrt {x^2+1} x+\sqrt {x^2+1}+\frac {\sqrt {x^2+1}}{x}-\log \left (\sqrt {x^2+1}+1\right )-x-\frac {1}{x}-\frac {1}{2} \sinh ^{-1}(x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x^(-1) - x + Sqrt[1 + x^2] + Sqrt[1 + x^2]/x + (x*Sqrt[1 + x^2])/2 - ArcSinh[x]/2 - Log[1 + Sqrt[1 + x^2]]

________________________________________________________________________________________

fricas [A]  time = 0.40, size = 84, normalized size = 1.29 \[ -\frac {2 \, x^{2} + 2 \, x \log \relax (x) + 2 \, x \log \left (-x + \sqrt {x^{2} + 1} + 1\right ) - x \log \left (-x + \sqrt {x^{2} + 1}\right ) - 2 \, x \log \left (-x + \sqrt {x^{2} + 1} - 1\right ) - {\left (x^{2} + 2 \, x + 2\right )} \sqrt {x^{2} + 1} - 2 \, x + 2}{2 \, x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.42, size = 89, normalized size = 1.37 \[ \frac {1}{2} \, \sqrt {x^{2} + 1} {\left (x + 2\right )} - x - \frac {2}{{\left (x - \sqrt {x^{2} + 1}\right )}^{2} - 1} - \frac {1}{x} + \frac {1}{2} \, \log \left (-x + \sqrt {x^{2} + 1}\right ) - \log \left ({\left | x \right |}\right ) - \log \left ({\left | -x + \sqrt {x^{2} + 1} + 1 \right |}\right ) + \log \left ({\left | -x + \sqrt {x^{2} + 1} - 1 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.01, size = 56, normalized size = 0.86 \[ -x -\frac {\sqrt {x^{2}+1}\, x}{2}-\frac {\arcsinh \relax (x )}{2}-\arctanh \left (\frac {1}{\sqrt {x^{2}+1}}\right )-\ln \relax (x )-\frac {1}{x}+\frac {\left (x^{2}+1\right )^{\frac {3}{2}}}{x}+\sqrt {x^{2}+1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-x-1/x-1/2*(x^2+1)^(1/2)*x-1/2*arcsinh(x)+(x^2+1)^(1/2)-arctanh(1/(x^2+1)^(1/2))-ln(x)+1/x*(x^2+1)^(3/2)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ 2 \, x - 5 \, \arctan \left (\frac {1}{2} \, x\right ) + \int \frac {x^{6} + x^{5} - x^{4}}{3 \, x^{4} + 16 \, x^{2} + {\left (x^{4} + 8 \, x^{2} + 16\right )} \sqrt {x^{2} + 1} + 16}\,{d x} + \log \left (x^{2} + 4\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*x - 5*arctan(1/2*x) + integrate((x^6 + x^5 - x^4)/(3*x^4 + 16*x^2 + (x^4 + 8*x^2 + 16)*sqrt(x^2 + 1) + 16),
x) + log(x^2 + 4)

________________________________________________________________________________________

mupad [B]  time = 0.04, size = 55, normalized size = 0.85 \[ \left (\frac {x}{2}+1\right )\,\sqrt {x^2+1}-\frac {\mathrm {asinh}\relax (x)}{2}-\ln \relax (x)-x+\frac {\sqrt {x^2+1}}{x}-\frac {1}{x}+\mathrm {atan}\left (\sqrt {x^2+1}\,1{}\mathrm {i}\right )\,1{}\mathrm {i} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

atan((x^2 + 1)^(1/2)*1i)*1i - x - asinh(x)/2 - log(x) + (x/2 + 1)*(x^2 + 1)^(1/2) + (x^2 + 1)^(1/2)/x - 1/x

________________________________________________________________________________________

sympy [A]  time = 4.51, size = 63, normalized size = 0.97 \[ \frac {x \sqrt {x^{2} + 1}}{2} - x + \frac {x}{\sqrt {x^{2} + 1}} + \sqrt {x^{2} + 1} - \log {\left (\sqrt {x^{2} + 1} + 1 \right )} - \frac {\operatorname {asinh}{\relax (x )}}{2} - \frac {1}{x} + \frac {1}{x \sqrt {x^{2} + 1}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________