Numerical Methods – Fastest Algorithm for Estimating Euler’s Constant $\gamma$

estimationeuler-mascheroni-constantlimitsnumerical methodssequences-and-series

What is the fastest algorithm for estimating Euler's Constant $\gamma \approx0.57721$?

Using the definition:

$$\lim_{n\to\infty} \sum_{x=1}^{n}\frac{1}{x}-\log n=\gamma$$

I finally get $2$ decimal places of accuracy when $n\geq180$. The third correct decimal place only comes when $n \geq638$. Clearly, this method is not very efficient (it can be expensive to compute $\log$).

What is the best method to use to numerically estimate $\gamma$ efficiently?

Best Answer

The paper "On the computation of the Euler constant $\gamma$" by Ekatharine A. Karatsuba, in Numerical Algorithms 24(2000) 83-97, has a lot to say about this. This link might work for you.

In particular, the author shows that for $k\ge 1$, $$ \gamma= 1-\log k \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1}}{(r-1)!(r+1)} + \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1} }{(r-1)! (r+1)^2}+\mbox{O}(2^{-k})$$

and more explicitly $$\begin{align*} -\frac{2}{(12k)!} - 2k^2 e^{-k} \le \gamma -1+&\log k \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1}}{(r-1)!(r+1)} - \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1} }{(r-1)! (r+1)^2}\\ &\le \frac{2}{(12k)!} + 2k^2 e^{-k}\end{align*}$$ for $k\ge 1$.

Since the series has fast convergence, you can use these to get good approximations to $\gamma$ fairly quickly.

Related Question