Post Reply 
Riemann's Zeta Function - another approach (RPL)
07-30-2017, 04:17 PM (This post was last modified: 07-30-2017 04:19 PM by Gerson W. Barbosa.)
Post: #65
RE: Riemann's Zeta Function - another approach (RPL)
(07-30-2017 07:57 AM)Dieter Wrote:  BTW, I see your program has a RCL 00 in line 24. For x≤2 the ZETA routine leaves x in R00, but for x>2 R00 finally holds –x. Have you considered this?

Yes, that's what ABS in line 19 is for.

(07-30-2017 07:57 AM)Dieter Wrote:  BTW2, on 10-digit calculators 2 pi does not round very well, the last digit is 1 unit high. So I suggest to replace step 09/10 in your program with 360 D–R which returns the correct value 6,283185307. The same is true for pi/4 or pi/6 where 45 resp. 30 D–R yields ten correct digits.

That's a good suggestion, but we'd need x! (or Gamma) to be that accurate too. Is there a math module with x! or Gamma?

A few guard digits (perhaps just a couple of them) combined with built-in Gamma might give perfect 10-digit results most always, even when using 10-digits constants, which is quite impressive. On Free42:

 3 XEQ "Z"  -->   1.20205690313 (6)         
 2.001 R/S  -->   1.64399751259 (24)
 2     R/S  -->   1.64493406685         
 1.5   R/S  -->   2.61237534868 (9)
 0.5   R/S  -->  -1.46035450879 (81)
 0     R/S  -->  -0.50000000000
-0.5   R/S  -->  -0.207886224977
-1     R/S  -->  -0.0833333333333
-1.001 R/S  -->  -0.0831680372461 (281)
-1.5   R/S  -->  -0.0254852018937 (898)
-2     R/S  -->   0.0000000000000       
-3     R/S  -->   0.00833333333191 (333)
-5     R/S  -->  -0.00396825396801 (25)
-7     R/S  -->   0.00416666666663 (7)



Code:

00 { 57-Byte Prgm }
01▸LBL "Z"
02 X<0?
03 GTO 01
04 XEQ "ZETA"
05 GTO 02
06▸LBL 01
07 1
08 -
09 PI
10 STO+ ST X
11 X<>Y
12 Y↑X
13 STO 05
14 LASTX
15 +/-
16 GAMMA
17 STO× 05
18 LASTX
19 XEQ "ZETA"
20 STO× 05
21 1
22 RCL 00
23 ABS
24 -
25 1
26 ASIN
27 ×
28 SIN
29 RCL× 05
30 STO+ ST X
31▸LBL 02
32 END

Code:


00 { 359-Byte Prgm }
01▸LBL "ZETA"
02 STO 00
03 SQRT
04 -1
05 RCL+ 00
06 1/X
07 LASTX
08 X<0?
09 GTO 97
10 2
11 RCL 00
12 X>Y?
13 GTO 96
14 LASTX
15 LASTX
16 LASTX
17 -1,276ᴇ-8
18 ×
19 7,05133ᴇ-6
20 -
21 ×
22 9,721157ᴇ-5
23 +
24 ×
25 3,4243368ᴇ-4
26 -
27 ×
28 0,00484515482
29 -
30 ×
31 0,07281584288
32 +
33 ×
34 0,007215664988
35 +
36 GTO 98
37▸LBL 96
38 24
39 RCL 00
40 ÷
41 2
42 +
43 IP
44 STO+ ST X
45 22
46 X>Y?
47 X<>Y
48 STO 01
49 RCL 00
50 +/-
51 STO 00
52 CLX
53▸LBL 01
54 RCL ST Y
55 RCL 00
56 Y↑X
57 -
58 +/-
59 DSE ST Y
60 GTO 01
61 RCL 00
62 STO+ ST X
63 1
64 -
65 RCL 01
66 X↑2
67 24
68 ×
69 ÷
70 1
71 RCL- 00
72 8
73 ÷
74 RCL÷ 01
75 +
76 0,5
77 +
78 RCL+ 01
79 RCL 00
80 Y↑X
81 2
82 ÷
83 +
84 1
85 RCL+ 00
86 2
87 LN
88 ×
89 E↑X-1
90 +/-
91 ÷
92 GTO 99
93▸LBL 97
94 ENTER
95 ENTER
96 ENTER
97 -8,4715ᴇ-7
98 ×
99 7,51334ᴇ-6
100 -
101 ×
102 9,609657ᴇ-5
103 +
104 ×
105 3,42683396ᴇ-4
106 -
107 ×
108 0,00484527616
109 -
110 ×
111 0,07281583446
112 +
113 ×
114 0,007215664464
115 +
116▸LBL 98
117 R↓
118 1/X
119 IP
120 STO× ST Z
121 SIGN
122 STO÷ ST X
123 STO- ST Z
124 X<> ST L
125 R↓
126 ÷
127 -
128 R↑
129 0,57
130 +
131 +
132▸LBL 99
133 END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Riemann's Zeta Function - another approach (RPL) - Gerson W. Barbosa - 07-30-2017 04:17 PM



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