MP3 of the Riemann Zeta Function

The Riemann Zeta function on the critical line (z = 1/2 + i t for positive real t) looks a lot like a sound wave. So much so that I decided I ought to listen to it.

Here is a C program I used to compute (approximate) values of the Zeta function and write them to an existing WAV file. (I use an existing file to avoid having to know the header format). It writes the complex component to the left channel and the real component to the right.

The actual computation of the zeta function isn't that accurate, because I am using a series that doesn't converge very fast. I started with:

zeta(z) = 1/(1-21-z) SIGMA[n=1..inf] -1n-1 n-z

then split the odd and even terms to get:

zeta(z) = 1/(1-21-z) ( SIGMA[odd n>0] n-z - SIGMA[even n>0] n-z )

and combined pairs of terms to get:

zeta(z) = 1/(1-2^(1-z)) SIGMA[n=1..inf] ( (2n - 1)-z - (2n)-z )

This doesn't converge well enough for locating zeros of the Zeta function but is adequate for creating a sound wave.

The primary component of the sound (the loudest tone you hear) is the term

2 cos(theta(t))

in the first term of the infinite series for the Riemann-Siegel Z function. It rises in pitch at the rate

freq ~= K ln(t)

(which is related to the known result concerning the average spacing of the complex zeros). You can hear this tone "drop out" after about 15 seconds because the Zeta function was computed using 1000 terms of the above series for zeta(z), and the higher-frequency components are the ones that take longest to converge. The next-highest-frequency component drops out some time later. I actually kind of like this because if the high-frequency components did not drop out, it would be hard to hear the patterns in the lower-frequency components (which is where most of the structure is).

Riemann-Siegel Formulas

The Riemann-Siegel Z and theta functions define zeta(z) in terms of its argument (theta) and absolute value (Z) for a value of z equal to 1/2 + i t, by the relation:

Z(t) = zeta(1/2 + i t) ei theta(t)

For real t, Z(t) and theta(t) are both real, and we have:

theta(t) = (0 or pi) - arg (zeta(1/2 + i t))

magnitude( Z(t) ) = magnitude( zeta(1/2 + i t) )

Z and theta are defined in terms of each other, the Gamma function, power series coefficients, and a few other things.

Z(t) and theta(t) should be a really good way to calculate the Zeta function on the critical line. However, I have not been able to find sufficiently accurate descriptions of Z() and theta() to actually use in a computer program.

If you like this sort of thing, you might also be interested in these other pages having to do with recreational math:

My numbers and large numbers pages, and the RIES program, which finds algebraic equations given their solution and Hypercalc (the calculator that doesn't overflow).

© 1996-2008 Robert P. Munafo. This work is licensed under a Creative Commons Attribution 2.5 License.