3.9.85 \(\int \frac {\sqrt {x}}{\sqrt {2-x}-\sqrt {x}} \, dx\) [885]

Optimal. Leaf size=54 \[ -\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) \]

[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.03, 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 = {2130, 103, 12, 94, 212, 45} \begin {gather*} -\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 ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-1/2*(Sqrt[2 - x]*Sqrt[x]) - 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 45

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 94

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 103

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 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 2130

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 \text {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 [C] Result contains complex when optimal does not.
time = 0.25, size = 53, normalized size = 0.98 \begin {gather*} \frac {1}{2} \left (1-x-\sqrt {-((-2+x) x)}+2 i \tan ^{-1}\left (1-x-i \sqrt {-((-2+x) x)}\right )-\log (2-2 x)\right ) \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.02, size = 51, normalized size = 0.94

method result size
default \(-\frac {\sqrt {2-x}\, \sqrt {x}\, \left (\sqrt {-x \left (x -2\right )}-\arctanh \left (\frac {1}{\sqrt {-x \left (x -2\right )}}\right )\right )}{2 \sqrt {-x \left (x -2\right )}}-\frac {x}{2}-\frac {\ln \left (-1+x \right )}{2}\) \(51\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

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)

________________________________________________________________________________________

Fricas [A]
time = 0.32, size = 64, normalized size = 1.19 \begin {gather*} -\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 ) \end {gather*}

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)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sqrt {x}}{- \sqrt {x} + \sqrt {2 - x}}\, dx \end {gather*}

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)

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: NotImplementedError} \end {gather*}

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]%%%}+%%%{-

________________________________________________________________________________________

Mupad [B]
time = 0.06, size = 56, normalized size = 1.04 \begin {gather*} \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} \end {gather*}

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

________________________________________________________________________________________