modules¶
geometor.klein¶
GEOMETOR • klein — Dual-treatise Book Codex & exact symbolic engine for Felix Klein.
Provides exact SymPy and geometor.model implementations accompanying:
Famous Problems of Elementary Geometry (Vorträge über ausgewählte Fragen der Elementargeometrie, 1895; trans. W. W. Beman & D. E. Smith, 1897).
A Comparative Review of Recent Researches in Geometry (“The Erlangen Program”) (Vergleichende Betrachtungen über neuere geometrische Forschungen, 1872; trans. M. W. Haskell, 1893).
Submodules¶
Attributes¶
Classes¶
Structural verification report for the dual 4-track Book Codex and JSON apparatus. |
|
Immutable symbolic report on compass-and-straightedge constructibility. |
|
Symbolic verification of Cayley–Klein projective metric additivity (Note V & § 10). |
|
Aggregate report across all four transformation groups in the Erlangen hierarchy. |
|
Exact symbolic invariant audit for a single transformation group in Klein's hierarchy. |
|
Exact algebraic and geometric realization of Gauss's and Klein's regular 17-gon. |
Functions¶
|
Validate 4-track parity, apparatus JSON integrity, and content/code separation. |
|
Load |
|
Load |
|
Load |
|
Load |
|
Load |
|
Analyze compass-and-straightedge constructibility of a regular polygon, polynomial, or number. |
|
Return the exact depressed cubic resolvent \(R(t)\) of a degree-4 polynomial. |
|
Compute the exact minimal polynomial over \(\mathbb{Q}\) of \(u = 2\cos(2\pi/n)\). |
|
Test whether odd integer |
|
Return |
|
Return exact constructibility reports for all regular \(n\)-gons in |
|
Compute the Möbius-invariant 4-point quadrance cross-ratio \(\frac{Q(P_1,P_3)Q(P_2,P_4)}{Q(P_1,P_4)Q(P_2,P_3)}\). |
|
Return |
|
Return the exact affine-invariant ratio of signed areas \([P_1P_2P_3] / [Q_1Q_2Q_3]\). |
|
Prove symbolic additivity of Klein's projective metric \(d(A, B) = c \log(A, B; I_1, I_2)\). |
|
Execute an exact symbolic invariant audit across four groups of Klein's Erlangen Program. |
|
Canonicalize an exact cyclotomic-17 expression onto Gauss's radical basis in \(K_{16}\). |
|
Construct Gauss's 17-gon period tower and Klein's von Staudt–Schröter single-circle 17-gon. |
Package Contents¶
- geometor.klein.ERLANGEN_UNITS: tuple[str, ...] = ('prefatory-intro', 'sec-01-02-principal-hierarchy', 'sec-03-05-projective-transference',...¶
- geometor.klein.FAMOUS_PROBLEMS_UNITS: tuple[str, ...] = ('intro', 'part1-ch1-square-roots', 'part1-ch2-delian-trisection', 'part1-ch3-cyclotomy',...¶
- geometor.klein.SISTER_CORPORA: tuple[str, ...] = ('euclid', 'kepler', 'hilbert', 'bertrand-russell', 'hoenen', 'lemoine', 'petersen', 'pappus',...¶
- class geometor.klein.CodexAuditReport¶
Structural verification report for the dual 4-track Book Codex and JSON apparatus.
- famous_problems_units: int¶
- erlangen_units: int¶
- total_track_files: int¶
- missing_track_files: tuple[str, ...]¶
- persons_count: int¶
- citations_count: int¶
- glossary_count: int¶
- concordance_count: int¶
- linked_sister_corpora: tuple[str, ...]¶
- embedded_py_files_in_resources: tuple[str, ...]¶
- property is_valid: bool¶
Return
Trueiff all 64 track files and apparatus constraints pass.
- geometor.klein.audit_codex(repo_root: pathlib.Path = REPO_ROOT) CodexAuditReport¶
Validate 4-track parity, apparatus JSON integrity, and content/code separation.
- geometor.klein.load_citations(repo_root: pathlib.Path = REPO_ROOT) dict[str, dict[str, str]]¶
Load
resources/citations.json.
- geometor.klein.load_concordance(repo_root: pathlib.Path = REPO_ROOT) list[dict[str, Any]]¶
Load
resources/klein/concordance.json.
- geometor.klein.load_glossary(repo_root: pathlib.Path = REPO_ROOT) dict[str, dict[str, str]]¶
Load
resources/glossary.json.
- geometor.klein.load_persons(repo_root: pathlib.Path = REPO_ROOT) dict[str, dict[str, str]]¶
Load
resources/persons.json.
- geometor.klein.load_sources_manifest(repo_root: pathlib.Path = REPO_ROOT) dict[str, Any]¶
Load
resources/klein/sources_manifest.json.
- class geometor.klein.ConstructibilityReport¶
Immutable symbolic report on compass-and-straightedge constructibility.
- target: str¶
- kind: str¶
- is_constructible: bool¶
- degree: int | None¶
- is_power_of_two: bool¶
- tower_depth: int | None¶
- minimal_poly: sympy.Poly | None¶
- real_minimal_poly: sympy.Poly | None = None¶
- euler_totient: int | None = None¶
- odd_prime_factors: tuple[int, ...] = ()¶
- fermat_primes: tuple[int, ...] = ()¶
- non_fermat_primes: tuple[int, ...] = ()¶
- repeated_odd_primes: tuple[int, ...] = ()¶
- galois_obstruction: str | None = None¶
- klein_locus: str = ''¶
- summary: str = ''¶
- geometor.klein.analyze_constructibility(poly_or_n: int | sympy.Integer | sympy.Poly | sympy.Expr) ConstructibilityReport¶
Analyze compass-and-straightedge constructibility of a regular polygon, polynomial, or number.
- Parameters:
poly_or_n –
int/sympy.Integer(\(n \ge 3\)): tests the regular \(n\)-gon via Euler’s totient \(\varphi(n) = 2^k\) and Fermat-prime factorization.sympy.Polyor univariatesympy.Expr: factors over \(\mathbb{Q}\) and applies Klein’s degree-\(2^h\) criterion plus cubic-resolvent Galois check.Closed-form algebraic or transcendental
sympy.Expr(no free symbols): detects transcendence (\(\pi\), \(e\)) or computes the exact minimal polynomial over \(\mathbb{Q}\).
- Returns:
A populated
ConstructibilityReportwith exact minimal polynomial, tower depth, and Galois/transcendence obstruction diagnosis.
- geometor.klein.cubic_resolvent(quartic_poly: sympy.Poly, var: sympy.Symbol | None = None) sympy.Poly¶
Return the exact depressed cubic resolvent \(R(t)\) of a degree-4 polynomial.
Depresses \(a_4 x^4 + a_3 x^3 + a_2 x^2 + a_1 x + a_0\) via \(x = y - a_3/(4a_4)\) into \(y^4 + p y^2 + q y + r\) and returns \(R(t) = t^3 - 2p t^2 + (p^2 - 4r) t + q^2\) over \(\mathbb{Q}\).
- geometor.klein.cyclotomic_real_minimal_poly(n: int, var: sympy.Symbol | None = None) sympy.Poly¶
Compute the exact minimal polynomial over \(\mathbb{Q}\) of \(u = 2\cos(2\pi/n)\).
For \(n \ge 3\), \(\Phi_n(z)\) has even degree \(\varphi(n) = 2d\) and is palindromic, so \(z^{-d}\Phi_n(z)\) is an integer polynomial of degree \(d\) in \(u = z + z^{-1} = 2\cos(2\pi/n)\). For \(n = 1, 2\), returns \(u - 2\) and \(u + 2\) respectively.
- geometor.klein.is_fermat_prime(p: int) tuple[bool, int | None]¶
Test whether odd integer
pis a Fermat prime \(2^{2^\mu} + 1\).- Parameters:
p – Integer candidate.
- Returns:
Tuple
(True, mu)whenpis prime andp - 1 = 2**(2**mu), otherwise(False, None).
- geometor.klein.is_power_of_two(m: int) tuple[bool, int | None]¶
Return
(True, h)ifm == 2**hforh >= 0, else(False, None).
- geometor.klein.tabulate_polygon_constructibility(max_n: int = 24, *, min_n: int = 3) list[ConstructibilityReport]¶
Return exact constructibility reports for all regular \(n\)-gons in
[min_n, max_n].
- class geometor.klein.CayleyKleinReport¶
Symbolic verification of Cayley–Klein projective metric additivity (Note V & § 10).
- cross_ratio_ab: sympy.Expr¶
- cross_ratio_bc: sympy.Expr¶
- cross_ratio_ac: sympy.Expr¶
- multiplicative_identity_residual: sympy.Expr¶
- hyperbolic_sample_distance_ab: sympy.Expr¶
- hyperbolic_sample_distance_bc: sympy.Expr¶
- hyperbolic_sample_distance_ac: sympy.Expr¶
- additive_residual: sympy.Expr¶
- class geometor.klein.ErlangenHierarchyReport¶
Aggregate report across all four transformation groups in the Erlangen hierarchy.
- collinear_quadruple: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]¶
- concyclic_quadruple: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]¶
- triangle_vertices: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]¶
- rungs: tuple[ErlangenRungResult, ...]¶
- by_key() dict[str, ErlangenRungResult]¶
Map
group_keyto itsErlangenRungResult.
- class geometor.klein.ErlangenRungResult¶
Exact symbolic invariant audit for a single transformation group in Klein’s hierarchy.
- group_key: str¶
- group_name: str¶
- erlangen_section: str¶
- transformation_formula: str¶
- preserved: dict[str, bool]¶
- exact_values_before: dict[str, sympy.Expr]¶
- exact_values_after: dict[str, sympy.Expr]¶
- exact_differences: dict[str, sympy.Expr]¶
- geometor.klein.circular_quadrance_cross_ratio(p1: sympy.geometry.Point2D, p2: sympy.geometry.Point2D, p3: sympy.geometry.Point2D, p4: sympy.geometry.Point2D) sympy.Expr¶
Compute the Möbius-invariant 4-point quadrance cross-ratio \(\frac{Q(P_1,P_3)Q(P_2,P_4)}{Q(P_1,P_4)Q(P_2,P_3)}\).
Under any Euclidean similarity or any circle inversion \(P \mapsto O + R^2(P-O)/Q(O,P)\) (whose center \(O\) is distinct from \(P_1..P_4\)), the squared chord length transforms as \(Q(P_i', P_j') = R^4 Q(P_i, P_j) / [Q(O, P_i) Q(O, P_j)]\), so all four denominator factors \(Q(O, P_k)\) cancel identically! Furthermore, when \(A, B, C, D\) are collinear, this coincides with the square \((A, B; C, D)^2\) of the projective cross-ratio.
- geometor.klein.is_concyclic(p1: sympy.geometry.Point2D, p2: sympy.geometry.Point2D, p3: sympy.geometry.Point2D, p4: sympy.geometry.Point2D) bool¶
Return
Trueiffp1, p2, p3, p4lie on a generalized circle (circle or straight line).
- geometor.klein.signed_area_ratio(p1: sympy.geometry.Point2D, p2: sympy.geometry.Point2D, p3: sympy.geometry.Point2D, q1: sympy.geometry.Point2D, q2: sympy.geometry.Point2D, q3: sympy.geometry.Point2D) sympy.Expr¶
Return the exact affine-invariant ratio of signed areas \([P_1P_2P_3] / [Q_1Q_2Q_3]\).
- geometor.klein.verify_cayley_klein_additivity() CayleyKleinReport¶
Prove symbolic additivity of Klein’s projective metric \(d(A, B) = c \log(A, B; I_1, I_2)\).
In Note V (On the So-Called Non-Euclidean Geometry) and § 10.2 of the Erlangen Program, Klein subsumes hyperbolic, elliptic, and parabolic metrics under projective geometry by adjoining an invariant second-degree Absolute (\(\Omega = 0\)). Along any line meeting the Absolute in \(I_1, I_2\), the cross-ratio multiplicativity \((A, B; I_1, I_2) \cdot (B, C; I_1, I_2) = (A, C; I_1, I_2)\) converts into exact geodesic distance additivity \(d(A, B) + d(B, C) = d(A, C)\).
- geometor.klein.verify_erlangen_invariants() ErlangenHierarchyReport¶
Execute an exact symbolic invariant audit across four groups of Klein’s Erlangen Program.
Applies four rational planar transformations to a shared exact rational point configuration:
principal_similarity(Hauptgruppe, § 1): rational rotation \((3/5, 4/5)\), isotropic scaling \(5/2\), and translation \((3, -2)\).affine_shear(§ 2): equiaffine shear + translation \((x, y) \mapsto (x + 2y + 1, y - 3)\).projective_homography(§ 3): nonsingular projective collineation \((x, y) \mapsto \left(\frac{2x + y + 1}{x + y + 3}, \frac{x + 3y + 2}{x + y + 3}\right)\).moebius_circle_inversion(Geometrie der reciproken Radien, § 6): inversion in the circle centered at \(O_{\mathrm{inv}}(-1, -2)\) of squared radius \(R^2 = 5\).
- class geometor.klein.Gauss17GonPeriods¶
Exact algebraic and geometric realization of Gauss’s and Klein’s regular 17-gon.
- primitive_root: int¶
- exponent_cycle: tuple[int, ...]¶
- x1: sympy.Expr¶
- x2: sympy.Expr¶
- y1: sympy.Expr¶
- y2: sympy.Expr¶
- y3: sympy.Expr¶
- y4: sympy.Expr¶
- z_periods: tuple[sympy.Expr, ...]¶
- cos_2pi_17: sympy.Expr¶
- sin_2pi_17: sympy.Expr¶
- eq_xi: sympy.Poly¶
- eq_eta: sympy.Poly¶
- eq_eta_prime: sympy.Poly¶
- eq_zeta: sympy.Poly¶
- radical_dependence_residual: sympy.Expr¶
- model: geometor.model.Model¶
- fixed_circle: sympy.geometry.Circle¶
- milestones: dict[str, sympy.geometry.Point]¶
- vertices: tuple[sympy.geometry.Point, ...]¶
- geometor.klein.canonicalize_17(expr: sympy.Expr) sympy.Expr¶
Canonicalize an exact cyclotomic-17 expression onto Gauss’s radical basis in \(K_{16}\).
- geometor.klein.construct_gauss_17gon_periods(model: geometor.model.Model | None = None, *, inscribe_polygon: bool = True, add_sides: bool = True) Gauss17GonPeriods¶
Construct Gauss’s 17-gon period tower and Klein’s von Staudt–Schröter single-circle 17-gon.
Solves all four quadratic period equations \((\xi), (\eta), (\eta'), (\zeta)\) on the single fixed circle \(C_0: x^2 + y(y - 2) = 0\) (center
C0c(0, 1), bottomO(0, 0), topA(0, 2)) using straightedge lines alone, and (wheninscribe_polygon=True) inscribes all 17 exact regular heptadecagon verticesV0..``V16`` on \(C_0\) via Steiner’s straightedge parallel theorem—keepinglen(model.circles) == 1and0floats!- Parameters:
model – Optional existing
Model(must haveauto_intersect=Falseor will be configured withcanonicalize_17). WhenNone, creates a freshModel("klein_von_staudt_17gon", logger=False, auto_intersect=False).inscribe_polygon – If
True(default), construct all 17 exact verticesV0..``V16``.add_sides – If
True(default) andinscribe_polygon=True, add the 17 polygon sides.
- Returns:
A frozen
Gauss17GonPeriodsbundle containing the verified algebraic periods, minimal quadratic equations, and exactModel.
- geometor.klein.__version__ = '0.1.0'¶