"""The record for n = 10 points in the unit square, the smallest open case, with its tied smallest triangles. Coordinates: Comellas and Yebra's configuration as listed by Tej Stead's record tables, https://math.tejstead.com/heilbronn/square/10/points.txt (exact closed form from arXiv:2603.11107, truncated to 30 digits). Every triangle area is recomputed here in exact rational arithmetic; a triangle ties with the smallest when it is within a relative 1e-9 of it, the tables' tie window (truncating the coordinates moves the tied areas apart by less than that). """ from fractions import Fraction as F from itertools import combinations from pathlib import Path import kit POINTS = [ ('0.157805568804305564655835692968', '0'), ('0.747612632460630047142556610421', '0'), ('0', '0.157805568804305564655835692968'), ('1', '0.252387367539369952857443389578'), ('0.684388862391388870688328614063', '0.315611137608611129311671385936'), ('0.315611137608611129311671385936', '0.684388862391388870688328614063'), ('0', '0.747612632460630047142556610421'), ('1', '0.842194431195694435344164307031'), ('0.252387367539369952857443389578', '1'), ('0.842194431195694435344164307031', '1'), ] P = [(F(x), F(y)) for x, y in POINTS] def area(a, b, c): return abs((b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1])) / 2 areas = {t: area(*(P[i] for i in t)) for t in combinations(range(len(P)), 3)} smallest = min(areas.values()) tied = [t for t, a in areas.items() if a <= smallest * (1 + F(1, 10 ** 9))] assert len(P) == 10 and all(0 <= c <= 1 for p in P for c in p) assert f'{float(smallest):.10f}' == '0.0465374196', smallest # the README's record value assert len(tied) == 16, len(tied) S, X0, Y0 = 236, (kit.W - 236) / 2, 14 at = lambda p: (X0 + float(p[0]) * S, Y0 + (1 - float(p[1])) * S) body = kit.polygon([(X0, Y0), (X0 + S, Y0), (X0 + S, Y0 + S), (X0, Y0 + S)], 'faint-s', ' stroke-width="2"') body += ''.join(kit.polygon([at(P[i]) for i in t], 'f-soft') for t in tied) body += ''.join(kit.polygon([at(P[i]) for i in t], 'f-s', ' stroke-width="2" stroke-opacity=".75"') for t in tied) body += ''.join(kit.dot(*at(p), r=6.5) for p in P) kit.write(__file__, 'mathematics', body, label=f'n = 10 ยท {len(tied)} smallest triangles tie at 0.0465')