This comes from the matrix
$$L = \begin{pmatrix} V(1) & 1 & 0 & \cdots & 0 & 1 \\ 1 & V(2) & 1 & & & 0 \\ 0 & 1 & V(3) & 1 & & \vdots \\ \vdots & & & \ddots & & 0 \\ 0 & & & 1 & V(q-1) & 1 \\ 1 & 0 & \cdots & 0 & 1 & V(q) \end{pmatrix},$$
where $$V(k) = 2 \cos(2 \pi k p/q)$$ for integer p and q.

Hofstadter's butterfly is a fractal arising from non-interacting electrons in a magnetic field. We can draw it by computing the eigenvalues of the system's Hamiltonian and plotting values of the Lyapunov exponent. Here's a shader that does just that! shadertoy.com/view/7s2XRt

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!