3.261 \(\int \frac{1}{\sqrt{(b-x) (-a+x)}} \, dx\)

Optimal. Leaf size=32 \[ -\tan ^{-1}\left (\frac{a+b-2 x}{2 \sqrt{x (a+b)-a b-x^2}}\right ) \]

[Out]

-ArcTan[(a + b - 2*x)/(2*Sqrt[-(a*b) + (a + b)*x - x^2])]

________________________________________________________________________________________

Rubi [A]  time = 0.0130767, antiderivative size = 32, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {1981, 621, 204} \[ -\tan ^{-1}\left (\frac{a+b-2 x}{2 \sqrt{x (a+b)-a b-x^2}}\right ) \]

Antiderivative was successfully verified.

[In]

Int[1/Sqrt[(b - x)*(-a + x)],x]

[Out]

-ArcTan[(a + b - 2*x)/(2*Sqrt[-(a*b) + (a + b)*x - x^2])]

Rule 1981

Int[(u_)^(p_), x_Symbol] :> Int[ExpandToSum[u, x]^p, x] /; FreeQ[p, x] && QuadraticQ[u, x] &&  !QuadraticMatch
Q[u, x]

Rule 621

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

Rule 204

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

Rubi steps

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

Mathematica [B]  time = 0.0260302, size = 72, normalized size = 2.25 \[ -\frac{2 \sqrt{a-b} \sqrt{b-x} \sqrt{\frac{a-x}{a-b}} \sinh ^{-1}\left (\frac{\sqrt{b-x}}{\sqrt{a-b}}\right )}{\sqrt{(a-x) (x-b)}} \]

Antiderivative was successfully verified.

[In]

Integrate[1/Sqrt[(b - x)*(-a + x)],x]

[Out]

(-2*Sqrt[a - b]*Sqrt[(a - x)/(a - b)]*Sqrt[b - x]*ArcSinh[Sqrt[b - x]/Sqrt[a - b]])/Sqrt[(a - x)*(-b + x)]

________________________________________________________________________________________

Maple [A]  time = 0.003, size = 28, normalized size = 0.9 \begin{align*} \arctan \left ({ \left ( x-{\frac{b}{2}}-{\frac{a}{2}} \right ){\frac{1}{\sqrt{-ab+ \left ( a+b \right ) x-{x}^{2}}}}} \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/((b-x)*(-a+x))^(1/2),x)

[Out]

arctan((x-1/2*b-1/2*a)/(-a*b+(a+b)*x-x^2)^(1/2))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.34545, size = 111, normalized size = 3.47 \begin{align*} -\arctan \left (-\frac{\sqrt{-a b +{\left (a + b\right )} x - x^{2}}{\left (a + b - 2 \, x\right )}}{2 \,{\left (a b -{\left (a + b\right )} x + x^{2}\right )}}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-arctan(-1/2*sqrt(-a*b + (a + b)*x - x^2)*(a + b - 2*x)/(a*b - (a + b)*x + x^2))

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{1}{\sqrt{\left (- a + x\right ) \left (b - x\right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Integral(1/sqrt((-a + x)*(b - x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.24874, size = 30, normalized size = 0.94 \begin{align*} \arcsin \left (\frac{a + b - 2 \, x}{a - b}\right ) \mathrm{sgn}\left (-a + b\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

arcsin((a + b - 2*x)/(a - b))*sgn(-a + b)