Thread View: comp.lang.forth
8 messages
8 total messages
Started by Krishna Myneni
Mon, 23 Nov 2026 16:42
Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Mon, 23 Nov 2026 16:42
Date: Mon, 23 Nov 2026 16:42
237 lines
10554 bytes
10554 bytes
In light of the recent announcement of the potential proof of the
Riemann hypothesis, I decided to check my implementation of Marcel
Hendrix's zzeta code. Per Riemann's hypothesis, the "non-trivial" roots
lie along a line in the complex plane, Re{s} = 1/2, Im{s} = t, where "s"
is the complex argument to the word ZZETA in MH's Forth code.
In my implementation, zzeta.4th, found in the kForth-64/32/Win-32
packages under forth-src/fsl/extras/ I had provided test code for both
the real and complex versions of the function; however, all of the
arguments, s, to the test code lay along the real axis (a comment within
the test code says that off-axis args are needed).
Below is code to verify the first hundred known roots of the Riemann
zeta function, along the "critical line", using zzeta.4th. Some of the
output is shown below. The first root sort of works -- the magnitude of
the zeta function is around 2e-9 at s = 1/2 + i* 14.13472514173469e0,
while the rest clearly are not close to zero. The precision being used
here is double precision. I'm not sure what the problem is. The next
step is to repeat this using the MPFR library.
--
KM
=== begin zzeta-verify-roots.4th ===
\ zzeta-verify-roots.4th
\
\ Verify the first 100 non-trivial roots of the Riemann zeta function.
\
\ The non-trivial roots of the Riemann zeta function were
\ hypothesized by Riemann to lie along the critical line,
\ Re(s) = 1/2 [1]. Preliminary proofs of the Riemann
\ hypothesis were publicized on 20 November 2026 by [2]--[3].
\
\ The location of the roots along the critical line i.e..
\ t = Im(s) for the first hundred roots [4] are checked against
\ a Forth implementation of the complex zeta function [5]
\ (zzeta.4th by Marcel Hendrix).
\
\ References:
\ 1. https://en.wikipedia.org/wiki/Riemann_hypothesis
\ 2. Levent Alpoge and Claude AI, https://alpo.ge/remark.pdf
\ 3. Ravi Vakil, on the unfinished proof by Alessandro M. Masullo,
\ "The Music of the Primes,"
\
https://math216.wordpress.com/2026/11/20/hurried-announcement-alessandro-masullo-grh/
\ 4. https://www.lmfdb.org/zeros/zeta/
\ 5. Marcel Hendrix, post on comp.lang.forth 30 April 2012;
\ ported for use with FSL by K. Myneni on 2 May 2012 --
\ see zzeta.4th in the kForth-64/32/Win32 packages.
\
\ Notes:
\ 1. Although the test code in zzeta.4th [5] passes at a relative
\ error of 2e-16, all complex arguments for the complex zeta
\ function used Im{s} = 0.
\
\ K. Myneni, 2026-11-23
\
include ans-words
include modules
include fsl/fsl-util
include fsl/complex
include fsl/extras/zzeta
100 constant N_ROOTS
N_ROOTS COMPLEX ARRAY t_roots{
\ The imaginary values of the first 100 roots of
\ the Riemann zeta function along the critical line
\ z = 0.5e + i*t, for t > 0.
( 1) 14.1347251417346937904572519835625e0
( 2) 21.0220396387715549926284795938969e0
( 3) 25.0108575801456887632137909925628e0
( 4) 30.4248761258595132103118975305840e0
( 5) 32.9350615877391896906623689640747e0
( 6) 37.5861781588256712572177634807053e0
( 7) 40.9187190121474951873981269146334e0
( 8) 43.3270732809149995194961221654068e0
( 9) 48.0051508811671597279424727494277e0
( 10) 49.7738324776723021819167846785638e0
( 11) 52.9703214777144606441472966088808e0
( 12) 56.4462476970633948043677594767060e0
( 13) 59.3470440026023530796536486749922e0
( 14) 60.8317785246098098442599018245241e0
( 15) 65.1125440480816066608750542531836e0
( 16) 67.0798105294941737144788288965221e0
( 17) 69.5464017111739792529268575265547e0
( 18) 72.0671576744819075825221079698261e0
( 19) 75.7046906990839331683269167620305e0
( 20) 77.1448400688748053726826648563047e0
( 21) 79.3373750202493679227635928771161e0
( 22) 82.9103808540860301831648374947706e0
( 23) 84.7354929805170501057353112068276e0
( 24) 87.4252746131252294065316678509191e0
( 25) 88.8091112076344654236823480795095e0
( 26) 92.4918992705584842962597252418105e0
( 27) 94.6513440405198869665979258152080e0
( 28) 95.8706342282453097587410292192467e0
( 29) 98.8311942181936922333244201386224e0
( 30) 101.3178510057313912287854479402924e0
( 31) 103.7255380404783394163984081086952e0
( 32) 105.4466230523260944936708324141119e0
( 33) 107.1686111842764075151233519630860e0
( 34) 111.0295355431696745246564503099445e0
( 35) 111.8746591769926370856120787167707e0
( 36) 114.3202209154527127658909372761910e0
( 37) 116.2266803208575543821608043120647e0
( 38) 118.7907828659762173229791397026999e0
( 39) 121.3701250024206459189455329704998e0
( 40) 122.9468292935525882008174603307700e0
( 41) 124.2568185543457671847320079661301e0
( 42) 127.5166838795964951242793237669060e0
( 43) 129.5787041999560509857680339061800e0
( 44) 131.0876885309326567235663724615015e0
( 45) 133.4977372029975864501304920426407e0
( 46) 134.7565097533738713313260641571699e0
( 47) 138.1160420545334432001915551902824e0
( 48) 139.7362089521213889504500465233824e0
( 49) 141.1237074040211237619403538184753e0
( 50) 143.1118458076206327394051238689139e0
( 51) 146.0009824867655185474025075964246e0
( 52) 147.4227653425596020495211850104316e0
( 53) 150.0535204207848803514324672369594e0
( 54) 150.9252576122414667618525246783058e0
( 55) 153.0246938111988961982565442551854e0
( 56) 156.1129092942378675697501893101691e0
( 57) 157.5975918175940598875305031584988e0
( 58) 158.8499881714204987241749947755403e0
( 59) 161.1889641375960275194373441293695e0
( 60) 163.0307096871819872433110390006880e0
( 61) 165.5370691879004188300389193548749e0
( 62) 167.1844399781745134409577562462105e0
( 63) 169.0945154155688214895058711814318e0
( 64) 169.9119764794116989666998435958216e0
( 65) 173.4115365195915529598461186493456e0
( 66) 174.7541915233657258133787624558669e0
( 67) 176.4414342977104188888926410578611e0
( 68) 178.3774077760999772858309354141843e0
( 69) 179.9164840202569961393400366120511e0
( 70) 182.2070784843664619154070372269880e0
( 71) 184.8744678483875088009606466172344e0
( 72) 185.5987836777074714665277042683928e0
( 73) 187.2289225835018519916415405861313e0
( 74) 189.4161586560169370848522890998453e0
( 75) 192.0266563607137865472836314255836e0
( 76) 193.0797266038457040474022057943760e0
( 77) 195.2653966795292353214631878148621e0
( 78) 196.8764818409583169486222639146962e0
( 79) 198.0153096762519124249199187022090e0
( 80) 201.2647519437037887330161334275482e0
( 81) 202.4935945141405342776866606378642e0
( 82) 204.1896718031045543307164383863137e0
( 83) 205.3946972021632860252123793906930e0
( 84) 207.9062588878062098615019679077537e0
( 85) 209.5765097168562598528356442898868e0
( 86) 211.6908625953653075639074867307192e0
( 87) 213.3479193597126661906391220210726e0
( 88) 214.5470447834914232229442010725905e0
( 89) 216.1695385082637002658695633544983e0
( 90) 219.0675963490213789856772565904373e0
( 91) 220.7149188393140033691155926339062e0
( 92) 221.4307055546933387320974751192761e0
( 93) 224.0070002546043352117288755285048e0
( 94) 224.9833246695822875037825236805285e0
( 95) 227.4214442796792913104614361606596e0
( 96) 229.3374133055253481077600833060557e0
( 97) 231.2501887004991647738061867700103e0
( 98) 231.9872352531802486037716685391979e0
( 99) 233.6934041789083006407044947325696e0
( 100) 236.5242296658162058024755079556632e0
N_ROOTS t_roots{ }fput
\ Compute the Riemann zeta function for imaginary
\ values along the critical line, and print their values
\ and magnitudes
0 ptr t{
variable n
: }zzeta-critical ( a n -- )
n ! to t{
precision
6 set-precision
n @ 0 ?DO
I 1+ 4 .r 2 spaces
t{ I } f@ fs. 2 spaces
0.5e0 t{ I } f@ zzeta zdup zs. 2 spaces
|z| fs. cr
LOOP cr
set-precision
;
cr
cr .( Computing the Riemann zeta function for the first ) N_ROOTS .
.( non-trivial roots.) cr
cr
cr .( # t zeta[0.5+i*t] |zeta| )
cr .( ------------------------------------------------------------ )
cr
t_roots{ N_ROOTS }zzeta-critical
=== end zzeta-verify-roots.4th ===
The output is given below.
=== begin output ===
include zzeta-verify-roots
FSL-UTIL V1.3d 21 Apr 2024 EFC, KM
Riemann Zeta Function Version 1.00 MHX
Computing the Riemann zeta function for the first 100 non-trivial roots.
# t zeta[0.5+i*t] |zeta|
------------------------------------------------------------
1 1.41347e+01 -2.10915e-09 + i2.10804e-09 2.98200e-09
2 2.10220e+01 -6.85728e-06 + i2.67185e-05 2.75845e-05
3 2.50109e+01 5.08203e-04 - i2.46217e-04 5.64706e-04
4 3.04249e+01 -5.57662e-03 + i1.97929e-03 5.91745e-03
5 3.29351e+01 -1.32444e-02 - i4.98160e-03 1.41503e-02
6 3.75862e+01 -1.48189e-02 + i9.63718e-02 9.75044e-02
7 4.09187e+01 7.92953e-02 + i4.20550e-02 8.97573e-02
8 4.33271e+01 7.00990e-02 + i1.91228e-01 2.03672e-01
9 4.80052e+01 1.53730e-01 - i2.52021e-01 2.95207e-01
10 4.97738e+01 1.44661e-01 + i2.43717e-01 2.83417e-01
11 5.29703e+01 7.01679e-01 - i2.28994e-01 7.38100e-01
12 5.64462e+01 6.63649e-01 - i1.22419e-01 6.74845e-01
13 5.93470e+01 2.19595e-01 - i4.66364e-01 5.15478e-01
...
=== output truncated ===
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Mon, 23 Nov 2026 17:33
Date: Mon, 23 Nov 2026 17:33
27 lines
2394 bytes
2394 bytes
On 11/23/26 10:42 AM, Krishna Myneni wrote:
> In light of the recent announcement of the potential proof of the
> Riemann hypothesis, I decided to check my implementation of Marcel
> Hendrix's zzeta code. Per Riemann's hypothesis, the "non-trivial" roots
> lie along a line in the complex plane, Re{s} = 1/2, Im{s} = t, where "s"
> is the complex argument to the word ZZETA in MH's Forth code.
>
...
> Below is code to verify the first hundred known roots of the Riemann
> zeta function, along the "critical line", using zzeta.4th. Some of the
> output is shown below. The first root sort of works -- the magnitude of
> the zeta function is around 2e-9 at s = 1/2 + i* 14.13472514173469e0,
> while the rest clearly are not close to zero. The precision being used
> here is double precision. I'm not sure what the problem is. The next
> step is to repeat this using the MPFR library.
> ...
I found the problem. The implementation of zzeta.4th contains a note
saying that it is only valid for Re(s) > 1. The critical line on which
the roots are located do not meet this condition (Re(s) = 1/2).
The effort is not wasted, though. I'm curious to see what MPFR does.
--
KM
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Wed, 25 Nov 2026 03:18
Date: Wed, 25 Nov 2026 03:18
72 lines
4410 bytes
4410 bytes
On 11/23/26 11:33 AM, Krishna Myneni wrote:
> On 11/23/26 10:42 AM, Krishna Myneni wrote:
> ...
>> Below is code to verify the first hundred known roots of the Riemann
>> zeta function, along the "critical line", using zzeta.4th. Some of the
>> output is shown below. The first root sort of works -- the magnitude
>> of the zeta function is around 2e-9 at s = 1/2 + i*
>> 14.13472514173469e0, while the rest clearly are not close to zero. The
>> precision being used here is double precision. I'm not sure what the
>> problem is. The next step is to repeat this using the MPFR library.
>> ...
>
>
> I found the problem. The implementation of zzeta.4th contains a note
> saying that it is only valid for Re(s) > 1. The critical line on which
> the roots are located do not meet this condition (Re(s) = 1/2).
> ...
Ok, it turns out that Re(s) > 1 is a limitation for the original
zzeta.4th code (version 1.00). The problem for working at s = 1/2 + i*t
is the number of terms in the series summation. I modified zzeta.4th for
the complex zeta function word, zzeta, to have an adjustable number of
terms based on |t|, the magnitude of the imaginary part of s. Now, I can
verify the first 11 roots along the critical line. The computed complex
zeta value blows up on the 12th root. I need to understand why this occurs.
Below is the verification of the first 11 non-trivial roots of the
Riemann zeta function using a modified version of zzeta.4th. Note that
the magnitude of the complex value of zeta is now less than 1E-14 for
the first 11 roots (s = 1/2 + i*t).
The revised zzeta.4th is currently in a sloppy state, but the only
significant change is the number of d_k terms, N, used by zzeta.
Previously N was fixed to be 16*14/10. For the complex calculation,
N = 16*14/10 + |int(t)|.
The paper which helped me troubleshoot this problem is,
"Numerical evaluation of the Riemann Zeta-function," by Xavier Gourdon
and Pascal Sebah, July 23, 2003, link:
http://numbers.computation.free.fr/Constants/Miscellaneous/zetaevaluations.pdf
--
KM
=== begin output ===
...
Computing the Riemann zeta function for the first 100 non-trivial roots.
# t zeta[0.5+i*t] |zeta|
------------------------------------------------------------
1 1.41347e+01 -1.36351e-15 + i1.13511e-15 1.77415e-15
2 2.10220e+01 3.61013e-16 + i1.12604e-15 1.18250e-15
3 2.50109e+01 -4.74235e-15 + i1.77554e-15 5.06384e-15
4 3.04249e+01 -3.74717e-15 - i5.49035e-15 6.64719e-15
5 3.29351e+01 -1.46043e-15 + i1.23007e-14 1.23871e-14
6 3.75862e+01 6.10083e-15 + i9.68264e-16 6.17719e-15
7 4.09187e+01 8.31176e-15 + i3.14978e-16 8.31773e-15
8 4.33271e+01 -1.54406e-14 - i9.43648e-15 1.80958e-14
9 4.80052e+01 -2.61365e-15 + i6.51994e-15 7.02430e-15
10 4.97738e+01 5.82551e-15 - i6.87336e-15 9.00997e-15
11 5.29703e+01 -3.83373e-16 - i8.86242e-15 8.87071e-15
12 5.64462e+01 nan + inan nan
13 5.93470e+01 nan + inan nan
14 6.08318e+01 nan + inan nan
...
=== truncated output ===
Re: Roots of the Riemann Zeta Function
Author: marcel hendrix
Date: Wed, 25 Nov 2026 07:59
Date: Wed, 25 Nov 2026 07:59
18 lines
1932 bytes
1932 bytes
On 11/25/2026 4:18 AM, Krishna Myneni wrote: > On 11/23/26 11:33 AM, Krishna Myneni wrote: >> On 11/23/26 10:42 AM, Krishna Myneni wrote: >> ... > Ok, it turns out that Re(s) > 1 is a limitation for the original > zzeta.4th code (version 1.00). The problem for working at s = 1/2 + i*t > is the number of terms in the series summation. [..] The newest mpc release uses 3 different sub-algorithms to compute the zeta function (special functions are not included in mpc 0.9, the version iForth is using). Borwein's algorithm that I selected originally is one of the three, so I suppose linking to mpc will now give arbitrary precision results everywhere. -marcel
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Wed, 25 Nov 2026 13:21
Date: Wed, 25 Nov 2026 13:21
28 lines
2314 bytes
2314 bytes
On 11/25/26 1:59 AM, marcel hendrix wrote:
> On 11/25/2026 4:18 AM, Krishna Myneni wrote:
...
>
>> Ok, it turns out that Re(s) > 1 is a limitation for the original
>> zzeta.4th code (version 1.00). The problem for working at s = 1/2 +
>> i*t is the number of terms in the series summation.
>
> [..]
>
> The newest mpc release uses 3 different sub-algorithms to compute the
> zeta function (special functions are not included in mpc 0.9, the
> version iForth is using). Borwein's algorithm that I selected originally
> is one of the three, so I suppose linking to mpc will now give arbitrary
> precision results everywhere.
>
That's good to know. I have v 1.3.1 of libmpc installed, but I don't yet
have an interface for it in kForth. There is no zeta function listed in
the version 1.3.1 mpc.h header file.
I can do some initial checks for the double precision version of
zzeta.4th for Re{s} > 0, Im{s} = t, for points in the complex plane not
on the real axis, using Wolfram Alpha.
--
KM
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Thu, 26 Nov 2026 04:08
Date: Thu, 26 Nov 2026 04:08
45 lines
3017 bytes
3017 bytes
On 11/24/26 9:18 PM, Krishna Myneni wrote:
> On 11/23/26 11:33 AM, Krishna Myneni wrote:
...
>> The implementation of zzeta.4th contains a note
>> saying that it is only valid for Re(s) > 1. The critical line on which
>> the roots are located do not meet this condition (Re(s) = 1/2).
>> ...
>
> Ok, it turns out that Re(s) > 1 is a limitation for the original
> zzeta.4th code (version 1.00). The problem for working at s = 1/2 + i*t
> is the number of terms in the series summation. I modified zzeta.4th for
> the complex zeta function word, zzeta, to have an adjustable number of
> terms based on |t|, the magnitude of the imaginary part of s. ...
> The revised zzeta.4th is currently in a sloppy state, but the only
> significant change is the number of d_k terms, N, used by zzeta.
> Previously N was fixed to be 16*14/10. For the complex calculation,
>
> N = 16*14/10 + |int(t)|.
>
The revised zzeta.4th works pretty well along the line,
Re{s} = 0, Im{s} = t
i.e., along the imaginary axis, for t = 0 to 5. In this interval ZZETA
provides a typical accuracy of 14 decimal digits (using double precision
fp arithmetic). I have seen points where the accuracy degrades to 12 or
13 decimal digits in this interval. Still, it is pretty decent.
I want to extend the range of t, ideally to cover the interval 0--260,
and then check the accuracy for the same set of t values on the critical
line (Re{s} = 1/2, Im{s} = t). I find that my current implementation of
ZZETA begins generating nans somewhere above t = 50 e.g.
0e 50.0e zzeta zs.
-1.47121258862529e+00 + i1.19980232685049e-01 ok
0e 60.0e zzeta zs.
nan + inan ok
The factorials in the calculation may be overflowing.
--
KM
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Sat, 28 Nov 2026 03:53
Date: Sat, 28 Nov 2026 03:53
52 lines
2928 bytes
2928 bytes
On 11/25/26 10:08 PM, Krishna Myneni wrote:
...
> I want to extend the range of t, ideally to cover the interval 0--260,
> and then check the accuracy for the same set of t values on the critical
> line (Re{s} = 1/2, Im{s} = t).
Below is a table of the absolute errors for the complex zeta values
produced by the revised zzeta.4th, as a function of t, along the
critical line for the Riemann zeta function, over the range t = 0 to 50.
In double precision floating point ZZETA can provide 12 digits of
accuracy at t=50, which is not bad for a series sum of 72 terms. The
calculation was performed with kforth64.
The absolute errors were obtained by subtracting reference values from
the output of ZZETA. The reference values of the zeta function were
obtained from Wolfram Alpha -- differences are scaled by 1.0E16 in the
table below.
--
KM
=== begin table ===
\ Errors are specified in units of 1E-16
\ err1 is the absolute error in ZZETA real part
\ err2 is the absolute error in ZZETA imaginary part
\ 62 digit reference values were obtained from Wolfram Alpha
\ error was computed in double precision
( t err1 err2 )
0. 8.9 0.
0.25 2.2 4.4
0.5 12.8 4.4
1.0 -3.9 -3.3
1.5 3.9 -3.3
2.0 -0.6 -0.6
2.5 -5.6 6.9
3.0 -2.2 2.4
3.5 -1.1 3.3
4.0 1.1 2.9
4.5 1.1 -1.4
5.0 4.4 1.7
6.0 -5.6 -10.5
7.0 11.1 -6.1
8.0 -13.3 3.3
9.0 -46.6 14.7
10.0 -22.2 38.2
15.0 -5.6 -14.4
20.0 64.9 -24.4
30.0 -40.7 -13.3
40.0 -41.1 -144.3
50.0 103.3 130.5
=== end output ===
Re: Roots of the Riemann Zeta Function
Author: Krishna Myneni
Date: Sat, 28 Nov 2026 19:21
Date: Sat, 28 Nov 2026 19:21
22 lines
2202 bytes
2202 bytes
On 11/27/26 9:53 PM, Krishna Myneni wrote:
> On 11/25/26 10:08 PM, Krishna Myneni wrote:
> ...
>> I want to extend the range of t, ideally to cover the interval 0--260,
>> and then check the accuracy for the same set of t values on the
>> critical line (Re{s} = 1/2, Im{s} = t).
> Below is a table of the absolute errors for the complex zeta values
> produced by the revised zzeta.4th, as a function of t, along the
> critical line for the Riemann zeta function, over the range t = 0 to 50. ...
The test results of the zzeta.4th (v1.1) calculations and reference
values may be viewed at
https://ccreweb.org/software/zeta/forth/zzeta-tests_v1.1.txt
The text file will be updated as new results are added. The file is
intended to be human readable and eventually INCLUDEable from Forth to
provide all data within arrays, but this is not yet complete.
--
KM
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads