The Most Irrational of Numbers

Today I have a new interactive demonstration for you!

Zoom in: W
Zoom out: S
Reset angle: 0
Switch mode (auto or user): Space
On “User Mode”:
– Increase angle: Up
– Decrease angle: Down

void setup() {
float r = 2;
float da = 0;
float dda = .0001;
boolean autoPlay = true;
void draw() {
text(“Angle = ” + (float)((int)(da*10000))/100. + “%”, width/2, 20);
text(“Zoom = ” + (float)((int)(r*100))/100., width/2, 35);
if (autoPlay)
text(“Mode: Auto”, width/2, 50);
text(“Mode: User”, width/2, 50);
int i = 0;
float angle = 0;
while (width/r > i) {
float x = r*i*cos(angle);
float y = r*i*sin(angle);
angle += 2*PI*da;
if (keyPressed) {
if (key == ‘w’)
r *= 1.01;
if (key == ‘s’)
r *= .99;
if (key == ‘0’)
da = 0;
if (!autoPlay) {
if (keyCode == UP)
da += dda;
if (keyCode == DOWN)
da -= dda;
if (autoPlay)
da += dda;
void keyReleased() {
if (key == ‘ ‘)
autoPlay = 1 – autoPlay;

(As always, zooming out too much will make things begin to lag. Also, fair warning, things start getting a little seizure-inducing around a zoom of .5 or less.)

Okay! Pretty, right? But what’s actually going on?

Each frame we are drawing a sequence of dots. We start at the center of the screen, and take constant radial steps outwards. And for each step, we apply some fixed angular rotation. This angular rotation is given as a percentage of 2π on the top of the screen, and is the thing being adjusted frame by frame (either automatically or based on your input, depending on which mode you choose).

What’s cool is what happens when you approach simple rational numbers. Take a look for yourself by going on “User” mode and bringing the angle to 10% (for 1/10), 14.28% (for 1/7), 25% (for 1/4), and so on. Here are two examples:

Screen Shot 2019-07-09 at 11.27.02 PMScreen Shot 2019-07-09 at 11.27.28 PM

Cool, right? At every rational number, we end up with a number of “spokes” corresponding to the denominator of our rational number. People sometimes describe the golden ratio Ф as the “most irrational number”, meaning that in some sense it is the most difficult to approximate by rational numbers. How does this look on our visualization? Check it out!

Screen Shot 2019-07-09 at 11.32.34 PM

And zooming out further, we see…

Screen Shot 2019-07-09 at 11.33.17 PM

We can see that using Ф as our angular rotation gives us the “least spokey” shape possible. As we zoom out further and further, we will always see our points looking basically evenly distributed across the angles at any given radius. This is a wonderfully visual way to understand the irrationality of Ф!

Leave a Reply