Post Reply 
Yet another π formula
01-04-2021, 08:41 PM (This post was last modified: 01-04-2021 11:53 PM by Gerson W. Barbosa.)
Post: #1
Yet another π formula
The alternate sum of the factors of the Wallis product tends to \(\pi\)/4 - 1/2 as \(n\) tends to infinity:

\(\lim_{n\rightarrow \infty } \left [ \frac{1}{1\cdot 3}-\frac{1}{3\cdot 5}+\frac{1}{5\cdot 7}-\frac{1}{7\cdot 9}+\frac{1}{9\cdot 11}-\frac{1}{11\cdot 13}+\frac{1}{13\cdot 15}-\frac{1}{15 \cdot 17}\pm \cdots +\frac{(-1)^{n-1}}{4n^{2}-1}\right ]=\frac{\pi }{4}-\frac{1}{2}\)

This converges to the constant significantly faster than the Wallis Product. For 12 correct digits of \(\pi\) it requires \(\sqrt{10^{12}}\) terms instead of the \(10^{12}\) terms required by
Wallis. That's one million times as fast in this case, but obviously not enough for increasing numbers of digits. Fortunately, again, a correction continued fraction is possible which provides linear convergence, about 25/12 digits per term as the other formula.

\(\pi = \lim_{n\rightarrow \infty } \left [4\left ( \frac{1}{2} + \sum_{k=1}^{n}\frac{(-1)^{k-1}}{4k^{2}-1} \right )+\frac{(-1)^{n}}{2n(n+1)+\frac{3}{2}-\frac{3}{2n(n+1)+\frac{19}{2}-\frac{60}{2n(n+1)+\frac{51}{2}-\frac{315}{\frac{\ddots }{\cdots 2n(n+1)+\frac{8n(n-1)+3}{2}-\frac{n^{2}(4n^{2}-1)}{2n(n+1)+\frac{8n(n+1)+3}{2}}} }}}}\right ]\)

Tentatively, I think I can name this one as "Wasicki's formula" :-) Well, at least while an older equivalent version doesn´t appear around.

The algorithm is very simple, as tested on the HP-75C:

10 INPUT N
15 C=0
20 D=6*N*(N+1)+3/2
25 E=8*N
30 M=4*N*N-1
35 S=1
40 W=0
45 FOR K=1 TO N
50 W=W-S/M
55 C=-M*(M+1)/(4*(C+D))
60 M=M-E+4
65 D=D-E
70 E=E-8
75 S=-S
80 NEXT K
85 DISP S*(4*W+1/(C+D))+2
>run
?5
3.14159265359


I can get one thousand digits in little more than one fourth of a second on my old desktop computer, using that algorithm:

n =  480 

3.1415926535 8979323846 2643383279 5028841971 6939937510  (0050)
  5820974944 5923078164 0628620899 8628034825 3421170679  (0100)
  8214808651 3282306647 0938446095 5058223172 5359408128  (0150)
  4811174502 8410270193 8521105559 6446229489 5493038196  (0200)
  4428810975 6659334461 2847564823 3786783165 2712019091  (0250)
  4564856692 3460348610 4543266482 1339360726 0249141273  (0300)
  7245870066 0631558817 4881520920 9628292540 9171536436  (0350)
  7892590360 0113305305 4882046652 1384146951 9415116094  (0400)
  3305727036 5759591953 0921861173 8193261179 3105118548  (0450)
  0744623799 6274956735 1885752724 8912279381 8301194912  (0500)
  9833673362 4406566430 8602139494 6395224737 1907021798  (0550)
  6094370277 0539217176 2931767523 8467481846 7669405132  (0600)
  0005681271 4526356082 7785771342 7577896091 7363717872  (0650)
  1468440901 2249534301 4654958537 1050792279 6892589235  (0700)
  4201995611 2129021960 8640344181 5981362977 4771309960  (0750)
  5187072113 4999999837 2978049951 0597317328 1609631859  (0800)
  5024459455 3469083026 4252230825 3344685035 2619311881  (0850)
  7101000313 7838752886 5875332083 8142061717 7669147303  (0900)
  5982534904 2875546873 1159562863 8823537875 9375195778  (0950)
  1857780532 1712268066 1300192787 6611195909 2164201989  (1000)
  
Runtime: 0.27 seconds


Edited to correct a mistake, per Valentín Albillo’s note below.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Yet another π formula - Gerson W. Barbosa - 01-04-2021 08:41 PM
RE: Yet another π formula - Albert Chan - 01-05-2021, 10:50 PM
RE: Yet another π formula - Albert Chan - 01-06-2021, 01:32 AM
RE: Yet another π formula - Albert Chan - 01-07-2021, 09:56 PM
RE: Yet another π formula - toml_12953 - 01-06-2021, 02:10 AM
RE: Yet another π formula - ttw - 01-06-2021, 03:44 AM
RE: Yet another π formula - Albert Chan - 01-09-2021, 09:22 PM
RE: Yet another π formula - Albert Chan - 11-06-2021, 06:28 PM



User(s) browsing this thread: 1 Guest(s)