MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Erroneous Mathematica Kummer's (Hypergeometric1F1)

W. Brenig wrote:

>This excerpt from a notebook demonstrates that Mathematica's
>implementation of the confluent hypergeometric function is
>erroneous. The integral representation of the Hypergeometric1F1[]
>function is
>In[115]:= f11[m_, n_, z_] := ((n - 1)!/((n - m - 1)! (m - 1)!))
>   NIntegrate[Exp[ x z] x^(m - 1) (1 - x)^(n - m - 1), {x, 0, 1}];
>Now, we use this representation to evaluate f11 for two
>representative sets of parameters
>In[116]:= f11[5, 106, 10 Pi I]
>Out[116]= 0.101285+ 0.811816 \[ImaginaryI]
>In[117]:= f11[4.6, 105.3, 10 Pi I]
>Out[117]= 0.190397+ 0.80675 \[ImaginaryI]
>These values have also been tested to result on use of the
>routine CCHG(A,B,Z,CHG) for the confluent 1F1 hypergeometric
>function, copyrighted to Zhang and Jin, authors of the book
>'Computation of Special Functions', Wiley-Interscience, (1996).
>Next we use Mathematica's Hypergeometric1F1[] function with
>the same parameters
>In[121]:= N[Hypergeometric1F1[5, 106, 10 Pi I]]
>Out[121]= -5952. - 2512. \[ImaginaryI]
>In[122]:= N[Hypergeometric1F1[4.6, 105.3, 10 Pi I]]
>Out[122]= 0.190397+ 0.80675 \[ImaginaryI]
>Obviously the 1st result is different from f11's value.
>This is only one of many other examples, which show that
>Mathematica's Hypergeometric1F1[] is broken - at least for
>integer value input parameters.
Actually, Hypergeometric1F1 is working fine. What goes wrong is 
evaluating the result of 1F1 with machine numbers. As is typical of 
machine numbers when subtracting large numbers, catastrophic loss of 
precision occurs. Use extended precision numbers, as in:

In[463]:= N[Hypergeometric1F1[5, 106, 10 Pi I], 20]

Out[463]= 0.10128468746141561560+0.81181630676361012768 \[ImaginaryI]

When using extended precision numbers, Mathematica will internally 
generate numbers to higher precision to attempt to get a result with the 
requested precision. When using machine numbers, no such significance 
tracking is done.

Alternatively, use at least one machine number as an argument to 

In[464]:= Hypergeometric1F1[5., 106, 10 Pi I]

Out[464]= 0.101285+0.811816 \[ImaginaryI]

Carl Woll
Wolfram Research


  • Prev by Date: Software announcement: Adding bookmark for PDF generated from notebook
  • Next by Date: making a list using table but with different increment after a certain number
  • Previous by thread: Erroneous Mathematica Kummer's (Hypergeometric1F1) function
  • Next by thread: Re: Erroneous Mathematica Kummer's (Hypergeometric1F1)