Demonstrations

100% Exact Symbolic SymPy & Rational Trigonometry Proofs of Nicomachus’s Arithmetical Geometry

In strict accordance with GEOMETOR’s Content / Code Separation, the historical Book Codex (Introduction to Arithmetic) contains zero embedded Python scripts. All executable symbolic proofs, ratio trees, figurate gnomon dissections, semicircle mean constructions, and polyhedral cube models live in geometor.nicomachus and the runnable demos/*.py scripts documented below—verified over exact SymPy rationals \(\mathbb{Q}\) and quadratic radicals \(\mathbb{Q}(\sqrt{ac})\) with Model(..., auto_intersect=False) and zero floating-point approximations.


1. Book I, Chs. 13, 16, 17–23 & Book II, Chs. 1–2 — Ratio Taxonomy & the Equality Unfolding Tree

Codex Reference: Book I, Ch. 23 — The Equality Unfolding Tree (Critical Notes) · Script: demos/equality_tree.py

Nicomachus I.23 & II.1–2 — Unfolding All Inequality from Equality (1, 1, 1) Direct rule N₁: (a, a+b, a+2b+c) · Anastrophe rule N₂ = N₁R · Inverse reduction N₁⁻¹ (gold dashed) N₁ N₁ (direct) N₂ (anastrophe) N₁ Book II.1–2 Inverse Subtraction N₁⁻¹ returns every ratio to (1, 1, 1) (1, 1, 1) · α, α, α Equality · 1:1 (1, 2, 4) · α, β, δ 1. Multiplex · 2:1 (1, 3, 9) · α, γ, ϑ Multiplex · 3:1 (4, 6, 9) · δ, ϛ, ϑ 2. Superparticularis · 3:2 (1, 4, 16) Multiplex · 4:1 (9, 12, 16) Epitritos · 4:3 (4, 10, 25) · δ, ι, κε 4. Mult. superpartic. · 5:2 (9, 15, 25) · ϑ, ιε, κε 3. Superpartiens · 5:3 (9, 24, 64) 5. Mult. superpartiens · 8:3
Book I, Ch. 23 & Book II, Chs. 1–2: Applying Nicomachus’s three commands (a, b, c) -> (a, a+b, a+2b+c) directly and after sibling reversal (c, b, a) unfolds every rational inequality from primordial Equality (1, 1, 1).
  • Symbolic Verification: Starting from Equality (1, 1, 1), direct application of NICOMACHUS_MATRIX_N1 \((a, a+b, a+2b+c)\) generates the multiple spine (1, 2, 4), (1, 3, 9), (1, 4, 16). Reversing a multiple triple before applying the rule (NICOMACHUS_MATRIX_N2) births the superparticulars (4, 6, 9) (hemiolios \(3:2\)) and (9, 12, 16) (epitritos \(4:3\)), while direct vs. reversed children of superparticulars generate multiple superparticulars (4, 10, 25) and superpartients (9, 15, 25). Conversely, reducetoequality reduces every coprime geometric progression \((p^2, pq, q^2)\) back to (1, 1, 1).

from geometor.nicomachus import (
            classify_nicomachean_ratio,
            generate_equality_tree,
            reduce_to_equality,
            verify_equality_identities,
        )

        info = classify_nicomachean_ratio(9, 8)
        assert info["species_key"] == "superparticularis"
        tree = generate_equality_tree(max_depth=3)
        assert tree[0].terms == (1, 1, 1)
        steps = reduce_to_equality(9, 24, 64)
        assert steps[-1].after == (1, 1, 1)
        assert verify_equality_identities()["verified_tree_nodes"] == 16
        

2. Book II, Chs. 6–20 — Polygonal Alpha-Gnomons, Same/Other & Nicomachus’s Sum-of-Cubes Theorem

Codex Reference: Book II, Ch. 20 — Sum of Cubes from Odd Blocks (Critical Notes) · Script: demos/figurate_gnomons.py

Nicomachus II.20 — Sum of Consecutive Cubes Equals the Squared Triangle 1³ + 2³ + 3³ + 4³ = (1 + 2 + 3 + 4)² = 10² = 100 · Odd-block sums & L-gnomon square dissection 2³ = 8 3³ = 27 4³ = 64 0 T₁=1 T₂=3 T₃=6 T₄=10 Nicomachus's Consecutive Odd-Block Theorem (II.20) k = 1 : 1 = 1 = 1³ k = 2 : 3 + 5 = 8 = 2³ k = 3 : 7 + 9 + 11 = 27 = 3³ k = 4 : 13 + 15 + 17 + 19 = 64 = 4³ k = 5 : 21 + 23 + 25 + 27 + 29 = 125 = 5³ Why Shell k Has Exact Area k³: Tₖ² − Tₖ₋₁² = (Tₖ − Tₖ₋₁) · (Tₖ + Tₖ₋₁) = k · k² = k³ (By II.12, two consecutive triangles Tₖ₋₁ + Tₖ = k²!)
Book II, Ch. 20: Consecutive odd-number blocks {1}, {3, 5}, {7, 9, 11}, {13, 15, 17, 19} sum to cubes 1^3, 2^3, 3^3, 4^3 and tile the square of side T_4 = 10 as exact L-shaped gnomons.
  • Symbolic Verification: In construct_nicomachus_cubes_model(order=4), a geometor.model.Model(auto_intersect=False) constructs the \(T_n \times T_n\) square bordered at triangular coordinates \(T_k = \frac{k(k+1)}{2}\). Each \(k\)-th L-gnomon has exact symbolic area \(T_k^2 - T_{k-1}^2 = k^3\) and equals the sum of the \(k\)-element odd block {13, 15, 17, 19} = 64 = 43, while sieve_of_eratosthenes and euclid_nicomachus_perfect_numbers verify Book I, Chs. 13 & 16.

from geometor.nicomachus import (
            construct_nicomachus_cubes_model,
            euclid_nicomachus_perfect_numbers,
            sieve_of_eratosthenes,
            verify_figurate_identities,
        )

        sieve = sieve_of_eratosthenes(35)
        assert sieve["odd_primes"][:6] == (3, 5, 7, 11, 13, 17)
        assert [row["perfect_number"] for row in euclid_nicomachus_perfect_numbers(4)] == [6, 28, 496, 8128]
        cubes = construct_nicomachus_cubes_model(order=4)
        assert cubes.total_area == cubes.triangular_side**2 == 100
        assert verify_figurate_identities()["nicomachus_cubes_verified"] is True
        

3. Book II, Chs. 21–29 — Semicircle Means, Ten Proportions & the Cube’s Teleiotatē Analogia

Codex Reference: Book II, Ch. 29 — The Most Perfect Proportion & Cube Harmony (Critical Notes) · Script: demos/ten_means_and_cube.py

Nicomachus II.21–28 — The Three Classical Archetypes & Synoptic Decad of Ten Means Left: Semicircle on PQ = 6, QR = 12 proving A ≥ G ≥ H & A · H = G² · Right: Hoche p. 144 Ten Means Semicircle Construction (a = 6, c = 12) P(0) Q(6) O(9) R(18) S F G = 6√2 A = 9 H = 8 A = 9 > G = √72 ≈ 8.49 > H = 8 · A·H = 72 = G² Synoptic Decad Table (Book II.28.11, Hoche p. 144) 1. Arithmetic α, β, γ (1, 2, 3) (z−m):(m−x) = 1 2. Geometric α, β, δ (1, 2, 4) (z−m):(m−x) = z:m 3. Harmonic γ, δ, ϛ (3, 4, 6) (z−m):(m−x) = z:x 4. Subcontr. Harmonic γ, ε, ϛ (3, 5, 6) (m−x):(z−m) = z:x 5. Subcontr. Geom. I β, δ, ε (2, 4, 5) (m−x):(z−m) = m:x 6. Subcontr. Geom. II α, δ, ϛ (1, 4, 6) (m−x):(z−m) = z:m 7. Neo-Pythagorean I ϛ, η, ϑ (6, 8, 9) (z−x):(m−x) = z:x 8. Neo-Pythagorean II ϛ, ζ, ϑ (6, 7, 9) (z−x):(z−m) = z:x 9. Neo-Pythagorean III δ, ϛ, ζ (4, 6, 7) (z−x):(m−x) = m:x 10. Additive / Fibonacci γ, ε, η (3, 5, 8) (z−x):(z−m) = m:x
Book II, Chs. 21–28 & Pappus Synagoge III: Over diameter PR = a + c, radius OS = A, perpendicular ordinate QS = G, and radial projection SF = H satisfy H <= G <= A with exact right-triangle identity G^2 = A * H.
  • Symbolic Verification: In construct_three_classical_means_model(6, 12), exact circle-line and line-line intersections over \(\mathbb{Q}(\sqrt{2})\) establish radius OS = A = 9 (\(Q(O, S) = 81\)), ordinate QS = G = 6√2 (\(Q(Q, S) = 72\)), and radial projection SF = H = 8 (\(Q(S, F) = 64\)). In construct_cube_proportion_model(), the Cube’s \(6\) faces, \(8\) vertices, and \(12\) edges embed \(6 : 8 :: 9 : 12\) with projective harmonic cross-ratio -1 and every Pythagorean consonance (\(2:1, 3:2, 4:3, 9:8\)).

from geometor.model.invariants import quadrance
        from geometor.nicomachus import (
            compute_all_ten_means,
            construct_cube_proportion_model,
            construct_three_classical_means_model,
            verify_cube_proportion_identities,
            verify_ten_means_identities,
        )

        m = construct_three_classical_means_model(6, 12)
        assert quadrance(m.get_element_by_ID("O"), m.get_element_by_ID("S")) == 81  # A^2 = 9^2
        assert quadrance(m.get_element_by_ID("Q"), m.get_element_by_ID("S")) == 72  # G^2 = 6 * 12
        assert quadrance(m.get_element_by_ID("S"), m.get_element_by_ID("F")) == 64  # H^2 = 8^2

        assert len(compute_all_ten_means(4, 12)) == 10
        cube = construct_cube_proportion_model()
        assert cube.cube_counts == {"faces": 6, "vertices": 8, "edges": 12}
        assert cube.projective_cross_ratio == -1
        assert all(verify_ten_means_identities().values())
        assert all(verify_cube_proportion_identities().values())