3.2.5 \(\int \frac {1}{\sqrt {(b-x) (-a+x)}} \, dx\) [105]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {1976, 635, 210} \begin {gather*} -\text {ArcTan}\left (\frac {a+b-2 x}{2 \sqrt {x (a+b)-a b-x^2}}\right ) \end {gather*}

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 210

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

Rule 635

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 1976

Int[(u_.)*((e_.)*((a_.) + (b_.)*(x_)^(n_.))*((c_) + (d_.)*(x_)^(n_.)))^(p_), x_Symbol] :> Int[u*(a*c*e + (b*c
+ a*d)*e*x^n + b*d*e*x^(2*n))^p, x] /; FreeQ[{a, b, c, d, e, n, p}, x]

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 \text {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 [A]
time = 0.04, size = 55, normalized size = 1.72 \begin {gather*} -\frac {2 \sqrt {b-x} \sqrt {-a+x} \tan ^{-1}\left (\frac {\sqrt {b-x}}{\sqrt {-a+x}}\right )}{\sqrt {(b-x) (-a+x)}} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.08, size = 28, normalized size = 0.88

method result size
default \(\arctan \left (\frac {x -\frac {b}{2}-\frac {a}{2}}{\sqrt {-a b +\left (a +b \right ) x -x^{2}}}\right )\) \(28\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

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 >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(b-a>0)', see `assume?` for mor
e details)Is

________________________________________________________________________________________

Fricas [A]
time = 0.97, size = 43, normalized size = 1.34 \begin {gather*} -\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 {gather*}

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.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {1}{\sqrt {\left (- a + x\right ) \left (b - x\right )}}\, dx \end {gather*}

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 [B] Leaf count of result is larger than twice the leaf count of optimal. 61 vs. \(2 (28) = 56\).
time = 0.45, size = 61, normalized size = 1.91 \begin {gather*} \frac {1}{8} \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \arcsin \left (\frac {a + b - 2 \, x}{a - b}\right ) \mathrm {sgn}\left (-a + b\right ) - \frac {1}{4} \, \sqrt {-a b + a x + b x - x^{2}} {\left (a + b - 2 \, x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/8*(a^2 - 2*a*b + b^2)*arcsin((a + b - 2*x)/(a - b))*sgn(-a + b) - 1/4*sqrt(-a*b + a*x + b*x - x^2)*(a + b -
2*x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.03 \begin {gather*} \int \frac {1}{\sqrt {-\left (a-x\right )\,\left (b-x\right )}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________