There are two different issues:
suboptimal handling of elliptic integrals in Mathematica, this is why Integrate
with appropriate assumptions doesn't provide satisfactory results.
unsatisfactory feedback of assumptions on the results
Before of playing with assumptions let's slightly reformulate the problem by changing the integration variable (x -> z == x/b
):
$$ \int_{0}^{b} \sqrt{ \frac{(a-x)(b-x)}{x}} dx = b^{3/2} \int_{0}^{1} \sqrt{ \frac{(\frac{a}{b}-z)(1-z)}{z}} dz$$
Now the integral can be simply calculated with the appropriate assumption (a/b == c > 1
):
b^(3/2) Integrate[ Sqrt[(c - x) (1 - x)/x], {x, 0, 1}, Assumptions -> c > 1]
(1/(3 (-1 + c))) b^(3/2) (2 Sqrt[-1 + c] (-1 + c^2) EllipticE[1/(1 - c)]
- 2 c (Sqrt[-1 + c] (1 + c) EllipticK[1/(1 - c)]
- 2 I (-1 + c) (EllipticK[1 - c] - I EllipticK[c])))
Ad.1
The result is not manifestly real ( see also this answer) however it can be easily checked by choosing various constants, e.g. in the OP we had a == 2
and b == 1
, therefore
% /. c -> 2
1/3 (6 EllipticE[-1] - 4 (3 EllipticK[-1] - 2 I (EllipticK[-1] - I EllipticK[2])))
which is the same numerically as the exact integral
Chop @ N @ %
2.07216
Plot[ ReIm[(1/(3 (-1 + c))) (2 Sqrt[-1 + c] (-1 + c^2) EllipticE[
1/(1 - c)] - 2 c (Sqrt[-1 + c] (1 + c) EllipticK[1/(1 - c)]
- 2 I (-1 + c) (EllipticK[1 - c] - I EllipticK[c])))],
{c, 0, 5}, Evaluated -> True, Exclusions -> c == 1, PlotStyle -> Thick]
This plot demonstrates that the integral is real for c > 1
:

Mathematica 10 cannot simplify the result asssuming c > 1
,
one should play further with special functions or exploit capabilities of
MathematicalFunctionData
(new in version 11 ), which could help in providing manifestly real symbolic result.
Ad.2
The integral with a/b
instead of c
does not yield the result, evaluate e.g.
b^(3/2) Integrate[Sqrt[(a/b - x) (1 - x)/x], {x, 0, 1}, Assumptions -> a > b]
0<a<b
. I do not know if the answer is correct or not. Here is screen shot !Mathematica graphics $\endgroup$A > 0
means that the assumptionElement[A, Reals]
is unnecessary, as that is already automatically subsumed by the former. $\endgroup$