3.885 \(\int \frac {\sqrt {x}}{\sqrt {2-x}-\sqrt {x}} \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {2105, 101, 12, 92, 206, 43} \[ -\frac {x}{2}-\frac {1}{2} \sqrt {2-x} \sqrt {x}-\frac {1}{2} \log (1-x)+\frac {1}{2} \tanh ^{-1}\left (\sqrt {2-x} \sqrt {x}\right ) \]

Antiderivative was successfully verified.

[In]

Int[Sqrt[x]/(Sqrt[2 - x] - Sqrt[x]),x]

[Out]

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

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

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 92

Int[1/(Sqrt[(a_.) + (b_.)*(x_)]*Sqrt[(c_.) + (d_.)*(x_)]*((e_.) + (f_.)*(x_))), x_Symbol] :> Dist[b*f, Subst[I
nt[1/(d*(b*e - a*f)^2 + b*f^2*x^2), x], x, Sqrt[a + b*x]*Sqrt[c + d*x]], x] /; FreeQ[{a, b, c, d, e, f}, x] &&
 EqQ[2*b*d*e - f*(b*c + a*d), 0]

Rule 101

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[((a +
b*x)^m*(c + d*x)^n*(e + f*x)^(p + 1))/(f*(m + n + p + 1)), x] - Dist[1/(f*(m + n + p + 1)), Int[(a + b*x)^(m -
 1)*(c + d*x)^(n - 1)*(e + f*x)^p*Simp[c*m*(b*e - a*f) + a*n*(d*e - c*f) + (d*m*(b*e - a*f) + b*n*(d*e - c*f))
*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, p}, x] && GtQ[m, 0] && GtQ[n, 0] && NeQ[m + n + p + 1, 0] && (Integ
ersQ[2*m, 2*n, 2*p] || (IntegersQ[m, n + p] || IntegersQ[p, m + n]))

Rule 206

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

Rule 2105

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.14, size = 82, normalized size = 1.52 \[ \frac {1}{2} \left (-x-\sqrt {-((x-2) x)}-\log \left (1-\sqrt {x}\right )-\log \left (\sqrt {x}+1\right )+\tanh ^{-1}\left (\frac {2-\sqrt {x}}{\sqrt {2-x}}\right )-\tanh ^{-1}\left (\frac {\sqrt {x}+2}{\sqrt {2-x}}\right )\right ) \]

Warning: Unable to verify antiderivative.

[In]

Integrate[Sqrt[x]/(Sqrt[2 - x] - Sqrt[x]),x]

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.42, size = 64, normalized size = 1.19 \[ -\frac {1}{2} \, x - \frac {1}{2} \, \sqrt {x} \sqrt {-x + 2} - \frac {1}{2} \, \log \left (x - 1\right ) + \frac {1}{2} \, \log \left (\frac {x + \sqrt {x} \sqrt {-x + 2}}{x}\right ) - \frac {1}{2} \, \log \left (-\frac {x - \sqrt {x} \sqrt {-x + 2}}{x}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/2*x - 1/2*sqrt(x)*sqrt(-x + 2) - 1/2*log(x - 1) + 1/2*log((x + sqrt(x)*sqrt(-x + 2))/x) - 1/2*log(-(x - sqr
t(x)*sqrt(-x + 2))/x)

________________________________________________________________________________________

giac [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: NotImplementedError >> Unable to parse Giac output: Warning, choosing root of [1,0,-4,0,%%%{
4,[2]%%%}+%%%{-8,[1]%%%}+%%%{4,[0]%%%}] at parameters values [-92.616423693]Warning, choosing root of [1,0,-4,
0,%%%{4,[2]%%%}+%%%{-8,[1]%%%}+%%%{4,[0]%%%}] at parameters values [-16.8804557086]2*(-x/4-1/4*ln(abs(x-1))-1/
4*sqrt(x)*sqrt(-x+2)+1/4*ln(abs(2*sqrt(x)/(-2*sqrt(-x+2)+2*sqrt(2))+2-1/2*(-2*sqrt(-x+2)+2*sqrt(2))/sqrt(x)))-
1/4*ln(abs(2*sqrt(x)/(-2*sqrt(-x+2)+2*sqrt(2))-2-1/2*(-2*sqrt(-x+2)+2*sqrt(2))/sqrt(x))))

________________________________________________________________________________________

maple [A]  time = 0.01, size = 51, normalized size = 0.94 \[ -\frac {x}{2}-\frac {\ln \left (x -1\right )}{2}-\frac {\sqrt {-x +2}\, \left (-\arctanh \left (\frac {1}{\sqrt {-\left (x -2\right ) x}}\right )+\sqrt {-\left (x -2\right ) x}\right ) \sqrt {x}}{2 \sqrt {-\left (x -2\right ) x}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ -\int \frac {\sqrt {x}}{\sqrt {x} - \sqrt {-x + 2}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-integrate(sqrt(x)/(sqrt(x) - sqrt(-x + 2)), x)

________________________________________________________________________________________

mupad [B]  time = 0.06, size = 56, normalized size = 1.04 \[ \mathrm {atanh}\left (\frac {\sqrt {x}\,\left (\sqrt {2}-\sqrt {2-x}\right )}{x+\sqrt {2}\,\sqrt {2-x}-2}\right )-\frac {\ln \left (x-1\right )}{2}-\frac {x}{2}-\frac {\sqrt {x}\,\sqrt {2-x}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\sqrt {x}}{- \sqrt {x} + \sqrt {2 - x}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(sqrt(x)/(-sqrt(x) + sqrt(2 - x)), x)

________________________________________________________________________________________