3.104 \(\int \sqrt {(b-x) (-a+x)} \, dx\)

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 71, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.267, Rules used = {1981, 612, 621, 204} \[ -\frac {1}{4} (a+b-2 x) \sqrt {x (a+b)-a b-x^2}-\frac {1}{8} (a-b)^2 \tan ^{-1}\left (\frac {a+b-2 x}{2 \sqrt {x (a+b)-a b-x^2}}\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

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])

Rule 612

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

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 1981

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

Rubi steps

\begin {align*} \int \sqrt {(b-x) (-a+x)} \, dx &=\int \sqrt {-a b+(a+b) x-x^2} \, dx\\ &=-\frac {1}{4} (a+b-2 x) \sqrt {-a b+(a+b) x-x^2}+\frac {1}{8} (a-b)^2 \int \frac {1}{\sqrt {-a b+(a+b) x-x^2}} \, dx\\ &=-\frac {1}{4} (a+b-2 x) \sqrt {-a b+(a+b) x-x^2}+\frac {1}{4} (a-b)^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 )\\ &=-\frac {1}{4} (a+b-2 x) \sqrt {-a b+(a+b) x-x^2}-\frac {1}{8} (a-b)^2 \tan ^{-1}\left (\frac {a+b-2 x}{2 \sqrt {-a b+(a+b) x-x^2}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.17, size = 106, normalized size = 1.49 \[ \frac {(a-x) \left ((a-b)^{5/2} \sqrt {b-x} \sqrt {\frac {a-x}{a-b}} \sinh ^{-1}\left (\frac {\sqrt {b-x}}{\sqrt {a-b}}\right )-(a-x) (b-x) (a+b-2 x)\right )}{4 (x-a) \sqrt {(a-x) (x-b)}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [A]  time = 0.42, size = 80, normalized size = 1.13 \[ -\frac {1}{8} \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \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 ) - \frac {1}{4} \, \sqrt {-a b + {\left (a + b\right )} x - x^{2}} {\left (a + b - 2 \, x\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.03, size = 61, normalized size = 0.86 \[ \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 )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((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)

________________________________________________________________________________________

maple [A]  time = 0.02, size = 122, normalized size = 1.72 \[ \frac {a^{2} \arctan \left (\frac {-\frac {a}{2}-\frac {b}{2}+x}{\sqrt {-a b -x^{2}+\left (a +b \right ) x}}\right )}{8}-\frac {a b \arctan \left (\frac {-\frac {a}{2}-\frac {b}{2}+x}{\sqrt {-a b -x^{2}+\left (a +b \right ) x}}\right )}{4}+\frac {b^{2} \arctan \left (\frac {-\frac {a}{2}-\frac {b}{2}+x}{\sqrt {-a b -x^{2}+\left (a +b \right ) x}}\right )}{8}-\frac {\left (a +b -2 x \right ) \sqrt {-a b -x^{2}+\left (a +b \right ) x}}{4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(((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 b-a zero or nonzero?

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int \sqrt {-\left (a-x\right )\,\left (b-x\right )} \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \sqrt {\left (- a + x\right ) \left (b - x\right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________