Post Reply 
Riemann's Zeta Function - another approach (RPL)
07-09-2017, 04:41 PM (This post was last modified: 07-09-2017 07:46 PM by Dieter.)
Post: #43
RE: Riemann's Zeta Function - another approach (RPL)
(07-08-2017 11:30 PM)Gerson W. Barbosa Wrote:  Do you have something as good as that for 12-digits calculators? Thanks!

As already mentioned, Excel's accuracy is a limiting factor here, as well as a really precise Zeta reference function. But at least I tried one more term, i.e. a sixth order approximation. This allows an error of about 5 units in the 12th significant digit.

Zeta(x) ~ 1/u + 0,577215664856 + 0,072815841255 u – 0,004845236518 u^2 – 0,000342577549 u^3 + 0,000096239872 u^4 – 0,000007417326 u^5 – 0,00000082183 u^6
where u = x – 1  and  0 ≤ x ≤ 1,05.

Evaluated with sufficient precision, the error is approx. 5 units in the 12th significant digit.
If my Zeta function is reasonably accurate, that is. ;-)

This lead to the idea of an improved 10-digit approximation. If the above coefficients are rounded in a certain way, not more than 10 digits are required for a similar accuracy. Only the first coefficient needs 11 digits, but this can be handled the way it is done in the following program.

First, prestore the following coefficients in the respective data registers:

R0 =   0,5772156649   (this actually should to be 0,57721566486, cf. R7)
R1 =   0,07281584126
R2 = –0,00484523652
R3 = –0,00034257755
R4 =   0,000096239874
R5 = –0,000007417325
R6 = –0,000000821829
R7 = –4 E–11   (this adjusts R0 so that R0+R7 yields the exact coefficient)

Here is the program.
On calculators with RCL-arithmetics a number of steps can be saved.

Code:
01 LBL A
02 1
03 -
04 ENTER
05 ENTER
06 ENTER
07 RCL 6
08 *
09 RCL 5
10 +
11 *
12 RCL 4
13 +
14 *
15 RCL 3
16 +
17 *
18 RCL 2
19 +
20 *
21 RCL 1
22 +
23 *
24 RCL 7     // at this point |x| is < 0,08 so that an adjustment by 4 E-11 is significant
25 +
26 RCL 0
27 +
28 R^
29 x>0? (TEST 1)
30 GTO 1
31 1        // use alternate method for better accuracy if x < 1
32 +
33 R^
34 /
35 +
36 1
37 -
38 RTN
39 LBL 1
40 1/x      // use simple addition of 1/(x-1) for x > 1
41 +
42 RTN

This way the returned 10-digit results should match the correctly rounded true Zeta values within 1 ULP.
In fact I could not observe any larger errors. If you do, please report here.
Actually on 10-digit calculators the domain for this approximation may be extended to 0 ≤ x ≤ 1,1062..., i.e. as long as Zeta ≥ 10.

Edit: after some testing with a few thousand random numbers single cases with larger errors appeared. The approximation seems fine, but the original program caused larger errors due to roundoff for results between 99 and 100, 999 and 1000 etc. So the modified program now uses two different ways of adding 1/(x–1) in its final steps, so that all results now should be within 1 unit of the last digit. At least I hope so. ;-)

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 - 07-09-2017 04:41 PM



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