Accurately evaluating the hypergeometric function

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?

-
Try this Block[{$MaxExtraPrecision = 100}, N[Hypergeometric2F1[1, 1, 200, -1], 17]] – Spawn1701D Jun 7 at 18:54 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[]. – Ｊ. Ｍ. Jun 7 at 19:02 Thanks 0x4A4D. Please feel free to submit this as an answer. – Doubt Jun 7 at 21:14 add comment 1 Answer 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.

-