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

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

Optimal result

Integrand size = 17, antiderivative size = 27 \[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\text {arcsinh}(x)-\frac {\text {arctanh}\left (\frac {x}{\sqrt {2} \sqrt {1+x^2}}\right )}{\sqrt {2}} \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {399, 221, 385, 212} \[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\text {arcsinh}(x)-\frac {\text {arctanh}\left (\frac {x}{\sqrt {2} \sqrt {x^2+1}}\right )}{\sqrt {2}} \]

[In]

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

[Out]

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

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 221

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 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 399

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Dist[b/d, Int[(a + b*x^n)^(p - 1), x]
, x] - Dist[(b*c - a*d)/d, Int[(a + b*x^n)^(p - 1)/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, p}, x] && NeQ[b*c
 - a*d, 0] && EqQ[n*(p - 1) + 1, 0] && IntegerQ[n]

Rubi steps \begin{align*} \text {integral}& = \int \frac {1}{\sqrt {1+x^2}} \, dx-\int \frac {1}{\sqrt {1+x^2} \left (2+x^2\right )} \, dx \\ & = \text {arcsinh}(x)-\text {Subst}\left (\int \frac {1}{2-x^2} \, dx,x,\frac {x}{\sqrt {1+x^2}}\right ) \\ & = \text {arcsinh}(x)-\frac {\text {arctanh}\left (\frac {x}{\sqrt {2} \sqrt {1+x^2}}\right )}{\sqrt {2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.78 \[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=-\frac {\text {arctanh}\left (\frac {2+x^2-x \sqrt {1+x^2}}{\sqrt {2}}\right )}{\sqrt {2}}-\log \left (-x+\sqrt {1+x^2}\right ) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.85

method result size
default \(\operatorname {arcsinh}\left (x \right )-\frac {\operatorname {arctanh}\left (\frac {x \sqrt {2}}{2 \sqrt {x^{2}+1}}\right ) \sqrt {2}}{2}\) \(23\)
pseudoelliptic \(\frac {\ln \left (\frac {x +\sqrt {x^{2}+1}}{x}\right )}{2}-\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {2}\, \sqrt {x^{2}+1}}{x}\right )}{2}-\frac {\ln \left (\frac {\sqrt {x^{2}+1}-x}{x}\right )}{2}\) \(56\)
trager \(-\ln \left (-\sqrt {x^{2}+1}+x \right )-\frac {\operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right ) \ln \left (\frac {3 \operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right ) x^{2}+4 x \sqrt {x^{2}+1}+2 \operatorname {RootOf}\left (\textit {\_Z}^{2}-2\right )}{x^{2}+2}\right )}{4}\) \(63\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 67 vs. \(2 (22) = 44\).

Time = 0.25 (sec) , antiderivative size = 67, normalized size of antiderivative = 2.48 \[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\frac {1}{4} \, \sqrt {2} \log \left (\frac {9 \, x^{2} - 2 \, \sqrt {2} {\left (3 \, x^{2} + 2\right )} - 2 \, \sqrt {x^{2} + 1} {\left (3 \, \sqrt {2} x - 4 \, x\right )} + 6}{x^{2} + 2}\right ) - \log \left (-x + \sqrt {x^{2} + 1}\right ) \]

[In]

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

[Out]

1/4*sqrt(2)*log((9*x^2 - 2*sqrt(2)*(3*x^2 + 2) - 2*sqrt(x^2 + 1)*(3*sqrt(2)*x - 4*x) + 6)/(x^2 + 2)) - log(-x
+ sqrt(x^2 + 1))

Sympy [F]

\[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\int \frac {\sqrt {x^{2} + 1}}{x^{2} + 2}\, dx \]

[In]

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

[Out]

Integral(sqrt(x**2 + 1)/(x**2 + 2), x)

Maxima [F]

\[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\int { \frac {\sqrt {x^{2} + 1}}{x^{2} + 2} \,d x } \]

[In]

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

[Out]

sqrt(x^2 + 1)*x/(x^2 + 2) + integrate(sqrt(x^2 + 1)*x^4/(x^6 + 5*x^4 + 8*x^2 + 4), x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 64 vs. \(2 (22) = 44\).

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

[In]

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

[Out]

1/4*sqrt(2)*log(((x - sqrt(x^2 + 1))^2 - 2*sqrt(2) + 3)/((x - sqrt(x^2 + 1))^2 + 2*sqrt(2) + 3)) - log(-x + sq
rt(x^2 + 1))

Mupad [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 77, normalized size of antiderivative = 2.85 \[ \int \frac {\sqrt {1+x^2}}{2+x^2} \, dx=\mathrm {asinh}\left (x\right )+\frac {\sqrt {2}\,\left (\ln \left (x-\sqrt {2}\,1{}\mathrm {i}\right )-\ln \left (1+\sqrt {2}\,x\,1{}\mathrm {i}+\sqrt {x^2+1}\,1{}\mathrm {i}\right )\right )}{4}-\frac {\sqrt {2}\,\left (\ln \left (x+\sqrt {2}\,1{}\mathrm {i}\right )-\ln \left (1-\sqrt {2}\,x\,1{}\mathrm {i}+\sqrt {x^2+1}\,1{}\mathrm {i}\right )\right )}{4} \]

[In]

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

[Out]

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