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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {6874, 699, 702, 213} \begin {gather*} -\frac {1}{2} \sqrt {2 x-x^2}+\frac {1}{2} \tanh ^{-1}\left (\sqrt {2 x-x^2}\right )-\frac {x}{2}-\frac {1}{2} \log (1-x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 213

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

Rule 699

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

Rule 702

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

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

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

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 0.11, size = 45, normalized size = 0.88 \begin {gather*} \frac {1}{2} \left (i \pi -x-\sqrt {-((-2+x) x)}+\log (-2+x)-2 \log \left (-2+x+\sqrt {-((-2+x) x)}\right )\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.05, size = 38, normalized size = 0.75

method result size
trager \(-\frac {x}{2}+\frac {3}{2}-\frac {\sqrt {-x^{2}+2 x}}{2}-\frac {\ln \left (\sqrt {-x^{2}+2 x}-1\right )}{2}\) \(35\)
default \(-\frac {x}{2}-\frac {\ln \left (-1+x \right )}{2}-\frac {\sqrt {-\left (-1+x \right )^{2}+1}}{2}+\frac {\arctanh \left (\frac {1}{\sqrt {-\left (-1+x \right )^{2}+1}}\right )}{2}\) \(38\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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/(-x+(-x^2+2*x)^(1/2)),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.33, size = 66, normalized size = 1.29 \begin {gather*} -\frac {1}{2} \, x - \frac {1}{2} \, \sqrt {-x^{2} + 2 \, x} - \frac {1}{2} \, \log \left (x - 1\right ) + \frac {1}{2} \, \log \left (\frac {x + \sqrt {-x^{2} + 2 \, x}}{x}\right ) - \frac {1}{2} \, \log \left (-\frac {x - \sqrt {-x^{2} + 2 \, x}}{x}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 3.58, size = 50, normalized size = 0.98 \begin {gather*} -\frac {1}{2} \, x - \frac {1}{2} \, \sqrt {-x^{2} + 2 \, x} - \frac {1}{2} \, \log \left (-\frac {2 \, {\left (\sqrt {-x^{2} + 2 \, x} - 1\right )}}{{\left | -2 \, x + 2 \right |}}\right ) - \frac {1}{2} \, \log \left ({\left | x - 1 \right |}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int -\frac {x}{x-\sqrt {2\,x-x^2}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________