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

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

Optimal result

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

[Out]

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

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 200, normalized size of antiderivative = 1.36, number of steps used = 12, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {2144, 468, 335, 303, 1176, 631, 210, 1179, 642} \[ \int \frac {\sqrt {x-\sqrt {-1+x^2}}}{x^2} \, dx=-\frac {\arctan \left (1-\sqrt {2} \sqrt {x-\sqrt {x^2-1}}\right )}{\sqrt {2}}+\frac {\arctan \left (\sqrt {2} \sqrt {x-\sqrt {x^2-1}}+1\right )}{\sqrt {2}}-\frac {2 \left (x-\sqrt {x^2-1}\right )^{3/2}}{\left (x-\sqrt {x^2-1}\right )^2+1}+\frac {\log \left (-\sqrt {x^2-1}-\sqrt {2} \sqrt {x-\sqrt {x^2-1}}+x+1\right )}{2 \sqrt {2}}-\frac {\log \left (-\sqrt {x^2-1}+\sqrt {2} \sqrt {x-\sqrt {x^2-1}}+x+1\right )}{2 \sqrt {2}} \]

[In]

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

[Out]

(-2*(x - Sqrt[-1 + x^2])^(3/2))/(1 + (x - Sqrt[-1 + x^2])^2) - ArcTan[1 - Sqrt[2]*Sqrt[x - Sqrt[-1 + x^2]]]/Sq
rt[2] + ArcTan[1 + Sqrt[2]*Sqrt[x - Sqrt[-1 + x^2]]]/Sqrt[2] + Log[1 + x - Sqrt[-1 + x^2] - Sqrt[2]*Sqrt[x - S
qrt[-1 + x^2]]]/(2*Sqrt[2]) - Log[1 + x - Sqrt[-1 + x^2] + Sqrt[2]*Sqrt[x - Sqrt[-1 + x^2]]]/(2*Sqrt[2])

Rule 210

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

Rule 303

Int[(x_)^2/((a_) + (b_.)*(x_)^4), x_Symbol] :> With[{r = Numerator[Rt[a/b, 2]], s = Denominator[Rt[a/b, 2]]},
Dist[1/(2*s), Int[(r + s*x^2)/(a + b*x^4), x], x] - Dist[1/(2*s), Int[(r - s*x^2)/(a + b*x^4), x], x]] /; Free
Q[{a, b}, x] && (GtQ[a/b, 0] || (PosQ[a/b] && AtomQ[SplitProduct[SumBaseQ, a]] && AtomQ[SplitProduct[SumBaseQ,
 b]]))

Rule 335

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> With[{k = Denominator[m]}, Dist[k/c, Subst[I
nt[x^(k*(m + 1) - 1)*(a + b*(x^(k*n)/c^n))^p, x], x, (c*x)^(1/k)], x]] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0]
 && FractionQ[m] && IntBinomialQ[a, b, c, n, m, p, x]

Rule 468

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d
))*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*b*e*n*(p + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a
*b*n*(p + 1)), Int[(e*x)^m*(a + b*x^n)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0]
 && LtQ[p, -1] && (( !IntegerQ[p + 1/2] && NeQ[p, -5/4]) ||  !RationalQ[m] || (IGtQ[n, 0] && ILtQ[p + 1/2, 0]
&& LeQ[-1, m, (-n)*(p + 1)]))

Rule 631

Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = 1 - 4*Simplify[a*(c/b^2)]}, Dist[-2/b, Sub
st[Int[1/(q - x^2), x], x, 1 + 2*c*(x/b)], x] /; RationalQ[q] && (EqQ[q^2, 1] ||  !RationalQ[b^2 - 4*a*c])] /;
 FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 1176

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

Rule 1179

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

Rule 2144

Int[((g_.) + (h_.)*(x_))^(m_.)*((e_.)*(x_) + (f_.)*Sqrt[(a_.) + (c_.)*(x_)^2])^(n_.), x_Symbol] :> Dist[1/(2^(
m + 1)*e^(m + 1)), Subst[Int[x^(n - m - 2)*(a*f^2 + x^2)*((-a)*f^2*h + 2*e*g*x + h*x^2)^m, x], x, e*x + f*Sqrt
[a + c*x^2]], x] /; FreeQ[{a, c, e, f, g, h, n}, x] && EqQ[e^2 - c*f^2, 0] && IntegerQ[m]

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

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.76 \[ \int \frac {\sqrt {x-\sqrt {-1+x^2}}}{x^2} \, dx=-\frac {\sqrt {x-\sqrt {-1+x^2}}}{x}+\frac {\arctan \left (\frac {-1+x-\sqrt {-1+x^2}}{\sqrt {2} \sqrt {x-\sqrt {-1+x^2}}}\right )}{\sqrt {2}}+\frac {\text {arctanh}\left (\frac {-1-x+\sqrt {-1+x^2}}{\sqrt {2} \sqrt {x-\sqrt {-1+x^2}}}\right )}{\sqrt {2}} \]

[In]

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

[Out]

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

Maple [F]

\[\int \frac {\sqrt {x -\sqrt {x^{2}-1}}}{x^{2}}d x\]

[In]

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

[Out]

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

Fricas [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.29 (sec) , antiderivative size = 133, normalized size of antiderivative = 0.90 \[ \int \frac {\sqrt {x-\sqrt {-1+x^2}}}{x^2} \, dx=\frac {\left (i - 1\right ) \, \sqrt {2} x \log \left (\left (i + 1\right ) \, \sqrt {2} + 2 \, \sqrt {x - \sqrt {x^{2} - 1}}\right ) - \left (i + 1\right ) \, \sqrt {2} x \log \left (-\left (i - 1\right ) \, \sqrt {2} + 2 \, \sqrt {x - \sqrt {x^{2} - 1}}\right ) + \left (i + 1\right ) \, \sqrt {2} x \log \left (\left (i - 1\right ) \, \sqrt {2} + 2 \, \sqrt {x - \sqrt {x^{2} - 1}}\right ) - \left (i - 1\right ) \, \sqrt {2} x \log \left (-\left (i + 1\right ) \, \sqrt {2} + 2 \, \sqrt {x - \sqrt {x^{2} - 1}}\right ) - 4 \, \sqrt {x - \sqrt {x^{2} - 1}}}{4 \, x} \]

[In]

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

[Out]

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

Sympy [F]

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

[In]

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

[Out]

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

Maxima [F]

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

[In]

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

[Out]

integrate(sqrt(x - sqrt(x^2 - 1))/x^2, x)

Giac [F]

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

[In]

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

[Out]

integrate(sqrt(x - sqrt(x^2 - 1))/x^2, x)

Mupad [F(-1)]

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

[In]

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

[Out]

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