Elliptic Integrals: Mathematica and Gradshteyn and Ryzhik

Important Edit Made

Mathematica can perform the 3.31 integral, if Assumptions is changed from { a > b > c >= u} to {a > b > c > u}.

s = Integrate[1/Sqrt[(a - x) (b - x) (c - x)], {x, -Infinity, u}, 
    Assumptions -> {a > b > c > u}]
(* (2 EllipticF[ArcSin[Sqrt[(a - b)/(a - u)]], (a - c)/(a - b)])/Sqrt[a - b] *)

To compare this with the expression as given in Gradshteyn and Ryzhik (7th edition, 2007), it is important to realize that this compendium defines the second argument of Elliptic Integral F differently than from that in Mathematica. Comparing the second example under "Possible Issues" in the EllipticF documentation with 11.112 #2 of Gradshteyn and Ryzhik indicates that p^2 (see question) should be used as the second argument of the Gradshteyn and Ryzhik expression when employing the Mathematica representation of EllipticF; i. e.,

gr = 2 EllipticF[ArcSin[Sqrt[(a - c)/(a - u)]], (a - b)/(a - c)]/Sqrt[a - c]

which differs from s only by the interchange of b and c. But, it is obvious from the integrand of the integral above that the relative order of {a, b, c} is irrelevant. As verification, I have evaluated s and gr numerically for several parameters, for instance,

vals = Thread[{a, b, c, u} -> Reverse@Sort@RandomReal[{-5, 5}, 4]]
(* {a -> 3.47807, b -> 2.65797, c -> -1.04855, u -> -1.17253} *)

Chop[gr /. vals]
(* 1.38108 *)

Chop[s /. vals]
(* 1.38108 *)

and in each case they are the same and agree with the original integral evaluated numerically.

NIntegrate[1/Sqrt[(a - x) (b - x) (c - x)] /. vals, {x, -Infinity, u /. vals}, 
    Method -> {Automatic, "SymbolicProcessing" -> False}]
(* 1.38108 *)

Therefore, the apparent discrepancy between the result in Gradshteyn and Ryzhik (7th edition, 2007) and the corresponding Mathematica result is due merely to differences in notation.


Since TheDoctor mentioned my package, I'll present how to use CarlsonRF[] in conjunction with DLMF formula 19.29.4 to evaluate the three cases in Gradshteyn and Ryzhik's formula 3.131. Because CarlsonRF[] is Orderless, it is especially suitable for exploiting the inherent permutation symmetry in the given integrals.

Load the package first:

<<Carlson`

For case 1, this combines 19.29.4 with 19.29.6:

With[{cc = {{a, -1}, {b, -1}, {c, -1}, {1, 0}}, pairs = {{1, 2}, {1, 3}, {2, 3}}}, 
     2 Apply[CarlsonRF, 
             Table[With[{g1 = cc[[id]], g2 = cc[[Complement[Range[4], id]]]}, 
                   Apply[Times, Sqrt[-g2[[All, -1]]] Sqrt[g1.{1, u}]] + 
                   Apply[Times, Sqrt[-g1[[All, -1]]] Sqrt[g2.{1, u}]]],
                   {id, pairs}]^2]]
   2 CarlsonRF[a - u, b - u, c - u]

An example:

With[{c = 3, b = 5, a = 9, u = 1, prec = 25},
     {NIntegrate[1/Sqrt[(a - x) (b - x) (c - x)], {x, -∞, u}, WorkingPrecision -> prec],
      N[2 CarlsonRF[c - u, b - u, a - u], prec]}]
   {0.9688576532724524632309018, 0.9688576532724524632309018}

Case 2 and case 3 use 19.29.5 instead:

With[{cc = {{a, -1}, {b, -1}, {c, -1}, {1, 0}}, 
      pairs = {{1, 2}, {1, 3}, {2, 3}}, x = c, y = u}, 
     2 Apply[CarlsonRF, 
             Table[With[{g1 = cc[[id]], g2 = cc[[Complement[Range[4], id]]]},
                        (Apply[Times, Sqrt[g1.{1, x}] Sqrt[g2.{1, y}]] + 
                         Apply[Times, Sqrt[g2.{1, x}] Sqrt[g1.{1, y}]])/(x - y)],
                   {id, pairs}]^2]]
   2 CarlsonRF[(a - c) (b - c)/(c - u), (b - c) (a - u)/(c - u), (a - c) (b - u)/(c - u)]

With[{cc = {{a, -1}, {b, -1}, {-c, 1}, {1, 0}}, 
      pairs = {{1, 2}, {1, 3}, {2, 3}}, x = u, y = c}, 
     2 Apply[CarlsonRF, 
             Table[With[{g1 = cc[[id]], g2 = cc[[Complement[Range[4], id]]]},
                        (Apply[Times, Sqrt[g1.{1, x}] Sqrt[g2.{1, y}]] + 
                         Apply[Times, Sqrt[g2.{1, x}] Sqrt[g1.{1, y}]])/(x - y)],
                   {id, pairs}]^2]]
   2 CarlsonRF[(a - c) (b - c)/(-c + u), (b - c) (a - u)/(-c + u), (a - c) (b - u)/(-c + u)]

Here's an example for case 3:

With[{c = 3, b = 5, a = 9, u = 4, prec = 25},
     {NIntegrate[1/Sqrt[(a - x) (b - x) (x - c)], {x, c, u}, WorkingPrecision -> prec], 
      N[2 CarlsonRF[(a - c) (b - c)/(u - c), (b - c) (a - u)/(u - c), (a - c) (b - u)/(u - c)],
        prec]}]
   {0.6623825396975077898366125, 0.6623825396975077898366125}

(Someday, when I am much less occupied with other pressing stuff, I'll work on adding functionality for facilitating the symbolic use of the Carlson integrals. But not today.)