3.9.84 \(\int \frac {\sqrt {2-x} \sqrt {x}+x}{2-2 x} \, dx\) [884]

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.10, antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.280, Rules used = {6820, 2140, 6874, 45, 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[(Sqrt[2 - x]*Sqrt[x] + x)/(2 - 2*x),x]

[Out]

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

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

Int[((u_) + (f_.)*((j_.) + (k_.)*Sqrt[v_]))^(n_.)*((g_.) + (h_.)*(x_))^(m_.), x_Symbol] :> Int[(g + h*x)^m*(Ex
pandToSum[u + f*j, x] + f*k*Sqrt[ExpandToSum[v, x]])^n, x] /; FreeQ[{f, g, h, j, k, m, n}, x] && LinearQ[u, x]
 && QuadraticQ[v, x] &&  !(LinearMatchQ[u, x] && QuadraticMatchQ[v, x] && (EqQ[j, 0] || EqQ[f, 1])) && EqQ[(Co
efficient[u, x, 1]*g - h*(Coefficient[u, x, 0] + f*j))^2 - f^2*k^2*(Coefficient[v, x, 2]*g^2 - Coefficient[v,
x, 1]*g*h + Coefficient[v, x, 0]*h^2), 0]

Rule 6820

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

Rule 6874

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

Rubi steps

\begin {align*} \int \frac {\sqrt {2-x} \sqrt {x}+x}{2-2 x} \, dx &=\int \frac {x+\sqrt {-(-2+x) x}}{2-2 x} \, dx\\ &=\int \frac {x+\sqrt {2 x-x^2}}{2-2 x} \, dx\\ &=\int \left (-\frac {x}{2 (-1+x)}+\frac {\sqrt {2 x-x^2}}{2 (1-x)}\right ) \, dx\\ &=-\left (\frac {1}{2} \int \frac {x}{-1+x} \, dx\right )+\frac {1}{2} \int \frac {\sqrt {2 x-x^2}}{1-x} \, dx\\ &=-\frac {1}{2} \sqrt {2 x-x^2}-\frac {1}{2} \int \left (1+\frac {1}{-1+x}\right ) \, dx+\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.00, 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[(Sqrt[2 - x]*Sqrt[x] + x)/(2 - 2*x),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.25, size = 51, normalized size = 1.00

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+(2-x)^(1/2)*x^(1/2))/(2-2*x),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 [A]
time = 0.50, size = 54, normalized size = 1.06 \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 {2 \, \sqrt {-x^{2} + 2 \, x}}{{\left | x - 1 \right |}} + \frac {2}{{\left | x - 1 \right |}}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Fricas [A]
time = 0.33, size = 64, normalized size = 1.25 \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+(2-x)^(1/2)*x^(1/2))/(2-2*x),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*} - \frac {\int \frac {x}{x - 1}\, dx + \int \frac {\sqrt {x} \sqrt {2 - x}}{x - 1}\, dx}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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+(2-x)^(1/2)*x^(1/2))/(2-2*x),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 = 4.78, size = 56, normalized size = 1.10 \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 + x^(1/2)*(2 - x)^(1/2))/(2*x - 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

________________________________________________________________________________________