#!/usr/bin/env python3 """Where the transport ratio reaches 1.0000 on the T_23 column: theta, the two counts, and the by-L decomposition of the RHS at that theta. A tie must be shown to be a real equality of two counting statistics, not an artefact of the 4200-bin grid.""" import json import numpy as np import transport_support as T def main(): tiles = T.build_ladder(23) slots, W = tiles[23] g = T.gap_word(slots, W) out = {} for q in (29, 37, 61, 71, 107, 127): rhs, byL = T.tct_rhs(g, q, T.LMAX) nn = T.new_tail(slots, W, q) best_b, best_r = 0, -1.0 ties = [] for b in range(1, T.NB): if nn[b] == 0 and rhs[b] == 0: continue r = float("inf") if rhs[b] == 0 else float(nn[b]) / float(rhs[b]) if r > best_r: best_r, best_b = r, b for b in range(1, T.NB): if rhs[b] and nn[b] == rhs[b]: ties.append(b) L = T.trueL(slots, W, q) M = T.M_of(g, q) dec = [i for i in range(T.LMAX + 1) if byL[i][best_b] > 0] out[q] = {"L_true": L, "M": M, "argmax_bin": best_b, "argmax_theta": best_b * 6, "N_new": int(nn[best_b]), "RHS": int(rhs[best_b]), "ratio": round(best_r, 6), "byL_at_argmax": {str(i): int(byL[i][best_b]) for i in dec}, "n_bins_with_exact_tie": len(ties), "tie_bins": ties[:12], "tie_theta": [b * 6 for b in ties[:12]]} print("q=%-4d L=%d M=%d argmax theta=%-7d N_new=%-6d RHS=%-6d ratio=%.6f L terms %s exact ties %d %s" % (q, L, M, best_b * 6, nn[best_b], rhs[best_b], best_r, {i: int(byL[i][best_b]) for i in dec}, len(ties), [b * 6 for b in ties[:6]])) with open("probe_argmax.json", "w", encoding="utf-8", newline="\n") as fh: json.dump(out, fh, indent=1, sort_keys=True) return 0 if __name__ == "__main__": raise SystemExit(main())