Re: Numerical accuracy of Hypergeometric2F1

*To*: mathgroup at smc.vnet.net*Subject*: [mg55733] Re: Numerical accuracy of Hypergeometric2F1*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Tue, 5 Apr 2005 03:20:52 -0400 (EDT)*Organization*: The University of Western Australia*References*: <d2qj7t$p0o$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <d2qj7t$p0o$1 at smc.vnet.net>, "Christos Argyropoulos M.D." <chrisarg at fuse.net> wrote: > Hi, > Recently I ran into a problem in applied statistics which required > evaluation of a specific Hypergeometric2F1 functional i.e. > Hypergeometric2F1[k+1/2,1,3/2,x] where Element[k,Integers], k>0 , > Element[x, Reals] and 0<=x<=1. > It appears that for "large" values of k , Mathematica returns the wrong > answer . > If one re-writes the hypergeometric as a polynomial (using the distant > neighbor relation http://functions.wolfram.com/07.23.17.0007.01), get > rid of the ratio of Pochhamer functions and then examine the numerical > values given by the two formulations diverge. > \!\(fpol[x_, k_] := > Module[{}, coeff = Table[1, {k + 1}]; > For[i = 2, i \[LessEqual] k + 1, \(i++\), > coeff[\([i]\)] = > coeff[\([i - > 1]\)]\ \(\(-k\) + i - 1\)\/\(i - k - 1/2\)]; \ > {Hypergeometric2F1[k + 1/2, 1, 3/2, > x], \(1\/\(2 k - > 1\)\) \(\[Sum]\+\(i = 1\)\%\(k + 1\)\((\((1 - > x)\)\^\(-i\)\ \ > coeff[\([i]\)])\)\)}]\) > > In[4]:= > SetPrecision[fpol[0.7,100],16] > Out[4]= > \!\({\(-2.5109638442451095387366941924357`15.9546*^56\), > 2.0578481017803705921545468593643`15.9546*^51}\) No! You are applying SetPrecision to an expression that has been computed using machine precision. Instead you want to compute fpol[SetPrecision[0.7,20], 100] or fpol[0.7`20, 100] or N[fpol[7/10,100], 20] This has nothing to do with any specific Hypergeometric2F1. It is a general property of the way Mathematica's works with machine and arbitrary precision expressions. Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul