My résumé as a plot of a mathematical formula

All the pixel art you see in the jupyter notebook which serves as my résumé has been made by plotting Tupper's self-referential formula using matplotlib.

Tupper's self-referential formula

If one plots the set of points (x, y) in 0 ≤ x < 106 and k ≤ y < k + 17 satisfying the inequality given below:

$$\displaystyle \frac12 < \left\lfloor \mathrm{mod} \left( \left\lfloor{\frac{y}{17}}\right\rfloor 2^{-17\lfloor x \rfloor - \mathrm{mod}(\lfloor y \rfloor, 17)}, 2 \right) \right\rfloor$$

where k is the following 543-digit integer:

In [1]:
k = 960939379918958884971672962127852754715004339660129306651505519271702802395266424689642\

The resulting plot looks like this:

In [2]:
%matplotlib inline 
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from numpy import vectorize
from matplotlib.colors import LinearSegmentedColormap

def plot(k):
    def tupper(x,y):
        return (y // 17 // 2 ** (17 * int(x) + int(y) % 17)) % 2 > 0.5
    custom_cmap = LinearSegmentedColormap.from_list('taxi_driver', ['gold','black'])
    X, Y = np.meshgrid(range(106), range(k, k + 17))
    Z = np.fliplr(tupper(X, Y))
    plt.figure(figsize = (106,17))
    plt.imshow(Z, interpolation='nearest', cmap = custom_cmap)


Look at the plot above and now have a look at the inequality again:

$$\displaystyle \frac12 < \left\lfloor \mathrm{mod} \left( \left\lfloor{\frac{y}{17}}\right\rfloor 2^{-17\lfloor x \rfloor - \mathrm{mod}(\lfloor y \rfloor, 17)}, 2 \right) \right\rfloor$$

We have visually reproduced the formula itself by plotting it. This is the beauty of Tupper's self-referential formula.

Let's paint with numbers

Tupper's self-referential formula works by encoding 106 pixels wide by 17 pixels high bitmap in the constant k, and thus can be used to produce any 106 × 17 bitmap by finding the corresponding constant k. The algorithm for finding the constant k for a given 106 × 17 bitmap is:

Treat the bitmap as a 106 × 17 grid and place a 1 in the squares you want to be black and a 0 in the squares you want to be white, rotating the grid and reading the digits off left to right, working down the grid, will give you a 1802-digit binary number. Convert that number into base-10, then multiply it by 17.

I first draw my pixel art in a 106 × 17 canvas in Hexels 2 (my tool of choice for pixel art), then I export it as csv. The format of csv is:

(column), (row), (R), (G), (B), (A)

I read the corresponding csv, convert it into a numpy array and apply the algorithm mentioned above to find the constant k:

In [3]:
matrix = np.zeros(shape = (17,106))
df = pd.read_csv('image.csv', sep='\n', header=None)
binary_string = ""

for _index, row in df[4:].iterrows():
    point = list(map(lambda x: x.strip(), row[0].split(',')))
    if((point[2], point[3], point[4], point[5]) != ("0", "0", "0", "0")):
        matrix[int(point[1])][int(point[0])] = 1
matrix = np.flipud(matrix).transpose()
for x in np.nditer(matrix, order = 'C'):
    binary_string = binary_string + str(int(x))
k = int(binary_string, 2) * 17
In [4]: