Optimal. Leaf size=92 \[ \frac {1}{4} (a-5 b) (b-x) \sqrt {\frac {-a+x}{b-x}}+\frac {1}{2} (b-x)^2 \sqrt {\frac {-a+x}{b-x}}-\frac {1}{4} (a-b) (a+3 b) \tan ^{-1}\left (\sqrt {\frac {-a+x}{b-x}}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 95, normalized size of antiderivative = 1.03, number of steps
used = 4, number of rules used = 4, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.210, Rules used = {1980, 466, 393,
209} \begin {gather*} -\frac {1}{4} (a-b) (a+3 b) \text {ArcTan}\left (\sqrt {-\frac {a-x}{b-x}}\right )+\frac {1}{2} (b-x)^2 \sqrt {-\frac {a-x}{b-x}}+\frac {1}{4} (a-5 b) (b-x) \sqrt {-\frac {a-x}{b-x}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 393
Rule 466
Rule 1980
Rubi steps
\begin {align*} \int x \sqrt {\frac {-a+x}{b-x}} \, dx &=-\left ((2 (a-b)) \text {Subst}\left (\int \frac {x^2 \left (a+b x^2\right )}{\left (1+x^2\right )^3} \, dx,x,\sqrt {\frac {-a+x}{b-x}}\right )\right )\\ &=\frac {1}{2} \sqrt {-\frac {a-x}{b-x}} (b-x)^2-\frac {1}{2} (-a+b) \text {Subst}\left (\int \frac {-a+b-4 b x^2}{\left (1+x^2\right )^2} \, dx,x,\sqrt {\frac {-a+x}{b-x}}\right )\\ &=\frac {1}{4} (a-5 b) \sqrt {-\frac {a-x}{b-x}} (b-x)+\frac {1}{2} \sqrt {-\frac {a-x}{b-x}} (b-x)^2-\frac {1}{4} ((a-b) (a+3 b)) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\sqrt {\frac {-a+x}{b-x}}\right )\\ &=\frac {1}{4} (a-5 b) \sqrt {-\frac {a-x}{b-x}} (b-x)+\frac {1}{2} \sqrt {-\frac {a-x}{b-x}} (b-x)^2-\frac {1}{4} (a-b) (a+3 b) \tan ^{-1}\left (\sqrt {-\frac {a-x}{b-x}}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.18, size = 99, normalized size = 1.08 \begin {gather*} \frac {\sqrt {\frac {-a+x}{b-x}} \left ((a-3 b-2 x) (b-x) \sqrt {-a+x}+\left (-a^2-2 a b+3 b^2\right ) \sqrt {b-x} \tan ^{-1}\left (\frac {\sqrt {-a+x}}{\sqrt {b-x}}\right )\right )}{4 \sqrt {-a+x}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(195\) vs.
\(2(80)=160\).
time = 0.05, size = 196, normalized size = 2.13
method | result | size |
risch | \(\frac {\left (a -3 b -2 x \right ) \left (b -x \right ) \sqrt {-\frac {a -x}{b -x}}\, \sqrt {-\left (b -x \right ) \left (a -x \right )}}{4 \sqrt {-\left (-b +x \right ) \left (-a +x \right )}}+\frac {\left (\frac {\arctan \left (\frac {x -\frac {b}{2}-\frac {a}{2}}{\sqrt {-a b +\left (a +b \right ) x -x^{2}}}\right ) a b}{4}-\frac {3 \arctan \left (\frac {x -\frac {b}{2}-\frac {a}{2}}{\sqrt {-a b +\left (a +b \right ) x -x^{2}}}\right ) b^{2}}{8}+\frac {\arctan \left (\frac {x -\frac {b}{2}-\frac {a}{2}}{\sqrt {-a b +\left (a +b \right ) x -x^{2}}}\right ) a^{2}}{8}\right ) \sqrt {-\frac {a -x}{b -x}}\, \sqrt {-\left (b -x \right ) \left (a -x \right )}}{a -x}\) | \(195\) |
default | \(\frac {\sqrt {-\frac {a -x}{b -x}}\, \left (b -x \right ) \left (\arctan \left (\frac {a +b -2 x}{2 \sqrt {-a b +a x +b x -x^{2}}}\right ) a^{2}+2 b \arctan \left (\frac {a +b -2 x}{2 \sqrt {-a b +a x +b x -x^{2}}}\right ) a -3 \arctan \left (\frac {a +b -2 x}{2 \sqrt {-a b +a x +b x -x^{2}}}\right ) b^{2}+2 \sqrt {-a b +a x +b x -x^{2}}\, a -6 \sqrt {-a b +a x +b x -x^{2}}\, b -4 \sqrt {-a b +a x +b x -x^{2}}\, x \right )}{8 \sqrt {-\left (b -x \right ) \left (a -x \right )}}\) | \(196\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 1.30, size = 130, normalized size = 1.41 \begin {gather*} -\frac {1}{4} \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} \arctan \left (\sqrt {-\frac {a - x}{b - x}}\right ) - \frac {{\left (a^{2} - 6 \, a b + 5 \, b^{2}\right )} \left (-\frac {a - x}{b - x}\right )^{\frac {3}{2}} - {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} \sqrt {-\frac {a - x}{b - x}}}{4 \, {\left (\frac {{\left (a - x\right )}^{2}}{{\left (b - x\right )}^{2}} - \frac {2 \, {\left (a - x\right )}}{b - x} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 73, normalized size = 0.79 \begin {gather*} -\frac {1}{4} \, {\left (a^{2} + 2 \, a b - 3 \, b^{2}\right )} \arctan \left (\sqrt {-\frac {a - x}{b - x}}\right ) + \frac {1}{4} \, {\left (a b - 3 \, b^{2} - {\left (a - b\right )} x + 2 \, x^{2}\right )} \sqrt {-\frac {a - x}{b - x}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x \sqrt {\frac {- a + x}{b - x}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 103, normalized size = 1.12 \begin {gather*} \frac {1}{8} \, {\left (a^{2} \mathrm {sgn}\left (-b + x\right ) + 2 \, a b \mathrm {sgn}\left (-b + x\right ) - 3 \, b^{2} \mathrm {sgn}\left (-b + x\right )\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 \mathrm {sgn}\left (-b + x\right ) - 3 \, b \mathrm {sgn}\left (-b + x\right ) - 2 \, x \mathrm {sgn}\left (-b + x\right )\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.34, size = 140, normalized size = 1.52 \begin {gather*} -\frac {\sqrt {-\frac {a-x}{b-x}}\,\left (\frac {a^2\,1{}\mathrm {i}}{4}+\frac {a\,b\,1{}\mathrm {i}}{2}-\frac {b^2\,3{}\mathrm {i}}{4}\right )\,1{}\mathrm {i}-{\left (-\frac {a-x}{b-x}\right )}^{3/2}\,\left (\frac {a^2\,1{}\mathrm {i}}{4}-\frac {a\,b\,3{}\mathrm {i}}{2}+\frac {b^2\,5{}\mathrm {i}}{4}\right )\,1{}\mathrm {i}}{\frac {{\left (a-x\right )}^2}{{\left (b-x\right )}^2}-\frac {2\,\left (a-x\right )}{b-x}+1}-\frac {\mathrm {atan}\left (\sqrt {-\frac {a-x}{b-x}}\right )\,\left (a-b\right )\,\left (a+3\,b\right )}{4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________