12
$\begingroup$

When I feed Mathematica the following integral:

Integrate[Sqrt[(A - x) (B - x)/x], {x, 0, B}]

it spits it back out without evaluating it. However, it can evaluate the integral

Integrate[Sqrt[(2 - x) (1 - x)/x], {x, 0, 1}]

just fine. From reading other questions, I think the problem is that I need to add more assumptions. I tried every assumption I know about:

Integrate[Sqrt[(A - x) (B - x)/x], {x, 0, B},
          Assumptions -> {A > 0, B > 0, A > B, x ∈ Reals, A ∈ Reals, B ∈ Reals}]

but Mathematica still won't do the integral. I know it has to be able to do the integral, since it can do it for definite values of $A$ and $B$ just fine! What other assumptions do I need to add to make it work?

$\endgroup$
4
  • $\begingroup$ Tried it on Maple. Maple 2016 gives an answer, by assuming 0<a<b. I do not know if the answer is correct or not. Here is screen shot !Mathematica graphics $\endgroup$
    – Nasser
    Dec 8, 2016 at 6:32
  • $\begingroup$ @Nasser: I think the Maple answer is correct ( An exacter answer is obtained by the AllSolutions option.) because numeric calculations for concrete values of the parameters confirm it. $\endgroup$
    – user64494
    Dec 8, 2016 at 7:52
  • $\begingroup$ @user64494 Consider registering your account, then you'll be able to reap all benefits of this site. $\endgroup$
    – Artes
    Dec 8, 2016 at 10:44
  • $\begingroup$ Note that adding the assumption A > 0 means that the assumption Element[A, Reals] is unnecessary, as that is already automatically subsumed by the former. $\endgroup$ Dec 11, 2016 at 3:29

3 Answers 3

12
$\begingroup$

There are two different issues:

  1. suboptimal handling of elliptic integrals in Mathematica, this is why Integrate with appropriate assumptions doesn't provide satisfactory results.

  2. 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: enter image description here

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]
$\endgroup$
4
$\begingroup$

Since Artes has already pointed to my previous answer, and my opinion remains unchanged to this very day, let me supply the closed form for your integral, obtained using formula 233.07 in Byrd and Friedman:

With[{A = 2, B = 1},
     {NIntegrate[Sqrt[(A - x) (B - x)/x], {x, 0, B}, WorkingPrecision -> 20], 
      N[2/3 (A/B)^(3/2) ((1 + B/A) EllipticE[B/A] - (1 - B/A) EllipticK[B/A]), 20]}]
   {2.0721594194996321471, 2.0721594194996321443}
$\endgroup$
1
$\begingroup$

With (0 <= x <= b <= a) the result of

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

can be transformed into the simple form

(2/3)*(Sqrt[a - x]*Sqrt[b - x]*Sqrt[x] + 
Sqrt[a]*(a + b)*EllipticE[ArcTan[Sqrt[x]/Sqrt[b - x]], b/a] - 
Sqrt[a]*(a - b)*EllipticF[ArcTan[Sqrt[x]/Sqrt[b - x]], b/a])

which can be verified by calculating the derivative w.r.t. x. The transformation involves a shift of Pi/2 of the argument and an expansion of the elliptic integrals of complex argument into real part and imaginary constant (disposable). Within the above range of parameters it may be plotted without difficulty:

a = 4; b = 2; Plot[{NIntegrate[(Sqrt[a - y]*Sqrt[b - y])/Sqrt[y], {y, 0, x}], 
(2/3)*(Sqrt[a - x]*Sqrt[b - x]*Sqrt[x] + 
Sqrt[a]*(a + b)*EllipticE[ArcTan[Sqrt[x]/Sqrt[b - x]], b/a] - 
Sqrt[a]*(a - b)*EllipticF[ArcTan[Sqrt[x]/Sqrt[b - x]], b/a])}, {x, 0, b}, 
PlotStyle -> {Blue, {Dashed, Orange}}]

The value at x=bcorresponds to the one obtained above with Byrd and Friedman.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.