GC-03.01 · Symbolic Model & Source

Companion symbolic Python construction for GC-03.01 · Tran Quang Hung’s Square Inscribed in a Right Isosceles Semicircle (GC-03.01).

Programmatic Usage

from geometor.divine.catalog import build_construction

        model, cert = build_construction("GC-03.01")
        assert cert.ratio_expr == sp.GoldenRatio
        

Exact Builder Implementation

def build_tran_square_inscribed_semicircle() -> ConstructionResult:
            """Square inscribed in a right isosceles triangle inside a circle (Tran Quang Hung)."""
            m = new_catalog_model("tran-square-inscribed-semicircle")
            O = m.set_point(0, 0, classes=["given"], ID="O")
            A = m.set_point(-3, 0, classes=["given"], ID="A")
            B = m.set_point(3, 0, classes=["given"], ID="B")
            C = m.set_point(0, 3, ID="C")

            c_o = m.construct_circle(O, B, classes=["primary"], ID="cO")
            m.construct_polygon([A, B, C], ID="ABC")
            m.construct_line(A, B, ID="AB")

            # Inscribed square DEGF with F=(-1,0), G=(1,0) on AB and D=(-1,2) on AC, E=(1,2) on BC
            D = m.set_point(-1, 2, ID="D")
            E = m.set_point(1, 2, ID="E")
            G = m.set_point(1, 0, ID="G")
            F = m.set_point(-1, 0, ID="F")
            m.construct_polygon([D, E, G, F], classes=["golden"], ID="DEGF")

            ln_de = m.construct_line(D, E, classes=["golden"], ID="DE")
            Q = m.intersect(ln_de, c_o, beyond=(E, D), classes=["golden"], ID="Q")
            m.intersect(ln_de, c_o, beyond=(D, E), classes=["golden"], ID="P")
            _ = Q

            return make_result(m, ("D", "E"), ("E", "P"), ("D", "E", "P"))
        

Exact Symbolic Point Coordinates

All points in tran-square-inscribed-semicircle are certified free of floating-point approximations over \(\mathbb{Q}(\phi)\):

Point

Exact \(x\)

Exact \(y\)

O

\(0\)

\(0\)

A

\(-3\)

\(0\)

B

\(3\)

\(0\)

C

\(0\)

\(3\)

D

\(-1\)

\(2\)

E

\(1\)

\(2\)

G

\(1\)

\(0\)

F

\(-1\)

\(0\)

Q

\(- \sqrt{5}\)

\(2\)

P

\(\sqrt{5}\)

\(2\)

Certified Golden Ratio: DE / EP = GoldenRatio.