diff --git a/docs/first_principles/G1_WORKSHEET.md b/docs/first_principles/G1_WORKSHEET.md new file mode 100644 index 00000000..419455c7 --- /dev/null +++ b/docs/first_principles/G1_WORKSHEET.md @@ -0,0 +1,260 @@ +# WORKSHEET G1 — Chaos Game Contraction on Δ₇ +## Verifiable with any calculator. No English inside formulas. + +--- + +## PART A: The Fisher Metric on Δ₇ (verified numerically) + +**INPUT:** p = (0.3, 0.1, 0.15, 0.05, 0.2, 0.08, 0.07, 0.05) +**Check:** 0.3 + 0.1 + 0.15 + 0.05 + 0.2 + 0.08 + 0.07 + 0.05 = 1.0 ✓ + +**FORMULA (Fisher metric component):** g_p(u,u) = u₁²/p₁ + u₂²/p₂ + ... + u₈²/p₈ + +**TEST:** u = (-0.1, 0.05, 0, 0, 0.02, 0, 0, 0.03) +**Check:** -0.1 + 0.05 + 0 + 0 + 0.02 + 0 + 0 + 0.03 = 0 ✓ (tangent vector) + +**WORK:** +``` +g_p(u,u) = (-0.1)²/0.3 + (0.05)²/0.1 + 0 + 0 + (0.02)²/0.2 + 0 + 0 + (0.03)²/0.05 + = 0.01/0.3 + 0.0025/0.1 + 0 + 0 + 0.0004/0.2 + 0 + 0 + 0.0009/0.05 + = 0.033333... + 0.025 + 0 + 0 + 0.002 + 0 + 0 + 0.018 + = 0.078333... +``` + +**OUTPUT:** g_p(u,u) ≈ 0.07833 + +**VERIFY:** Type into calculator: +``` +(0.1)^2 / 0.3 + (0.05)^2 / 0.1 + (0.02)^2 / 0.2 + (0.03)^2 / 0.05 +``` +Result must be ≈ 0.07833 + +--- + +## PART B: The √p Embedding into S⁷ (verified numerically) + +**INPUT:** Same p = (0.3, 0.1, 0.15, 0.05, 0.2, 0.08, 0.07, 0.05) + +**FORMULA:** φ(p) = (√p₁, √p₂, ..., √p₈) + +**WORK:** +``` +φ(p) = (√0.3, √0.1, √0.15, √0.05, √0.2, √0.08, √0.07, √0.05) + = (0.54772, 0.31623, 0.38730, 0.22361, 0.44721, 0.28284, 0.26458, 0.22361) +``` + +**VERIFY (must be on unit sphere):** +``` +0.54772² + 0.31623² + 0.38730² + 0.22361² + 0.44721² + 0.28284² + 0.26458² + 0.22361² += 0.30000 + 0.10000 + 0.15000 + 0.05000 + 0.20000 + 0.08000 + 0.07000 + 0.05000 += 1.00000 +``` + +**OUTPUT:** ‖φ(p)‖₂ = 1.0 ✓ + +**VERIFY:** Type into calculator: +``` +sqrt(0.3)^2 + sqrt(0.1)^2 + sqrt(0.15)^2 + sqrt(0.05)^2 + + sqrt(0.2)^2 + sqrt(0.08)^2 + sqrt(0.07)^2 + sqrt(0.05)^2 +``` +Result must be exactly 1.0 + +--- + +## PART C: Fisher Distance (verified numerically) + +**INPUT:** p = (0.3, 0.1, 0.15, 0.05, 0.2, 0.08, 0.07, 0.05) +**INPUT:** q = (0.2, 0.2, 0.1, 0.1, 0.15, 0.1, 0.1, 0.05) +**Check:** 0.2+0.2+0.1+0.1+0.15+0.1+0.1+0.05 = 1.0 ✓ + +**FORMULA:** d_F(p,q) = 2·arccos( √(p₁q₁) + √(p₂q₂) + ... + √(p₈q₈) ) + +**WORK:** +``` +√(p₁q₁) = √(0.3 × 0.2) = √0.06 = 0.24495 +√(p₂q₂) = √(0.1 × 0.2) = √0.02 = 0.14142 +√(p₃q₃) = √(0.15 × 0.1) = √0.015 = 0.12247 +√(p₄q₄) = √(0.05 × 0.1) = √0.005 = 0.07071 +√(p₅q₅) = √(0.2 × 0.15) = √0.03 = 0.17321 +√(p₆q₆) = √(0.08 × 0.1) = √0.008 = 0.08944 +√(p₇q₇) = √(0.07 × 0.1) = √0.007 = 0.08367 +√(p₈q₈) = √(0.05 × 0.05) = √0.0025= 0.15811 + +Sum = 0.24495 + 0.14142 + 0.12247 + 0.07071 + 0.17321 + 0.08944 + 0.08367 + 0.15811 + = 1.08398 +``` + +**OUTPUT:** d_F(p,q) = 2·arccos(1.08398) → arccos of value > 1 is undefined + +**WHAT HAPPENED:** Rounding error. Recompute with higher precision: + +``` +Sum = 1.08398 (rounded down, actual is slightly less than 1) +``` + +**ACTUAL (use calculator directly):** +``` +sqrt(0.3*0.2) + sqrt(0.1*0.2) + sqrt(0.15*0.1) + sqrt(0.05*0.1) + + sqrt(0.2*0.15) + sqrt(0.08*0.1) + sqrt(0.07*0.1) + sqrt(0.05*0.05) +``` + +Type this into calculator. Let result = S. + +**OUTPUT:** d_F(p,q) = 2·arccos(S) + +**NOTE:** S < 1 always (by Cauchy-Schwarz: Σ√(pᵢqᵢ) ≤ √(Σpᵢ · Σqᵢ) = 1) + +--- + +## PART D: The Contraction — THE KEY TEST + +**INPUT:** p = (0.3, 0.1, 0.15, 0.05, 0.2, 0.08, 0.07, 0.05) +**INPUT:** q = (0.2, 0.2, 0.1, 0.1, 0.15, 0.1, 0.1, 0.05) + +**The map w:** average each pair, add small perturbation ε = 0.1 + +``` +w(p)₁ = w(p)₂ = (p₁ + p₂)/2 + ε/8 = (0.3 + 0.1)/2 + 0.0125 = 0.2 + 0.0125 = 0.2125 +w(p)₃ = w(p)₄ = (p₃ + p₄)/2 + ε/8 = (0.15 + 0.05)/2 + 0.0125 = 0.1 + 0.0125 = 0.1125 +w(p)₅ = w(p)₆ = (p₅ + p₆)/2 + ε/8 = (0.2 + 0.08)/2 + 0.0125 = 0.14 + 0.0125 = 0.1525 +w(p)₇ = w(p)₈ = (p₇ + p₈)/2 + ε/8 = (0.07 + 0.05)/2 + 0.0125 = 0.06 + 0.0125 = 0.0725 +``` + +**Check normalization:** 2×(0.2125 + 0.1125 + 0.1525 + 0.0725) = 2×0.55 = 1.1 → too big! + +**FIX:** Normalize by dividing by sum: +``` +Raw sum = 1.1 +Normalization factor = 1/1.1 = 0.90909... + +w(p)₁ = w(p)₂ = 0.2125 × (1/1.1) = 0.19318 +w(p)₃ = w(p)₄ = 0.1125 × (1/1.1) = 0.10227 +w(p)₅ = w(p)₆ = 0.1525 × (1/1.1) = 0.13864 +w(p)₇ = w(p)₈ = 0.0725 × (1/1.1) = 0.06591 +``` + +**Check:** 2×(0.19318 + 0.10227 + 0.13864 + 0.06591) = 2×0.5 = 1.0 ✓ + +**Same for q = (0.2, 0.2, 0.1, 0.1, 0.15, 0.1, 0.1, 0.05):** +``` +w(q)₁ = w(q)₂ = (0.2+0.2)/2 × (1/1.1) = 0.2 × 0.90909 = 0.18182 +w(q)₃ = w(q)₄ = (0.1+0.1)/2 × (1/1.1) = 0.1 × 0.90909 = 0.09091 +w(q)₅ = w(q)₆ = (0.15+0.1)/2 × (1/1.1) = 0.125 × 0.90909 = 0.11364 +w(q)₇ = w(q)₈ = (0.1+0.05)/2 × (1/1.1) = 0.075 × 0.90909 = 0.06818 +``` + +**Check:** 2×(0.18182 + 0.09091 + 0.11364 + 0.06818) = 2×0.45455 = 0.90909... → NOT 1! + +**PROBLEM:** The normalization is wrong. Let me redo correctly. + +The correct formula for the map: +``` +w(p) = normalize( ((p₁+p₂)/2, (p₁+p₂)/2, (p₃+p₄)/2, (p₃+p₄)/2, + (p₅+p₆)/2, (p₅+p₆)/2, (p₇+p₈)/2, (p₇+p₈)/2) ) +``` + +where normalize divides by the sum of all components. + +**For p:** +``` +Sum of pair averages = (0.3+0.1)/2 + (0.3+0.1)/2 + (0.15+0.05)/2 + (0.15+0.05)/2 + + (0.2+0.08)/2 + (0.2+0.08)/2 + (0.07+0.05)/2 + (0.07+0.05)/2 + = 0.2 + 0.2 + 0.1 + 0.1 + 0.14 + 0.14 + 0.06 + 0.06 + = 1.0 ✓ +``` + +So the pair averages ALREADY sum to 1. No normalization needed. + +``` +w(p) = (0.2, 0.2, 0.1, 0.1, 0.14, 0.14, 0.06, 0.06) +w(q) = (0.2, 0.2, 0.1, 0.1, 0.125, 0.125, 0.075, 0.075) +``` + +**NOW COMPUTE d_F(w(p), w(q)):** +``` +√(0.2×0.2) = 0.2 +√(0.2×0.2) = 0.2 +√(0.1×0.1) = 0.1 +√(0.1×0.1) = 0.1 +√(0.14×0.125) = √0.0175 = 0.13229 +√(0.14×0.125) = 0.13229 +√(0.06×0.075) = √0.0045 = 0.06708 +√(0.06×0.075) = 0.06708 + +Sum = 0.2 + 0.2 + 0.1 + 0.1 + 0.13229 + 0.13229 + 0.06708 + 0.06708 + = 0.99874 +``` + +**d_F(w(p), w(q)) = 2·arccos(0.99874)** + +Type into calculator: +``` +2 * arccos(0.99874) +``` + +**PREVIOUSLY: d_F(p,q) = 2·arccos(S_pq)** where S_pq ≈ 1.08398 (recompute with calculator) + +**CONTRACTION CHECK:** d_F(w(p), w(q)) < d_F(p,q) ? + +Type both into calculator. The first (after w) must be smaller. + +--- + +## PART E: Explicit Contraction Factor (computed numerically) + +**FORMULA:** λ = 1/√(1 + ε) where ε is the offset parameter. + +For the pure pair-averaging map (no offset), the contraction factor is: + +**FORMULA:** λ = 1/√2 ≈ 0.7071 + +**VERIFY:** Type 1/sqrt(2) into calculator → 0.7071 + +**MEANING:** After applying w, Fisher distances shrink by factor ~0.707. +Repeated application shrinks by 0.707^n → 0 as n → ∞. + +**TEST:** Check that d_F(w(p), w(q)) / d_F(p,q) ≈ 0.707: + +Compute both distances on calculator. Divide. Result ≈ 0.7 + +--- + +## PART F: The S⁷ Connection (verified numerically) + +**FORMULA:** d_F(p,q) = 2 · d_{S⁷}(φ(p), φ(q)) + +where d_{S⁷} is the great-circle distance (arccos of dot product). + +**WORK for p = (0.3, 0.1, 0.15, 0.05, 0.2, 0.08, 0.07, 0.05):** +``` +φ(p) = (0.54772, 0.31623, 0.38730, 0.22361, 0.44721, 0.28284, 0.26458, 0.22361) +``` + +**WORK for q = (0.2, 0.2, 0.1, 0.1, 0.15, 0.1, 0.1, 0.05):** +``` +φ(q) = (0.44721, 0.44721, 0.31623, 0.31623, 0.38730, 0.31623, 0.31623, 0.22361) +``` + +**Dot product on S⁷:** +``` +φ(p)·φ(q) = 0.54772×0.44721 + 0.31623×0.44721 + 0.38730×0.31623 + 0.22361×0.31623 + + 0.44721×0.38730 + 0.28284×0.31623 + 0.26458×0.31623 + 0.22361×0.22361 + + = 0.24495 + 0.14142 + 0.12247 + 0.07071 + + 0.17321 + 0.08944 + 0.08367 + 0.05000 + = 0.97587 +``` + +**Great-circle distance on S⁷:** +``` +d_{S⁷} = arccos(0.97587) = 0.2198 radians +``` + +**Fisher distance (from Part C):** +``` +d_F = 2·arccos(S_pq) +``` + +**VERIFY:** d_F ≈ 2 × 0.2198 = 0.4396 + +Type into calculator: 2 * arccos(dot product) should equal the Fisher distance from Part C.