Post Reply 
Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
10-23-2021, 02:49 PM
Post: #1
Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
FWIW,

A new method for the fast evaluation of ζ(2) using the definition as a basis

The series, 1 + 1/4 + 1/9 + 1/25 + 1/36 + 1/49…, converges very slowly to the exact result, π^2/6. In order to obtain n correct digits the series should be evaluated up to the (10^n)th term. However, the addition of n+1 terms of a simple continued fraction after the evaluation of the first n terms of the series will significantly speed up the rate of convergence, yielding slightly more than 2n correct digits.

For example,

for n = 3,

1+1/4+1/9+1/((3+1/2)+1/(12*(3+1/2)+16/(5*(3+1/2)+81/(28*(3+1/2))))) = 55783/33912 = 1.6449339

The coefficients of the denominators of the continued fraction, 12, 5, 28, 9, 44, 13…, obey the formula k(i) = (5 - 3*(-1)^i)*(i + 1/2). The numerators, 1, 16, 81, 256, 625, 1296…, are quite obvious.

HP-42S/Free42 program:

Code:

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

n = 12 on the HP-42S and n = 16 on Free42 will suffice for 12 and 34 correct digits, respectively.

6 XEQ “z” → 1.64493406685

16 XEQ “z” →

1.644934066848226436472415166646025


HP-71B BASIC program;

Code:

10 S=0
15 C=0
20 INPUT N
25 K=N+.5
30 A=3-6*MOD(N,2)
35 FOR I=N TO 1 STEP -1
40 S=S+1/(I*I)
45 C=I^4/(C+K*(5-A)*(I+.5))
50 A=-A
55 NEXT I
60 DISP S+1/(K+C)

RUN

? 6

1.64493406685


Interested readers are invited to provide

- optimized versions of the given programs;

- versions for other calculator, such as the HP-41;

- a proof (I don’t have any – this is the result of a Friday afternoon work only, which until minutes ago I thought to be a Saturday afternoon. Still looking like Sunday morning to me).

Pointing out typos and mistakes, either math or grammar related, are welcome.

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 10-23-2021 02:49 PM



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