Post Reply 
Riemann's Zeta Function - another approach (RPL)
06-29-2017, 07:47 PM (This post was last modified: 06-30-2017 06:25 AM by Dieter.)
Post: #22
RE: Riemann's Zeta Function - another approach (RPL)
(06-28-2017 07:45 PM)Gerson W. Barbosa Wrote:  Three lines shorter:

Here is my first attempt at a HP41 version for x > 1. Maybe this or that can be reused in your 15C program, e.g. the use of less registers (the 15C would require R0...R2) or the DSE within the loop.

Code:
01  LBL"ZETA"
02  STO 00
03  1
04  -
05  LN     // generate error if x<=1
06  ,01
07  LastX
08  x>y?
09  GTO 00
10  1/x
11  LastX
12  LastX
13  ,9
14  *
15  13,7335
16  +
17  /
18  ,57721567
19  +
20  +
21  GTO 02
22  LBL 00
23  28
24  RCL 00
25  /
26  INT
27  1
28  +
29  ST+ X
30  STO 01
31  RCL 00
32  CHS
33  STO 00
34  CLX
35  LBL 01
36  RCL Y
37  RCL 00
38  y^x
39  -
40  DSE Y
41  RCL Y
42  RCL 00
43  y^x
44  +
45  DSE Y
46  GTO 01
47  RCL 00
48  ST+ X
49  1
50  -
51  24
52  /
53  RCL 01
54  x^2
55  /
56  1
57  RCL 00
58  -
59  8
60  /
61  RCL 01
62  /
63  +
64  ,5
65  +
66  RCL 01
67  +
68  RCL 00
69  y^x
70  2
71  /
72  +
73  1
74  RCL 00
75  +
76  2
77  LN
78  *
79  e^x-1
80  CHS
81  /
82  LBL 02
83  END

Edit: corrected an error in line 47

Your method for calculating the number of required terms of the sum is fine, actually I got the same result. However the program uses a shorter formula that yields very similar results. The final calculation with this power-of-2-fraction can cause significant errors for x close to 1, so I chose a different approach with the 41's e^x–1 function which should reduce the error here. The simplified Zeta evaluation is used for 1 < x ≤ 1,01. At x=1,01 both methods agree and return the correct result 100,5779433.

The examples in your first post (except the two cases that cannot be handled by the program above) are all evaluated to ten correct digits. But of course the program is not always that accurate. ;-)

Dieter
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) - Dieter - 06-29-2017 07:47 PM



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