3.298 \(\int \log (-2+\sqrt{\frac{1+x}{x}}) \, dx\)

Optimal. Leaf size=69 \[ \frac{1}{2} \log \left (1-\sqrt{\frac{1}{x}+1}\right )-\frac{1}{3} \log \left (2-\sqrt{\frac{1}{x}+1}\right )-\frac{1}{6} \log \left (\sqrt{\frac{1}{x}+1}+1\right )+x \log \left (\sqrt{\frac{x+1}{x}}-2\right ) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.0517545, antiderivative size = 69, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 4, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.286, Rules used = {2548, 706, 31, 633} \[ \frac{1}{2} \log \left (1-\sqrt{\frac{1}{x}+1}\right )-\frac{1}{3} \log \left (2-\sqrt{\frac{1}{x}+1}\right )-\frac{1}{6} \log \left (\sqrt{\frac{1}{x}+1}+1\right )+x \log \left (\sqrt{\frac{x+1}{x}}-2\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 2548

Int[Log[u_], x_Symbol] :> Simp[x*Log[u], x] - Int[SimplifyIntegrand[(x*D[u, x])/u, x], x] /; InverseFunctionFr
eeQ[u, x]

Rule 706

Int[1/(((d_) + (e_.)*(x_))*((a_) + (c_.)*(x_)^2)), x_Symbol] :> Dist[e^2/(c*d^2 + a*e^2), Int[1/(d + e*x), x],
 x] + Dist[1/(c*d^2 + a*e^2), Int[(c*d - c*e*x)/(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^2 + a
*e^2, 0]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 633

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[-(a*c), 2]}, Dist[e/2 + (c*d)/(2*q),
Int[1/(-q + c*x), x], x] + Dist[e/2 - (c*d)/(2*q), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[-(a*c)]

Rubi steps

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

Mathematica [A]  time = 0.0265013, size = 64, normalized size = 0.93 \[ \frac{1}{6} \left (\log \left (2-\sqrt{\frac{1}{x}+1}\right )+6 x \log \left (\sqrt{\frac{1}{x}+1}-2\right )-\log \left (\sqrt{\frac{1}{x}+1}+1\right )-6 \tanh ^{-1}\left (3-2 \sqrt{\frac{1}{x}+1}\right )\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(-6*ArcTanh[3 - 2*Sqrt[1 + x^(-1)]] + Log[2 - Sqrt[1 + x^(-1)]] + 6*x*Log[-2 + Sqrt[1 + x^(-1)]] - Log[1 + Sqr
t[1 + x^(-1)]])/6

________________________________________________________________________________________

Maple [A]  time = 0.036, size = 108, normalized size = 1.6 \begin{align*} x\ln \left ( -2+\sqrt{{\frac{1+x}{x}}} \right ) -{\frac{1}{18\,x} \left ( 3\,\sqrt{{\frac{1+x}{x}}}x\ln \left ( -3\,x+1 \right ) -\sqrt{9}\ln \left ({\frac{1}{9\,x-3} \left ( 4\,\sqrt{9}\sqrt{{x}^{2}+x}+15\,x+3 \right ) } \right ) \sqrt{x \left ( 1+x \right ) }+6\,\ln \left ( 1/2+x+\sqrt{{x}^{2}+x} \right ) \sqrt{x \left ( 1+x \right ) } \right ){\frac{1}{\sqrt{{\frac{1+x}{x}}}}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

x*ln(-2+((1+x)/x)^(1/2))-1/18/((1+x)/x)^(1/2)/x*(3*((1+x)/x)^(1/2)*x*ln(-3*x+1)-9^(1/2)*ln(1/3*(4*9^(1/2)*(x^2
+x)^(1/2)+15*x+3)/(3*x-1))*(x*(1+x))^(1/2)+6*ln(1/2+x+(x^2+x)^(1/2))*(x*(1+x))^(1/2))

________________________________________________________________________________________

Maxima [A]  time = 1.05914, size = 90, normalized size = 1.3 \begin{align*} \frac{\log \left (\sqrt{\frac{x + 1}{x}} - 2\right )}{\frac{x + 1}{x} - 1} - \frac{1}{6} \, \log \left (\sqrt{\frac{x + 1}{x}} + 1\right ) + \frac{1}{2} \, \log \left (\sqrt{\frac{x + 1}{x}} - 1\right ) - \frac{1}{3} \, \log \left (\sqrt{\frac{x + 1}{x}} - 2\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(sqrt((x + 1)/x) - 2)/((x + 1)/x - 1) - 1/6*log(sqrt((x + 1)/x) + 1) + 1/2*log(sqrt((x + 1)/x) - 1) - 1/3*l
og(sqrt((x + 1)/x) - 2)

________________________________________________________________________________________

Fricas [A]  time = 2.19618, size = 138, normalized size = 2. \begin{align*} \frac{1}{3} \,{\left (3 \, x - 1\right )} \log \left (\sqrt{\frac{x + 1}{x}} - 2\right ) - \frac{1}{6} \, \log \left (\sqrt{\frac{x + 1}{x}} + 1\right ) + \frac{1}{2} \, \log \left (\sqrt{\frac{x + 1}{x}} - 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]  time = 153.419, size = 53, normalized size = 0.77 \begin{align*} x \log{\left (\sqrt{\frac{x + 1}{x}} - 2 \right )} - \frac{\log{\left (\sqrt{1 + \frac{1}{x}} - 2 \right )}}{3} + \frac{\log{\left (\sqrt{1 + \frac{1}{x}} - 1 \right )}}{2} - \frac{\log{\left (\sqrt{1 + \frac{1}{x}} + 1 \right )}}{6} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [B]  time = 1.38192, size = 157, normalized size = 2.28 \begin{align*} x \log \left (\sqrt{\frac{x + 1}{x}} - 2\right ) + \frac{1}{6} \,{\left (\frac{\log \left ({\left | -2 \,{\left (x - \sqrt{x^{2} + x}\right )} \mathrm{sgn}\left (x\right ) + x - \sqrt{x^{2} + x} + 1 \right |}\right )}{\mathrm{sgn}\left (x\right )} - \frac{\log \left ({\left | -2 \,{\left (x - \sqrt{x^{2} + x}\right )} \mathrm{sgn}\left (x\right ) - x + \sqrt{x^{2} + x} - 1 \right |}\right )}{\mathrm{sgn}\left (x\right )} + 2 \, \log \left ({\left | -2 \, x + 2 \, \sqrt{x^{2} + x} - 1 \right |}\right )\right )} \mathrm{sgn}\left (x\right ) - \frac{1}{6} \, \log \left ({\left | 3 \, x - 1 \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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