The truncated BBP formula for $\pi$ is \begin{align*} S_{n}=\sum_{k=0}^{n}\left( \frac{4}{16^k(8k+1)} -\frac{2}{16^k(8k+4)} -\frac{1}{16^k(8k+5)} -\frac{1}{16^k(8k+6)}\right) \end{align*} where $\lim_{n\to\infty}S_n=\pi$. Is possible to find an upper bound for $|S_n-\pi|$ that is, $|S_n-\pi|<f(n)$ where $\lim_{n\to\infty}f(n)=0$ ? I played around with SageMath and conjectured that $f(n)=1/n!^3$ is acceptable. But this could be false. (Edit: to find this upper bound actually I changed the upper limit of $S_n$ from $n$ to $n \ln n$
Can we estimate the difference between $S_n-\pi$ where $S_n$ is the truncated BBP formula for $\pi$?
135 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
We have $$f(a)=\sum_{k=n+1}^\infty \frac 1{16^k (8 k+a) }=2^{\frac{a}{2}-3} B_{\frac{1}{16}}\left(n+1+\frac{a}{8},0\right)$$ which gives $$A_n=\pi-S_n=\frac 1 {\sqrt 2}B_{\frac{1}{16}}\left(n+\frac{9}{8},0\right)-B_{\frac{1}{16}}\left(n+\frac{3}{2},0\right)-$$ $$\frac 1 {\sqrt 2}B_{\frac{1}{16}}\left(n+\frac{13}{8},0\right)-B_{\frac{1}{16}}\left(n+\frac{7}{4},0\right)$$ but the asymptotics of the incomplete beta function are not the most pleasant.
Considering instead
$$g(a)=\int_{n+1}^\infty \frac {dk}{16^k (8 k+a) }=-2^{\frac{a}{2}-3} \text{Ei}\left(-\frac{8( n+1)+a}{2} \, \log(2)\right)$$ and using asymptotics, the continuous equivalent of $A_n$ is $$B_n=\frac{15}{ 2^{4 (n+3)}\,n^2\, \log (2)}$$
Numerically, for large values of $n$, $A_n \sim 3 B_n$. So, as an approximation, $$\large\color{blue}{\pi-S_n\sim\frac{45}{ 2^{4 (n+3)}\,n^2\, \log (2)}}$$
This would imply that, to obtain an error smaller than $10^{-m}$, the number of terms to be added in the original summation is $$\frac 1 {2\log(2)} \,W\left(\frac 3 {32}\, \sqrt{5\,\log(2)}\, 10^{\frac m 2} \right)$$ For $m=50$, this would give $37.4165$.
Checking $$\pi -\sum_{k=0}^{37}=2.96\times 10^{-50}\qquad \qquad \text{not correct}$$ $$\pi -\sum_{k=0}^{38}=1.76\times 10^{-51}\qquad \qquad \text{correct}$$
Edit
Computing the $A_n$ for $10\leq n \leq 1000$ (step of $10$) a linear regression $$\log(A_n)= \alpha+\beta \,\log(n)+\gamma\, n$$ gives $(R^2=0.9999999999368)$
$$\begin{array}{l|lll} \text{} & \text{Estimate} & \text{Std Error} & \text{Confidence Interval} \\ \hline \alpha & -4.466375 & 0.014624 & \{-4.49540,-4.43735\} \\ \beta & -1.940857 & 0.003201 & \{-1.94721,-1.93450\} \\ \gamma & -2.772704 & 0.000010 & \{-2.77272,-2.77268\} \\ \end{array}$$ which can be compared to the coefficients in the blue formula $$\log \left(\frac{45}{4096 \log (2)}\right)=-4.14459$$ $$-4\log(2)=-2.77259$$
On
Another approach.
By Taylor $$\frac{4}{8k+1}-\frac{2}{8k+4}-\frac{1}{8k+5}-\frac{1}{8k+6}=\sum_{m=2}^\infty \frac {a_m}{k^m}$$ where
$$a_m=(-1)^m \frac {15\times 4^m+6\times 5^m+5\times 6^m-120 } {15 \times 2^{3 m+1}}$$ $$\sum_{k=n+1}^\infty\frac 1{16^k\,k^m}=16^{-(n+1)} \Phi \left(\frac{1}{16},m,n+1\right)$$ By Taylor $$\Phi \left(\epsilon,m,n+1\right)=\sum_{p=0}^\infty \frac{\epsilon^p}{(n+p+1)^m }$$ makes $$\frac{1}{(n+1)^m }<\Phi \left(\epsilon,m,n+1\right)<\frac{1}{(1-\epsilon )\,(n+1)^m }$$
So $$C_n < A_n=\pi-S_n < \frac {16} {15} C_n$$ with $$C_n =\frac 1 {2^{4(n+1)}}\,\frac{120 n^2+391 n+318}{(2 n+3) (4 n+7) (8 n+9) (8 n+13)}$$ and $$C_n = \frac {15} {2^{4 n+10}\, n^2}\,\left(1+O\left(\frac{1}{n}\right) \right)$$
First, note that \begin{align*} \sum\limits_{k = n + 1}^\infty {\frac{1}{{16^k (8k + m)}}} & = \frac{1}{{16^{n + 1} 8}}\sum\limits_{k = 0}^\infty {\frac{1}{{16^k ((n + 1) + k + m/8)}}} \\ & = \frac{1}{{16^{n + 1} 8}}\sum\limits_{k = 0}^\infty {\frac{1}{16^k }\int_0^{ + \infty } {{\rm e}^{ - (n + 1)t} {\rm e}^{ - kt}{\rm e}^{ - mt/8} {\rm d}t} } \\ & = \frac{1}{{16^{n + 1} 8}}\int_0^{ + \infty } {{\rm e}^{ - (n + 1)t} {\rm e}^{ - mt/8} \sum\limits_{k = 0}^\infty {\frac{{{\rm e}^{ - kt} }}{{16^k }}} {\rm d}t} \\ & = \frac{2}{{16^{n + 1} }}\int_0^{ + \infty } {{\rm e}^{ - (n + 1)t} \frac{{{\rm e}^{ - mt/8} }}{{16 - {\rm e}^{ - t} }}{\rm d}t} , \end{align*} for any $n\ge 0$ and $m\ge 0$. Thus, we can re-write the tail as an integral: $$\tag{1} \pi - S_n = \frac{2}{{16^{n + 1} }}\int_0^{ + \infty } {{\rm e}^{ - (n + 1)t} \frac{{4{\rm e}^{ - t/8} - 2{\rm e}^{ - 4t/8} - {\rm e}^{ - 5t/8} - {\rm e}^{ - 6t/8} }}{{16 - {\rm e}^{ - t} }}{\rm d}t} . $$ It can be verified that $$\tag{2} \frac{1}{t} \times \frac{{4{\rm e}^{ - t/8} - 2{\rm e}^{ - 4t/8} - {\rm e}^{ - 5t/8} - {\rm e}^{ - 6t/8} }}{{16 - {\rm e}^{ - t} }} $$ is completely monotonic for $t\ge 0$ (see below). Thus, in particular, $$ \frac{t}{8} - \frac{{7t^2 }}{{128}} \le \frac{{4{\rm e}^{ - t/8} - 2{\rm e}^{ - 4t/8} - {\rm e}^{ - 5t/8} - {\rm e}^{ - 6t/8} }}{{16 - {\rm e}^{ - t} }} \le \frac{t}{8} $$ for any $t>0$. Accordingly, $$\boxed{ \frac{1}{4}\frac{1}{{16^{n + 1} (n + 1)^2 }} - \frac{7}{{32}}\frac{1}{{16^{n + 1} (n + 1)^3 }} \le \pi - S_n \le \frac{1}{4}\frac{1}{{16^{n + 1} (n + 1)^2 }}} $$ for any $n\ge 0$. An application of Watson's lemma to $(1)$ yields the asymptotic expansion $${\small \pi - S_n \sim \frac{1}{4}\frac{1}{{16^{n + 1} (n + 1)^2 }}\left( {1 - \frac{7}{8}\frac{1}{{n + 1}} + \frac{{55}}{{64}}\frac{1}{{(n + 1)^2 }} - \frac{{595}}{{512}}\frac{1}{{(n + 1)^3 }} + \frac{{8551}}{{4096}}\frac{1}{{(n + 1)^4 }} - \ldots } \right)} $$ as $n\to+\infty$. It can be shown that by taking $\lfloor(4\log 2)(n + 1)\rfloor$ terms in this asymptotic expansion, the overall absolute error is $\mathcal{O}(n^{ - 1/2} \cdot 256^{ - n} )$.
To verify the complete monotonicity of $(2)$, we note that \begin{align*} & ( - 1)^n \frac{{{\rm d}^n }}{{{\rm d}t^n }}\frac{{4{\rm e}^{ - t/8} - 2{\rm e}^{ - 4t/8} - {\rm e}^{ - 5t/8} - {\rm e}^{ - 6t/8} }}{t} \\ & = \int_{1/8}^{6/8} {{\rm e}^{ - ts} s^n \left[ {4H(s - 1/8) - 2H(s - 4/8) - H(s - 5/8) - H(s - 6/8)} \right]{\rm d}s} \end{align*} and $$ ( - 1)^n \frac{{{\rm d}^n }}{{{\rm d}t^n }}\frac{1}{{16 - {\rm e}^{ - t} }} = \frac{1}{{16}}\sum\limits_{m = 0}^\infty {\frac{{m^n }}{{16^m }}{\rm e}^{ - mt} } $$ for any $t\ge 0$ and $n\ge 0$, with the combination of the Heaviside step functions $H$ being non-negative. Thus, $(2)$ being a product of two completely monotonic functions, is itself completely monotonic on $t\ge 0$.