Polyhedra in Polyhedra

Certification

A number on this site is not a measurement. Each one comes with a certificate, checked with no rounding anywhere, that the n pieces really are pairwise disjoint copies of the piece solid inside the container of that size. Floating point only proposes; exact arithmetic decides.

All 2,145 records on this site are certified exactly.

What a certificate proves

Let P be the canonical piece solid and C the canonical container solid. For a record with scale s and pieces (ci, qi), certify_general.py proves:

  1. The solids are what they claim to be. In exact arithmetic: every face is planar, every face plane supports the solid strictly (all other vertices strictly inside), every edge lies on exactly two faces, so C is the intersection of its face half-spaces, and either all edges have length exactly 1 or all faces touch one sphere (Catalan solids).
  2. Containment. Each piece ci + RiP lies in the interior of s·C: every vertex is strictly inside every face half-space.
  3. Disjointness. For every pair whose centres are closer than twice an upper bound of the circumradius there is an explicit rational vector u and rational t with u·x < t on every vertex of one piece and u·x > t on every vertex of the other. Every other pair is farther apart than the sum of the circumradii.

Because the pieces and the container are convex, the three facts together say exactly that the packing is valid.

Exact solids

Every vertex coordinate of every solid is an exact element of a real number field ℚ(α), given by the minimal polynomial of α and a rational interval that contains α and no other root (checked with a Sturm sequence). The snub cube, the snub dodecahedron and their duals also need one common scale λ = 1/√D with D in the field. The data are in src/solids_exact.json:

Minimal polynomial of αDegreeSolids
x − 1
α = 1: rational coordinates
1cube
x² − 2
α = √2 ≈ 1.414214
2octahedron, truncated tetrahedron, cuboctahedron, triakis tetrahedron, tetrahedron, truncated cube, truncated octahedron, rhombicuboctahedron, truncated cuboctahedron, rhombic dodecahedron, triakis octahedron, tetrakis hexahedron, deltoidal icositetrahedron, disdyakis dodecahedron
x² − 3
α = √3 ≈ 1.732051
2triangular prism, hexagonal prism
x² − x − 1
α = φ = (1 + √5)/2 ≈ 1.618034
2dodecahedron, icosahedron, icosidodecahedron, truncated dodecahedron, truncated icosahedron, rhombicosidodecahedron, truncated icosidodecahedron, rhombic triacontahedron, triakis icosahedron, pentakis dodecahedron, deltoidal hexecontahedron, disdyakis triacontahedron
x³ − x² − x − 1
α = the tribonacci constant ≈ 1.839287
3snub cube, pentagonal icositetrahedron (times λ = 1/√D)
2x⁴ − 4x² + 1
α = 1/(2 sin 22.5°) ≈ 1.306563
4octagonal prism
5x⁴ − 5x² + 1
α = 1/(2 sin 36°) ≈ 0.850651
4pentagonal prism, pentagonal antiprism
x⁴ + 2x² − 2
α = √(√3 − 1) ≈ 0.855600
4hexagonal antiprism
x⁴ − 2
α = 21/4 ≈ 1.189207
4square antiprism
x⁴ − 4x² + 1
α = 1/(2 sin 15°) ≈ 1.931852
4dodecagonal prism
x⁶ − 4x⁴ − x³ + 4x² + 2x − 1
α = ξ with ξ³ − 2ξ = φ ≈ 1.715561
6snub dodecahedron, pentagonal hexecontahedron (times λ = 1/√D)
2x⁸ + 8x⁶ − 16x⁴ + 8x² − 1
α = √(1 − 1/(4 cos² 22.5°)) ≈ 0.860296
8octagonal antiprism
x⁸ + 12x⁶ − 22x⁴ + 12x² − 2
α = √(1 − 1/(4 cos² 15°)) ≈ 0.863520
8dodecagonal antiprism

Elements are coefficient vectors in the power basis 1, α, …, αd−1, so an element is zero exactly when all its coefficients are. The sign of a nonzero element is found by evaluating it on the isolating interval with interval arithmetic and halving the interval (with exact signs of the minimal polynomial) until the result excludes 0, which always happens because the value is not 0. This is algebraic.py, standard library only.

Finding the coordinates, then proving them

scripts/exact_solids.py writes each 60-digit coordinate as a rational combination of powers of α with the PSLQ integer relation algorithm. A wrong relation cannot survive the next step: the whole solid is checked exactly in ℚ(α) (planar faces, supporting planes, a closed surface, all edges equal to 1 or D, or an insphere), and the exact solid must match the floating-point solid used by the search to 10−12.

Rotations without rounding

A record stores each rotation as a quaternion q = (w, x, y, z) of floating-point numbers, and every float is an exact rational. The certificate uses R = H(q)/|q|2, where H(q) is the usual matrix of quadratic forms in the components; this R is exactly orthogonal with determinant 1 for any rational q ≠ 0. So each piece is exactly congruent to the canonical solid, with no normalization error.

Interval arithmetic

Vertex coordinates of the pieces are products of exact field elements, the scale λ and rational rotations. The certifier encloses each of them in a fixed-point interval with 170 fractional bits and outward rounding, refining α by exact bisection until the enclosures are tight enough. Every inequality of the certificate (a vertex strictly inside a face, a vertex strictly on one side of a separating plane) is then decided on these enclosures: it counts only if it holds for the whole interval.

Separating planes

For each near pair the certifier ranks candidate directions in floating point (the face normals of both pieces and the cross products of edge pairs that pass the Gauss-map test), rounds each of the best six to a rational vector u with denominators up to 1012, and proves with interval arithmetic that the largest u·x over one piece is smaller than the smallest u·y over the other. Any t between the two gives the separating plane. A poor proposal can only make the certificate fail, never pass.

How the certifier is tested

  • Records from other people certify: Y. Nakajima's 12 cubes in a cube (s = 2.9315185094797) and the record of 21 octahedra in a cube from Tencent Hunyuan's Hyra-results.
  • Deliberately broken files are rejected: the container shrunk by 3·10−5, a piece pushed 10−4 into its neighbour, two coincident pieces, a piece outside.
  • The Platonic records are certified twice: by the original certify_exact.py over ℚ(√2, √5) and by the general certifier.

The float check

verify_general.py runs the same containment and separating-axis tests in double precision with NumPy, using face normals and Gauss-map-pruned edge cross products. It is fast and catches gross errors; it is not a proof.

Check a record yourself

git clone https://github.com/alejandrozu/platonic-packing.git && cd platonic-packing
python3 certify_general.py records/ktoinkto/ktoinkto_n20.json    # exact; Python standard library only
python3 verify_general.py  records/ktoinkto/ktoinkto_n20.json    # floating point; needs NumPy

The certifier prints the solid checks, the smallest containment slack, the number of near pairs separated by rational planes and CERTIFIED or NOT CERTIFIED, and exits with status 0 only when certified. The output for every record is stored next to it as .certify.txt.