For rational y=p/q, define
f(x,y) = log[  det (L(y) x)  ]/q,
where L(y) is a q x q matrix with side diagonal entries 1 and diagonal entries
V(k) = 2 cos(2 k p/q ):
 V(1) 1 0 ... 0 1 
 1 V(2) 1 ... ... 0 
L(y)=  0 1 ... ... ... ... 
 ... ... ... ... 1 0 
 0 ... ... 1 V(q1) 1 
 1 0 ... 0 1 V(q) 

Physically, the xcoordinate is the energy. The y coordinate is related
to the magnetic flux.
The Hofstadter butterfly is the set, where f(x,y)=0. The picture is colored
according to the value of f(x,y). Mathematicians call the function f(x,y) a Lyapunov exponent.
It is also defined for irrational y through a limit.
Click on the picture to see a high resolution version
with 1900x1900 pixels. It has been computed in Mathematica by going up to q=1223.

