Skip to content
Juozas Žilys
← All projects

The Book of the Two and the Three

A ~22,000-word illustrated math book written as scripture — every verse is verifiable geometry, physics, or computation — typeset by a custom Python pipeline with hand-coded SVG plates.

Role
Author & toolmaker
Period
2026

Python · SVG · Headless Chrome · Markdown

What it is

A book that started with one question — what is the difference between a circle and a sphere? — and followed it until it became a doctrine. The conceit: it is written as scripture (“a scripture of cursed geometry”), but every verse is technically true and checkable with a pencil, a compass, or a compiler. The oracular voice is a lens, not a cloak.

The canon runs eight books: the One (the center, the radius, single source of truth), the Two (relation, the plane, the bit, the imaginary unit as a quarter-turn), the Three (form, the triangle, tensegrity), the Book of e (the hinge between two and three), Rotation (circle into sphere, gimbal lock, the Bloch sphere), Confusion (chaos, fractals, the observer), and a rigorous Apparatus appendix — precise theorems, proof sketches, and citations behind every verse, with Noether’s theorem as the keystone and an honest “On the Seams” section admitting where the poetry outran the proof. A concordance then unmasks every persona (the stone is the Gömböc, the falling cat is a holonomy problem, the cat in the box is the cat in the box).

Download the PDF (3.5 MB).

What I built (besides the words)

The book is compiled, not word-processed:

  • Source is plain markdown — eleven canon files, written to be readable in a terminal.
  • A custom Python typesetter (build.py) binds the canon into a single self-contained HTML volume — its own markdown parser, verse numbering, embedded fonts — then renders the print PDF via headless Chrome.
  • Every figure is a hand-coded SVG plate (figures.py, ~24 plates: the Gömböc, the gimbal, the Bloch sphere, Euler’s identity, the Sierpiński triangle…) in a fixed five-color palette. Plates are static-legible for print, and a few carry SMIL animation that only plays in the HTML edition.
  • The one non-generated image is the genuine 1478 Theodoros Pelecanos ouroboros, matted in as a plate.

Interesting bits

  • ~22,000 words; scripture on the surface, falsifiable underneath — the references chapter resolves every citation.
  • The book declares itself unfinishable by its own doctrine: a reader and a text are a Two, so reading it correctly forces a Three — a new section. The canon is open.
  • “Every sufficiently deep mathematical discussion eventually becomes philosophy. Every sufficiently deep philosophical discussion eventually becomes geometry. You have been warned, which is to say: welcome.”