Kloostermania, the program

While cleaning up a bit the files on my laptop recently, I “discovered” an old computer program that I had written some time in 2003 or so, to display the graphical evolution of the partial sums of exponential sums, and more precisely of Kloosterman sums. In other words, given a prime number p and integers a and b, this program plots the points in the complex plane corresponding to the values

S_k=\sum_{x=0}^{k}{\exp(2i\pi \frac{ax+b\bar{x}}{p})}

for

0\leq k\leq p-1,

and draws the line segments joining each successive Sk. (As usual, the bar over x indicates the inverse modulo p).

The resulting paths look fittingly psychedelic:

The rather badly written code (for moderately modern Linux systems) can be downloaded here; the compilation should be a straightforward

./configure ; make

the resulting executable kloostermania is then found in the src directory.

Alternatively, still for pretty recent Linux systems (at least, Fedora on Intel machines), you can get the executable here.

(I should probably state formally that the license is GPL, not that there’s much danger of a proprietary software company deciding to make a fortune and deprive mathematicians of much freedom to play with the code by selling derivatives of this program; of course, if anyone decides to add features or to make the program work, e.g., on Mac, this would be much appreciated…)

The program should be fairly easy to use; the File menu offers the possibility of saving the current picture as a PNG file or to print it to a PostScript file (the New and Open commands are just decoys). The Edit menu’s only interesting item is the Preference command, where the colors can be changed by clicking on the respective patches, and where the drawing of the axes can be disabled if desired. The View menu’s equally single item is used to enter the parameter for a new drawing; if the modulus p is not prime, the next prime will be selected (computed in a ridiculously inefficient way…) Finally, the current parameters and the final value of the sum are displayed at the bottom of the window…

Published by

Kowalski

I am a professor of mathematics at ETH Zürich since 2008.

6 thoughts on “Kloostermania, the program”

  1. I’m a bit lost (comparing with wikipedia): in your sum S_k the x should be a j, shouldn’t it ? And for a novice, what is expected to be apparent as a, b and p are varied? Thank you.

  2. or to make the program work, e.g., on Mac, this would be much appreciated…

    I was able to compile and run your program on Mac OS X without any modifications, after installing the gtk+ library via MacPorts. It seems to work just fine. This was on 10.5 (Leopard) using gcc 4.0.1 (build 5493) in XCode 3.1.3.

  3. Thanks for trying this! Could you send me the Mac binary? (To kowalski(at)math.ethz.ch ; I don’t have access easily to one to compile it myself.)
    I’ll set up a page on the blog with links to the source and the two executables.

    I think I’ll try next to add a “slide show” type of feature…

  4. You can grab it at here. It should work on any OS 10.5 system with an Intel processor, provided the gtk+ library is installed in /opt/local/lib, e.g. by installing MacPorts and then doing “sudo port install gtk2”.

Comments are closed.