7
$\begingroup$

As part of another problem, I am working to evaluate hypergeometric functions such as

Hypergeometric2F1[1, 1, n, -1]

for large $n$. I am hoping to obtain at least double-precision accuracy all the way through n = 1600. However, starting as low as n = 200, I obtain precision errors:

N[Hypergeometric2F1[1, 1, 200, -1], 17]
N::meprec: Internal precision limit

Are there ways to tell Mathematica it can use as much time as it wants to compute this quantity? Or are there any other workarounds?

$\endgroup$
  • $\begingroup$ Try this Block[{$MaxExtraPrecision = 100}, N[Hypergeometric2F1[1, 1, 200, -1], 17]] $\endgroup$ – Spawn1701D Jun 7 '13 at 18:54
  • 4
    $\begingroup$ Better: Hypergeometric2F1[1, 1, 200, N[-1, 17]]. The problem is that N[] is by default unable to cope with the exact result being returned by Hypergeometric2F1[]. $\endgroup$ – J. M. will be back soon Jun 7 '13 at 19:02
7
$\begingroup$

Before people get any ideas: although we have the identity:

$${}_2 F_1\left({{1,1}\atop{m}}\mid -1\right)=\frac{m-1}{2}\Phi\left(\frac12,1,m-1\right)$$

where $\Phi(z,s,a)$ is the Lerch transcendent; or, in Mathematica notation:

Hypergeometric2F1[1, 1, m, -1] == (m - 1) HurwitzLerchPhi[1/2, 1, m - 1]/2

the computation becomes even more unstable with that replacement (I'm not really sure why); don't use it.

In any event, we have the relations

$$\begin{align*} {}_2 F_1\left({{1,1}\atop{m}}\mid -1\right)&=2^{m-2}(m-1)\sum_{k=m-1}^\infty \frac1{k 2^k}\\ &=2^{m-2}(m-1)\left(\log\,2-\sum_{k=1}^{m-2}\frac1{k 2^k}\right) \end{align*}$$

where we see why N[] might have a spot of trouble with evaluating the exact expression produced by Hypergeometric2F1[]: $\sum\limits_{k=1}^{m-2}\frac1{k 2^k}\approx \log\,2$, with the difference getting smaller as $m\to\infty$, and we thus see a fair amount of catastrophic cancellation during numerical evaluation. In particular, for $m=200$, $\sum\limits_{k=1}^{m-2}\frac1{k 2^k}$ and $\log\,2$ agree to $61$ (!) decimal places.

Fortunately for us, Hypergeometric2F1[] can cope nicely with inexact arguments:

Hypergeometric2F1[1, 1, N[200, 20], -1]
   0.9950490265763910737

In short: just supply inexact numbers to Hypergeometric2F1[] at the outset.

$\endgroup$
0
$\begingroup$

Using something very unfancy like the Gauss hypergeometric ascending series will easily solve this problem. See http://dlmf.nist.gov/15.2 . It took me 12 terms for double-precision accuracy for n=200 and 8 terms for n=1600.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.