Post Reply 
Riemann's Zeta Function - another approach (RPL)
08-08-2017, 06:46 PM (This post was last modified: 08-08-2017 06:58 PM by Dieter.)
Post: #83
RE: Riemann's Zeta Function - another approach (RPL)
(08-08-2017 04:05 AM)Gerson W. Barbosa Wrote:  Very nice!

Wait, it even gets a tiny bit nicer. ;-)

(08-08-2017 04:05 AM)Gerson W. Barbosa Wrote:  I would only make a minor modification. Not that one less square root evaluation really might make a difference in execution time in Free42:

Code:

13 LN
14 RCL× 00
15 RCL× ST T
16 RCL+ ST T
17 +/-

Ah, great. It's not beause of the sqrt, but I love this elegant stack content reuse of the 0.5 that still sits in T. ;-)

But there even is one more tweak. The second term of the Zeta Taylor series is quite exactly –x², i.e.  \(\zeta(x)\ \approx -(0.5+x^2+x\cdot\ln\sqrt{2 \pi})\).
And this can be implemented with just one more step:

Code:

13 LN
14 RCL× ST T
15 RCL+ 00
16 RCL× 00
17 RCL+ ST T
18 +/-

This way the threshold in line 08 should be somewhere near 1 E–8. The perfect value differs slightly for negative resp. positive x, but 8 E–9 works very nicely for both.

BTW, if you want to stick to the original implementation the perfect switchpoint seems to be close to 2 E–11, so this value should be used there. I edited my original post accordingly. But we're talking about differences beyond the 20th digit here. ;-)

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 - 08-08-2017 06:46 PM



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