Quadratic forms and Conway's topograph

Your browser does not support the canvas tag.

This application allows you to explore Conway's topographic method of understanding quadratic forms as described in his book The Sensual (quadratic) Form.

Conway's topograph is an infinite graph constructed as follows. The vertices are "lax superbases". A lax superbasis is a set of 3 lattice points {u,v,w} in Z2, each determined up to sign, such that any 2 of them are linearly independent, and ±u ±v ±w = 0 for some choice of signs. Two lax superbases are joined by an edge if they have 2 points in common.

Given any 2 linearly independent points u and v in Z2 there are exactly 2 ways to extend it to a lax superbasis. Thus each edge of the topograph corresponds to a "lax basis" of Z2 (lax = unordered and elements determined up to sign, as before). Also, given any lax superbasis {u,v,w} there are exactly 3 adjacent lax superbases, corresponding to edges {u,v}, {u,w}, and {v,w}. Thus every vertex of the topograph has degree 3. Conway proves that the topograph is a tree, i.e., it is connected and has no cycles. The "faces" of the topograph correspond to nonzero "lax points" in Z2.

The topograph itself is independent of any quadratic form, but given a quadratic form ax2 + bxy + cy2, we may additionally label each face with the value of the form evaluated at the (lax) point corresponding to the face. This is done in the picture at the left, which shows a portion of the topograph labelled for the quadratic form (a,b,c) = (1,1,1). The lax point labels are normalized so that the y coordinate is positive if possible, or if y=0, then the x coordinate is positive.

Conway demonstrates that the classification of the quadratic form is reflected in various features of the topograph.
For positive definite forms (b2 - 4ac < 0), there is a vertex which is a well (usually unique) surrounded by the 3 minimal positive values of the form.
For indefinite forms not representing 0 (b2-4ac > 0 but not a square), there is an infinite-length river separating positive values from negative values, and the values around the river repeat periodically.
For indefinite forms representing 0 (b2-4ac > 0 and a square), the river is finite and empties into 2 lakes (faces of value 0) in both directions.
For degenerate forms (b2 - 4ac = 0), there is a unique lake surrounded by values of one sign. (Except if a=b=c=0 where all faces are lakes.)

Using the application:
The arrow (initially centered) indicates your current position and direction in the topograph. You are always at the midpoint of an edge.
Pressing the left/right arrow key will move your forward in your current direction, followed by a left/right turn, to the midpoint of the next edge.
The down arrow key turns you around.
The space bar re-centers the screen at your current position (maintaining your direction) so you can see more of the topograph.
The enter key returns you home (i.e., to the position of the topograph where you started).
Use the form below the application to change the quadratic form.
If keys aren't working, click on any black space in the application first in order to bring keyboard focus to the application.

Built with Processing and Processing.js
Uses code from "Logo (turtle graphics) class & example" by Dj Faustus, licensed under Creative Commons Attribution-Share Alike 3.0 and GNU GPL license.

Change the quadratic form here:
a: b: c: