Post Reply 
Stoneham's series
06-14-2024, 05:42 PM (This post was last modified: 06-17-2024 12:10 AM by Gerson W. Barbosa.)
Post: #19
RE: Stoneham's series
(06-12-2024 07:01 PM)Gerson W. Barbosa Wrote:  . n |2√2*Product((4k)^2/((4k)^2 - 1),{k,1,n})*(1 + 2/(32n + 15 + ContinuedFractionK[((4k)^2-1)^2/((2k)^2-1),32n + 16,{k,1,n}]))
.---+--------------------------------------------------------------------------------------------------------------------------
. 1 | 3.1412407295336494743353 | 25888/11655*√2
. 2 | 3.1415952167705760328966 | 1863108608/838692855*√2

This result is also a consequence of a connection of a series of Wallis-like products to the Viète's formula for \(\pi\), which I had never noticed before:

\(
\begin{align}
\space\space\space\space \prod _{n=1}^{\infty}{\frac {(2^kn)^2}{(2^kn)^2-1}}
\\
\\ &=\frac{\pi}{2} \space\space\space\space,\space k = 1 \\
\\ &=\frac{\pi}{2\sqrt{2}} \space\space\space\space,\space k = 2\\
\\ &=\frac{\pi}{4\sqrt{2-\sqrt{2}}} \space\space\space\space,\space k = 3\\
\\ &=\frac{\pi}{8\sqrt{2-\sqrt{2+\sqrt{2}}}} \space\space\space\space,\space k = 4\\
\\ &=\frac{\pi}{16\sqrt{2-\sqrt{2+\sqrt{2+\sqrt{2}}}}} \space\space\space\space,\space k = 5\\
\\ &\cdots
\end{align}
\)

This HP-42S/Free42 program computes Viète's results for k=3 and above. The program uses the original version of Viètes's formula in order to avoid cancellation errors. The steps 22 through 45 are optional. That's just an experimental method for obtaining a few extra digits of \(\pi\), kept in the stack register Y at program exit.

Code:

00 { 82-Byte Prgm }
01▸LBL "VWπ"
02 2
03 -
04 LASTX
05 STO 01
06 STO+ 01
07 RCL ST X
08 SQRT
09 RCL ST X
10▸LBL 00
11 RCL+ ST Z
12 SQRT
13 STO× ST Y
14 X<> 01
15 STO+ ST X
16 X<> 01
17 DSE ST T
18 GTO 00
19 R↓
20 RCL÷ 01
21 1/X
22 RCL 01
23 X↑2
24 16
25 ÷
26 RCL ST X
27 64
28 ÷
29 STO- ST Y
30 8
31 ÷
32 STO+ ST Y
33 2
34 ÷
35 STO- ST Y
36 4
37 ÷
38 STO+ ST Y
39 4
40 ÷
41 -
42 RCL× ST Y
43 1/X
44 RCL+ ST Y
45 X<>Y
46 END

44 XEQ "VWπ" ->

Y: 3.141592653589793238462643383279502
X: 3.141592653589793238462643366581728


—————

P. S.: This uses a better correction term for Viète's formula and works also for k=2:

Code:

00 { 79-Byte Prgm }
01▸LBL "VWπ"
02 DSE ST X
03 STO 01
04 0.5
05 1
06 0
07▸LBL 00
08 RCL× ST Z
09 RCL+ ST Z
10 SQRT
11 STO× ST Y
12 DSE ST T
13 GTO 00
14 2
15 RCL÷ ST Z
16 16
17 10
18 1/X
19 2
20 +
21 -8
22 Y↑X
23 3
24 -
25 10
26 ÷
27 X↑2
28 X↑2
29 -
30 15
31 X<>Y
32 ÷
33 2
34 RCL 01
35 Y↑X
36 SQRT
37 ×
38 X↑2
39 X↑2
40 1/X
41 RCL+ ST Y
42 X<>Y
43 END

44 XEQ "VWπ" ->

Y: 3.141592653589793238462643383279504
X: 3.141592653589793238462643366581725


On the HP-42S:

10 XEQ "VWπ" ->

Y: 3.14159265358
X: 3.14158772527


—————

P. P. S.: Stack-only, k≥2:

Code:


00 { 70-Byte Prgm }
01▸LBL "VWπ"
02 DSE ST X
03 2
04 0
05 N!
06▸LBL 00
07 2
08 STO× ST Z
09 RCL+ ST L
10 SQRT
11 ×
12 DSE ST Z
13 GTO 00
14 RCL÷ ST Y
15 1/X
16 X<>Y
17 112.5
18 ×
19 X↑2
20 2.1
21 -8
22 Y↑X
23 3
24 -
25 10
26 ÷
27 X↑2
28 X↑2
29 16
30 -
31 X↑2
32 X↑2
33 X<>Y
34 ÷
35 RCL+ ST Y
36 X<>Y
37 END

43 XEQ "VWπ" ->

Y: 3.141592653589793238462643383279500
X: 3.141592653589793238462643316488386


On the HP-42S:

2 XEQ "VWπ" ->

Y: 3.15140913388
X: 2.82842712476


3 XEQ "VWπ" ->

Y: 3.14221296121
X: 3.06146745893


10 XEQ "VWπ" ->

Y: 3.14159265358
X: 3.14158772527
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Stoneham's series - ttw - 06-04-2024, 01:31 PM
RE: Stoneham's series - KeithB - 06-04-2024, 02:20 PM
RE: Stoneham's series - Nigel (UK) - 06-04-2024, 03:37 PM
RE: Stoneham's series - Thomas Klemm - 06-04-2024, 03:34 PM
RE: Stoneham's series - Thomas Klemm - 06-04-2024, 07:57 PM
RE: Stoneham's series - Albert Chan - 06-04-2024, 08:44 PM
RE: Stoneham's series - Thomas Klemm - 06-05-2024, 04:20 AM
RE: Stoneham's series - Johnh - 06-07-2024, 07:55 PM
RE: Stoneham's series - Albert Chan - 06-07-2024, 08:54 PM
RE: Stoneham's series - Johnh - 06-08-2024, 03:07 AM
RE: Stoneham's series - Johnh - 06-08-2024, 05:02 AM
RE: Stoneham's series - Albert Chan - 06-08-2024, 05:16 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-09-2024, 10:36 PM
RE: Stoneham's series - Albert Chan - 06-11-2024, 05:12 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-12-2024, 07:01 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-14-2024 05:42 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-18-2024, 05:42 AM
RE: Stoneham's series - Namir - 06-09-2024, 10:55 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-09-2024, 11:04 PM
RE: Stoneham's series - Gerson W. Barbosa - 06-11-2024, 02:31 AM



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