2

I want to evaluate accurately $f_n(x)={}_2F_1(-n, 1-x; 2; 2)$, where ${}_2F_1$ is the Gauss hypergeometric function. I am interested in the case with $x\in(0,2)$ and $n$ a natural number as large as possible. Fixed $n$, if one expands $f_n(x)$, it seems to consist of only positive coefficients (I don't know how to prove this), whose sum is equal to 1. However, I have tried myself a number of implementations and all of them are unstable for even rather small values of $n$. On the other hand, the existing comercial packages are not of much help either. For instance, in Matlab,

hypergeom([-400, 1 - 1.9], 2, 2)

returns -1.476649544606420e+10

and, in Mathematica,

Hypergeometric2F1[-400, 1 - 1.9, 2, 2]

returns 1.25542*10^58

Any suggestions would be highly appreciated, including how to generate them, etc. Thanks in advance.

User
  • 31
  • Mathematica seems to do better if you force it to do some symbolic work first. For instance, the Mathematica expression Simplify[Hypergeometric2F1[-400, 1 - x, 2, 2]] /. x -> 1.9 (that is, simplify ${_2}F_1(-400,1-x;2;2)$ to obtain some degree-$400$ polynomial, and then evaluate at $x=1.9$) gives the far more believable result 224.8712571980159. – Semiclassical Aug 19 '19 at 21:35
  • 1
    I suggest more precision. Try Hypergeometric2F1[-400, N[1-19/10, 50], 2, 2]. – Somos Aug 19 '19 at 21:39
  • 1
    As a followup on @Somos, the main point seems to be that Mathematica does just fine so long as you use a rational input and then ask for an approximation. So N[Hypergeometric2F1[-400, 1 - 19/10, 2, 2]] also works just fine. – Semiclassical Aug 19 '19 at 21:44
  • Thank you for your suggestions, they are very useful. However, I would like to design a code to evaluate the functions myself. Do you have any idea? – User Aug 19 '19 at 21:47
  • Use contiguous relations. There's a linear relation between $f_n(x), f_{n-1}(x), f_{n+1}(x)$ which could be used to evaluate the function starting from small $n$. See Wikipedia page for explicit forms for the contiguous relations – Yuriy S Aug 19 '19 at 22:51
  • Yuriy S, could you please add the Wikipedia link? – User Aug 20 '19 at 08:43
  • @User, here: https://en.wikipedia.org/wiki/Hypergeometric_function#Gauss'_contiguous_relations – Yuriy S Aug 20 '19 at 08:46
  • Sorry, but I still don't see why these relationships could be useful. In my case, $b$, $c$ and $z$ are always fixed, but the relationships involve changing always more than one parameter. – User Aug 20 '19 at 14:00

1 Answers1

3

Using the information in OEIS sequence A008309 I found that $$ {}_2F_1(1-n, 1-x; 2; 2) = \sum_{k=1}^n\sum_{j=k}^n x^{k-1}2^{j-1}{n-1 \choose j-1}S_1(j,k)/j! $$ where $S_1(.,.)$ is the Stirling number of the first kind. If you use the definition of the Hypergeometric function then you get $$ {}_2F_1(1-n, 1-x; 2; 2) = \sum_{k=0}^n \frac{2^k(1-n)_k (1-x)_k}{k! (k+1)!} $$ where $(.)_k$ is the Pochhammer symbol and $\,n>0.\,$ With any sum of numbers not all the same sign you may have to be careful about possible loss of significance. For $\,0<x<2\,$ the signs in the sum alternate with the maximum absolute value ocurring at around $\, k = 2/3n.\,$ If $\,n\,$ is large then you need to use enough precision to account for loss of significance.

For more practical advice I suggest reading DLMF Hypergeometric function 15.19 "Computation".

Somos
  • 35,251
  • 3
  • 30
  • 76
  • Since $n$ is natural, the signs of $(1-n)_k$ always alternate. In fact, this is the main obstacle I found when writing a piece of code myself. – User Aug 20 '19 at 13:58