A LaTeX version of Mumford's impression of Spec Z[x], or some TikZ tricks
Notice: The post An atlas of the affine line over the integers and the page An atlas for $\mathrm{Spec}\,\mathbb{Z}[x]$ might be interesting if you came here by your favourite search engine.
As promised on Twitter I decided to draw a TeX version of Mumford's drawing of an elusive object: $\mathrm{Spec}\,\mathbb{Z}[x]$
This can be considered as the first non-trivial example in scheme theory. Mumford's treasure map tries to depict how we could (but we can't or shouldn't for a myriad of reasons) visualize its geometry. The meaning behind it, as found in the mimeographed notes named The Red Book, is discussed thoroughly at neverendingbooks.org's series on Brave New Geometries.
So in case you don't know the drawing, we're talking about
The entire series (and by extension the weblog) is a must-read for every math student by the way! As a matter of fact, it was the strangeness and all the layers of meaning in this picture that first got me started in mathematics when I was still a CS student.
Anyhow, I won't go into any details concerning the drawing's many layers of meaning, the neverending author has done this better than I ever could. Although I would like to discuss one little remark he made when we were discussing this (and other) visualizations a few days ago which he didn't make explicitly in his own posts. A summary:
By connecting the points into a (smooth) curve, you suggest that local information is important. As in analysis the value in a point tells us something about the values near that point, for a certain amount of nearness. But the points corresponding to different prime numbers are by no means related to each other! There is a vast vacuum between to vertical lines and horizontal lines / curves, which we decided to fill by putting some (smooth) curve in there. Yet the information in one point conveys nothing about the values which look like they are near. We cannot say that consecutive primes are near, the smallest known prime (for the moment that would be 2) is as related to 3 as to the biggest Mersenne prime known nowadays which is 243112609-1.
I'm not saying this is a wonderful new insight, but of the entire talk I had with Lieven Le Bruyn on this subject, if I should stress one thing, it's this. Most other features of the drawing have a scheme-theoretical interpretation associated with, but this important remark stresses how this is nothing but an impression which is bound to fail on many aspects.
So we're going to reproduce that particular drawing? Kind of, but I will be basing myself on the second version, which is a bit less sketchy. It looks like
It's not that hard to reproduce this, but there are two non-trivial aspects to this: the construction of the curved line and the doodles in at the top and right edges.
Curved paths and relative tangents
The manual has a nice introduction to the construction of curved paths, using the .. controls (x,y) and (z,w) ..
construction. The example that's given is
which says
draw me a line from(0,0)
to(2,0)
but don't make it straight, make it a curve with tangents(1,1)
at the origin and(2,1)
at the end point.
Well, my nice discovery when drawing Mumford's map was that you can specify the tangents relatively! So the example from the manual becomes
Not a great improvement in this case, but when your coordinates become more difficult (which they did in my case) it's a relief to be able to specify your tangents relative from the current position. And the only part where this is mentioned (or better: used implicitly) in the manual is in the introduction to the chapter on Mathematical and Object-Oriented Engines and it is used in exactly the same way as I did, but it is rather easily overlooked.
Doodles
The other non-trivial part are the doodles. It took me a while to find it in the enormous TikZ manual, but using the decorations.pathmorphing
library which contains a random steps
decoration it's rather easy. At first I was trying to implement this like I implemented H-tree fractals, but this failed miserably. The random number generator didn't work the way I wanted (it seemed like it was reseeded every time) and it was hard to determine where you should go after having drawn the first part of the line. But using random steps
we can connect two points using a jagged line, that is generated at random (wonder, oh wonder). To create a full-fledged doodle, we iterate this procedure a couple of times. In case of the linear doodle in the lower-right corner this is done 6 times, in the quadratic doodle above it, 11 times. For the reason behind this, see neverendingbooks.org.
So a modified snippet from the result would be
I'm not saying this is the most elegant code, but it was a nice exercise so far.
Remark how the second (i.e., the printed) version (wrongly) depicts the doodle corresponding to $(2)$ with curls, which I believe to be wrong. Only the generic point captures information coming from all directions.
Now comes the possibility for generalization: use Sage to produce certain parts of the picture, depicting the behavior of other polynomials, for instance cyclotomic polynomials. This will have to wait a while as my exams are nearing but, but I would like to thank Lieven Le Bruyn so far for his explanation, motivation and inspiration. And his scan of the original mimeographed version.