"""Tables 2-3 of article/sim_numerics.md regenerated from sweep_full.json. The published tables predate Chandrupatla's own method as a baseline (it is first on Alefeld-Potra-Shi) and name the projection variant as proposed, while the code and the proposed method is the scheduled projection with its multiplier declared (Valeri, 2026-09-21, variant a), the earned projection the constant-free variant. Baselines are the library alone (Chandrupatla = scipy elementwise.find_root, Brent = brentq). This prints the rows and head-to-head counts from the data, with the SAME ranking function the verifier uses, so nothing in the new tables is transcribed by hand. python -u tables_for_md.py """ from __future__ import annotations from report_sweep import CREDIT, PROPOSED, TUNED, head_to_head, load, place NONE = "pure.ratio.derived3.none" NAMES = {PROPOSED: "**proposed: tent, 3-point, projection ($c=2$)**", CREDIT: "constant-free variant: earned projection", NONE: "the same rule with no safeguard at all", "chandrupatla": "Chandrupatla", "toms748": "TOMS 748", "brent": "Brent", "dekker": "Dekker", "itp_oracle": "ITP, per-problem oracle", "ridders": "Ridders", "itp": "ITP, recommended constants", "illinois": "Illinois", "bisection": "bisection", "regula_falsi": "false position", "pure.sqrt.bracket.project": "similarity, $1-\\sqrt{|z|}$, bracket scale, projection", "pure.exp_abs.bracket.both": "similarity, $e^{-|z|}$, bracket scale, both guards"} APS_ROWS = ("chandrupatla", CREDIT, NONE, "toms748", "brent", "dekker", "itp_oracle", "ridders", PROPOSED, "itp", "illinois", "bisection", "regula_falsi") CHA_ROWS = ("pure.sqrt.bracket.project", "chandrupatla", "itp_oracle", "pure.exp_abs.bracket.both", "itp", PROPOSED, "bisection", CREDIT, NONE, "toms748", "brent") OPPONENTS = ("chandrupatla", "toms748", "brent", "itp", "itp_oracle", "bisection") def main(): rows = load() by = {r["label"]: r for r in rows} print(f"configurations in the sweep: {len(rows)}") for setname, keys in (("APS", APS_ROWS), ("CHA", CHA_ROWS)): n = by[PROPOSED][setname]["n"] print(f"\n{setname}, {n} problems") print("| # | configuration | tuned | solved | total evals | $>2\\times$ |") print("|---|---|---|---|---|---|") for k in sorted(keys, key=lambda k: place(rows, setname, k)): d = by[k][setname] tuned = "yes" if k in TUNED else "no" over = "—" if k in ("regula_falsi",) else str(d["over"]) print(f"| {place(rows, setname, k)} | {NAMES[k]} | {tuned} | " f"{d['solved']}/{n} | {d['total']} | {over} |") for lbl in (PROPOSED, CREDIT): print(f"\nhead to head, {lbl} (wins/ties/losses on problems both solve)") for setname in ("APS", "CHA"): cells = [] for opp in OPPONENTS: w, t, l, _ = head_to_head(rows, lbl, opp, setname) cells.append(f"{opp} {w}/{t}/{l}") print(f" {setname}: " + ", ".join(cells)) for lbl in (PROPOSED, CREDIT, "chandrupatla", "toms748", "brent", "itp_oracle"): d = by[lbl] print(f" both sets {lbl:34s} {d['APS']['total'] + d['CHA']['total']}") if __name__ == "__main__": main()