Tupper's Self-Referential Formula plotter
This Python package calculates and plots Tupper's Self-Referential Formula.
I've written about the formula and this project at Tupper’s Self-Referential Formula in Python.
The video that influenced this whole thing is here: https://www.youtube.com/watch?v=_s5RFgd59ao
█ █ █ ██ █ █ █ █ █ █ █ ██ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
██ █ █ █ █ ██ █ █ █ █ █ █ ██ ████ ███ ███ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ███ ███ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ ██ █ █ █ █ █ █ █ █ ██ █ █
███ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
█ █ ██ █ ██ ███ █ █ █ █ ███ ███ █ ███ ███ █ █ █ █ █
███ █ █ █ █ █ █ █ █ █ █ █ ████ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
██ █ █ █ █ █ ██ ███ █ █ █ ██ █ ████ ████ █ █
█ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █
███ █ █ █ █ █ █ █ █
█ █ █ █ █ █
███ █ ███ ███ █ ███
Requirements
- Python 3
Installation
pip3 install tupper
Console usage
python3 -m tupper
Optional arguments:
--help-- show usage instructions.--k <number>-- the value of k to plot.--true <string>-- the string to print for truthy points.--false <string>-- the string to print for falsy points.--export <filename>-- export the (x, y) coordinates and their truthy solution to a CSV file.
If you don't specify k then k =
9609393799189588849716729621278527547150043396601293066515055192717028023952664
2468964284217435071812126715378277062335599323728087414430789132596394133772348
7857735749823926629715517173716995165232890538221612403238855866184013235585136
0488286933379024914542292886670810961844960917051834540678277315517054053816273
8096760256562501698148208341878316384911559022561000365235137034387446184837873
7238198224849863465033159410054974700593138339226497249461751545728366702369745
461014655997933798537483143786841806593422227898388722980000748404719
Code usage
Solver class
To solve ad-hoc (x, y) points, import the Solver class and call the solve(x, y) function:
from tupper import Solver
# ...
s = Solver()
b = s.solve(x, y)
x() and y() functions are provided for yielding the coordinates of a graph:
from tupper import Solver
# ...
s = Solver()
k = 960939379918958...
for y in s.y(k):
for x in s.x():
b = s.solve(x, y)
StringPlotter class
StringPlotter exposes two functions for rendering graphs as text.
row() yields the characters for any given row:
from tupper import StringPlotter
# ...
sp = StringPlotter(true_mark="x", false_mark=" ")
k = 960939379918958...
for c in sp.row(k):
print(c, end="")
graph() yields the characters for the entire graph, including newlines at the end of each row:
from tupper import StringPlotter
# ...
sp = StringPlotter(true_mark="x", false_mark=" ")
k = 960939379918958...
for c in sp.graph(k):
print(c, end="")
Test data
The test_data directory contains CSV files for testing the calculation.
Each file contains three columns:
- The
xcoordinate. - The
ycoordinate. - The expected
true/falsesolution.
Metadata
Release files for tupper 0.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tupper-0.10.1.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tupper-0.10.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / tupper-0.10.1.tar.gz
| Download URL | tupper-0.10.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
817c46616eab3be06b81d342796a422d4f1564e3a59036e1cf10371960ac2d93
|
|
BLAKE2b-256 checksum How to use checksums |
4bb69ea9933ef31f9544b55d23666f768a401a60d1836dc0c57b5c8e910d507a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
|
Release files / tupper-0.10.1-py3-none-any.whl
| Download URL | tupper-0.10.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02c267fdaeef61f52f004d30160bacd5da3f4bd70f090b65abf30671e834fbd7
|
|
BLAKE2b-256 checksum How to use checksums |
b9c2a47f062ac37d0ffb05956a9fd062e38ea52279944d77e26b9e9e707d1fdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
|