Created
January 22, 2017 05:21
-
-
Save Puttichai/4859ac7b4872b2aefcf62c36b8bd29e6 to your computer and use it in GitHub Desktop.
Plotting graphs from Tupper's self-referential formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
def tupper(x, y): | |
return 0.5 < ((y/h) // 2**(h*x + y%h))%2 | |
# Your value k here | |
k = 32922520572696913382451905912623623647167183726429121431754312885129411666885193915949745564208638847962779004960137820128309880253556326299620426051843316781711466694127750198822966039318977833943222930199125709567725963414828291187020468933092013936070802306399352123884523508901675580302517101305664361846330981066146182280532463873220739993581702910381088258207784043222527183537656464346321232788544747517684361869138095386938096713005390871951618586863662892224485886579202764210376205132486407529459098019294538104832 | |
h = 17 | |
w = 106 | |
fontsize = 25 | |
labelsize = 25 | |
plt.rc('patch', antialiased=False) | |
plt.rc('font', size=fontsize, family='serif') | |
plt.rc('text', usetex=True) | |
for x in xrange(w): | |
for y in xrange(h): | |
if tupper(x, y + k): | |
plt.bar(left=x, bottom=y, height=1, width=1, linewidth=0, color='k') | |
plt.axis('scaled') | |
plt.xlim([0, w]) | |
plt.xticks([0, w], ['0', '106']) | |
plt.ylim([0, h]) | |
plt.yticks([0, h], ['k', 'k + 17']) | |
g = plt.gca() | |
g.tick_params(axis='x', labelsize=labelsize) | |
g.tick_params(axis='y', labelsize=labelsize) | |
plt.show(False) | |
plt.tight_layout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment