I need a numerically stable way to compute the following ratio:


All the parameters are real positive numbers, with $0 < a,b,c$ and $0 < x < 1$.

Right now I am using GSL's implementation of the hypergeometric function, but I keep getting under/over-flows.

Is there a simplification that I can use? Or an aproximation scheme that remains accurate for a wide range of the parameters (say $0 < a,b,c < 1000$)?

  • $\begingroup$ In a previous post, negative values of the parameters were the cause of trouble. That's why in this question I am restricting to positve values. $\endgroup$
    – becko
    Aug 18 '14 at 17:25
  • $\begingroup$ I suggest that you append the positive parameter case to your existing question on hypergeometric functions. The difference between these questions is very small, even though the difference in sign is important for convergence. $\endgroup$ Aug 18 '14 at 18:41
  • $\begingroup$ @GeoffOxberry I didn't want to do that because that question already has an answer, which wouldn't fit if I switched to positive parameters. $\endgroup$
    – becko
    Aug 18 '14 at 18:43
  • 1
    $\begingroup$ The algorithm Kirill proposed looked like it would work for the strictly positive case, so I don't see why you would invalidate his answer by adding to your question and saying something like "I'm also interested in the case where $a, b, c$ still vary over a wide range, but are strictly positive. If I restrict to $0 < a,b,c < 1000$, is there a simplification I can use, or an approximation scheme that remains accurate over that parameter range?". The trouble with your current approach is that the questions look almost the same, and discourages people from looking at the near-duplicate question. $\endgroup$ Aug 18 '14 at 18:51