I am working on a $\pi$ estimation formula and I came up with the following series $$4\sum_{0}^{\infty}\frac{(1/5)^{2n+1}}{2n+1}-\sum_{0}^{\infty}\frac{(1/239)^{2n+1}}{2n+1}=\frac{\pi}{4}$$

How do I find how many terms are needed to give a value of $\pi$ accurate to $100$ decimal places? $b_{n+1}$ should be $\leq 1000001$ but how do I solve it, since I have two series?

  • 3
    $\begingroup$ Your formula is off, should be $$4\sum_{n=0}^{\infty}\frac{\color{red}{(-1)^n}(1/5)^{2n+1}}{2n+1}-\sum_{n=0}^{\infty}\frac{\color{red}{(-1)^n}(1/239)^{2n+1}}{2n+1}=\frac{\pi}{4}$$ $\endgroup$ – achille hui Aug 21 '16 at 5:39

As commented by achille hui, Machin' formula write $$\pi=16\sum_{n=0}^{\infty}\frac{(-1)^n(1/5)^{2n+1}}{2n+1}-4\sum_{n=0}^{\infty}\frac{(-1)^n(1/239)^{2n+1}}{2n+1}$$ that is to say $$\pi=\sum_{n=0}^{\infty}(-1)^n\frac{16(1/5)^{2n+1}-4(1/239)^{2n+1} }{2n+1}$$ Let $s_n$ be the sum of the first $n$ terms of this series. The series is alternating and and decreasing, so the $n^{\text{th}}$ remainder is such that $$| \pi-s_n | <\frac{16(1/5)^{2n+3}-4(1/239)^{2n+3} }{2n+3}=f_n$$ Generating a table of $\log_{10}(f_n)$ as a function of $n$ for $10 \leq n \leq 100$, a simple linear regression gives $$\log_{10}(f(n))=-1.40708 \,n-2.3825$$ So, if you need $k$ digits, you just need to solve $$-1.40708 n-2.3825=-k$$ that is to say $$n=-1.69323 + 0.710693 \, k$$

A more classical approximation is $$| \pi-s_n | \approx \frac 1 {25^n}$$ which will give $n=72$ for $100$ digits while the previous approximation would give $n=70$ (which is more accurate).

Rigorous calculations would show that $$f_{69}=3.16 \times 10^{-100}\qquad f_{70}=1.25 \times 10^{-101}\qquad f_{71}=4.92 \times 10^{-103}\qquad f_{72}=1.94 \times 10^{-104}$$


The second term is the expression being significantly smaller than the first one, we could considering that $$f_n \approx \frac{16(1/5)^{2n+3} }{2n+3}$$ and, so, we can have a good estimate of $n$ solving for $n$ equation$$\frac{16(1/5)^{2n+3} }{2n+3}=10^{-k}$$ the solution of which being $$2n+3=\frac{W\left(16 \times 10^k \times\log (5)\right)}{\log (5)}$$ where $W(z)$ is Lambert function. For large values of the argument, the Wikipedia page reports the approximation $$W(z)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\cdots$$ where $L_1=\log(z)$ and $L_2=\log(L_1)$.

For $k=100$, we then have $L_1\approx 233.507$, $L_2\approx 5.45321$ and applying the above (truncated formula), we find $n=69.3561$; so, $n=70$ again.

Notice that, if we truncate the expansion to the first term $W(z)\approx L_1$, we should get $n=-0.490805+0.715338 k$ which is very close to the regression result.

  • $\begingroup$ How did you get $\frac{1}{25}$ and n = 72 for more classical solution? $\endgroup$ – ReeSSult Aug 22 '16 at 2:55
  • 1
    $\begingroup$ It is a rule of thumb I found in a book many years ago but I do not remember which book. Then solving for $n$ equation $\frac 1 {25^n}=10^{-100}$ gives $n=71.5338$. $\endgroup$ – Claude Leibovici Aug 22 '16 at 3:13

Let $s(x) =\sum_{n=0}^{\infty} \dfrac{x^{2n+1}}{2n+1} $ and $s_m(x) =\sum_{n=0}^{m} \dfrac{x^{2n+1}}{2n+1} $.

Your sum is $4s(1/5)-s(1/239) $.

You want to get a bound on $s(x)-s_m(x)$ as a function of $x$ and $m$.

Let $t_m(x) =s(x)-s_m(x)$.


$\begin{array}\\ t_m(x) &=\sum_{n=m+1}^{\infty} \dfrac{x^{2n+1}}{2n+1}\\ &<\sum_{n=m+1}^{\infty} \dfrac{x^{2n+1}}{2m+1} \qquad\text{since } n > m\\ &=\frac1{2m+1}\sum_{n=m+1}^{\infty} x^{2n+1}\\ &=\frac{x}{2m+1}\sum_{n=m+1}^{\infty} x^{2n}\\ &=\frac{x}{2m+1}\sum_{n=m+1}^{\infty} (x^2)^{n}\\ &=\frac{x\ x^{2m+2}}{2m+1}\sum_{n=0}^{\infty} (x^2)^{n}\\ &=\frac{x^{2m+3}}{2m+1}\frac1{1-x^2}\\ \end{array} $

From this, you can get expressions that bound the error for each sum as a function of the number of terms.


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.