Files
vvsandClaude Opus 5 862feaff86 Revision 1, step 1: one scoring criterion, the correct order, and the internal inconsistencies.
Point 1. The base step's order is Muller's 1.839, not 2: the derivative of the parabola through
the last three points errs by f'''/6 (x_n - x_{n-1})(x_n - x_{n-2}) = O(e_{n-1} e_{n-2}).
order_high_precision.py (3000 digits, to 1e-2900): 1.840 on cos x - x, e^x - 2, x^3 - x - 2,
sin x - 1/2; 2.000 only on x^2 - 2; two-point 1.618. The double-precision medians (2.000, 1.94)
are removed from the text.

Point 3. Every protocol number is re-scored under the criterion of section 9 - a sign change
within 1e-6 or f(x) == 0. rescore_uniform.py re-runs all 2779 distinct configurations of the 25
protocol sweeps on APS and CHA (the runs did not keep x) -> sweep_uniform.json, same row format;
it reproduces the APS/CHA lines of Table 10 exactly (built-in check). verify_article.py,
audit_similarity_places.py and the gap diagnostics read the re-scored data; the multiplier and
endowment measurements score by the same criterion. Table 7 (two criteria side by side) is gone;
7.3 now explains why the criterion is a sign change. Consequences stated in the text: the base
rule 2634 / 2357 against Chandrupatla 2595 / 1505 (1.5% behind on APS, no longer "level"); A'
2259 / 1074 (12.9% and 28.6% below Chandrupatla); the defect reading 2351 is second to the
shape reading 2337, not the record; the remembered analogy is level with no regime (2633 vs
2634) under this criterion; Table 9a's range is 19% to 425%.

Point 8. report_sweep.head_to_head counts every problem, failures charged (it counted only the
problems both methods solved, which is why Table 8 rows summed to 153 and 40). Family-level
comparisons added (A' vs Chandrupatla 8/1/6 of 15 and 7/0/2 of 9 families, not significant), and
an independence paragraph in section 9.

Point 11. sweep_itp.py: ITP (recommended constants and per-problem oracle) on all six corpora ->
Table 10; behind A' on every corpus, 0 bound violations.

Points 7, 9, 10 and the internals: the 2x bound is ours, not the rivals' promise; the law
predicts the group order only; "outside the proven bracket" explained (narrowest bracket of all
observed signs); 7.4's fun1 paragraph corrected (five costs under safe; the unguarded numbers
belong to fun1.4, fun1.5 and to fun3.1, fun5.1 separately); Table 1's last cell; the corpus-4
composition and odd multiplicities stated, also in the abstract.

build_tex.py: pdflatex output decoded with errors="replace" (a UTF-8 character cut by TeX's log
wrap crashed the build). Table 10 column widths rebalanced.

Checks: verify_article on the server 500 OK / 0 BAD (467 existing with the new values, 33 new);
regression x2 on the server 1232 passed, 0 failed; PDF 28 pages, 0 errors, 0 undefined, 0 overfull.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 07:01:36 +01:00

173 lines
7.1 KiB
Python

"""Read sweep_full.json and answer the questions the paper needs answered.
Everything printed here comes from the single server run; no number is
recomputed on a different machine. (The test functions use libm, whose last
digit differs between Windows and Linux, so mixing platforms would move
evaluation counts by a unit or two - measured: scipy's toms748 scores 2819 on
Windows and 2820 on Linux for the same set.)
"""
from __future__ import annotations
import json
import sys
BASE = {"bisection", "regula_falsi", "illinois", "pegasus", "anderson_bjorck",
"ridders", "brent", "toms748", "itp", "itp_oracle"}
# The configuration the paper proposes. It is not the winner of a search over
# the grid - it is what the theory of section 2 dictates, fixed before the
# ranking is looked at:
# similarity a nonzero slope of (1 - S) at 0 -> the ratio form 1 - |z|
# scale the finest data-derived one -> the three-point difference
# safeguard the one that carries a bound without destroying the order ->
# the scheduled projection, twice the bisection budget
# Valeri's decision, 2026-09-21 (variant a): the projection is proposed with its
# multiplier DECLARED as the method's one free constant - on the canonical set the
# total is the same for every multiplier from 1.25 to 4, on the wide-bracket set it
# is not (measure_budget_factor.py). The earned projection (credit) is kept as the
# constant-free variant; it was PROPOSED here for a while, a choice recorded in code
# but never taken by Valeri.
# The grid is evidence for the theory, not the method's selection procedure.
PROPOSED = "pure.ratio.derived3.project"
CREDIT = "pure.ratio.derived3.credit" # the constant-free variant
TUNED = {"illinois", "pegasus", "anderson_bjorck", "brent", "toms748",
"itp", "itp_oracle"}
def load(path="sweep_full.json"):
with open(path, encoding="utf8") as fh:
return json.load(fh)
def rank(rows, setname):
return sorted(rows, key=lambda r: (r[setname]["n"] - r[setname]["solved"],
r[setname]["total"]))
def place(rows, setname, lbl):
for i, r in enumerate(rank(rows, setname), 1):
if r["label"] == lbl:
return i
raise KeyError(f"no configuration labelled {lbl!r} in the sweep; "
"a mistyped name must not be reported as a missing place")
def best_pure(rows, setname):
"""The best configuration OF OURS. The overall winner of a set may be a
baseline - itp_oracle tops Chandrupatla - and comparing that against
itself prints nothing of interest."""
for r in rank(rows, setname):
if r["label"].startswith("pure."):
return r["label"]
raise KeyError("no pure configuration in the sweep")
def head_to_head(rows, a, b, setname):
"""Wins/ties/losses of a against b over EVERY problem of the set, a failure charged the
full budget - the charging of the totals. Until 2026-09-22 only the problems both
methods solved were counted, so a row of the paper summed to 153 of 154 (found on revision)."""
ra = next(r for r in rows if r["label"] == a)[setname]
rb = next(r for r in rows if r["label"] == b)[setname]
win = tie = loss = both = 0
for pid, (na, oka) in ra["per"].items():
nb, okb = rb["per"][pid]
na, nb = (na if oka else 200), (nb if okb else 200)
both += 1
if na < nb:
win += 1
elif na > nb:
loss += 1
else:
tie += 1
return win, tie, loss, both
def main():
rows = load(sys.argv[1] if len(sys.argv) > 1 else "sweep_full.json")
print(f"{len(rows)} configurations\n")
for setname in ("APS", "CHA"):
r = rank(rows, setname)
n = r[0][setname]["n"]
print("=" * 90)
print(f"{setname} ({n} problems) top 12, with the best baseline "
f"positions marked")
print("=" * 90)
print(f"{'#':>3s} {'configuration':38s}{'tuning':>8s}{'solved':>9s}"
f"{'total':>9s}{'over 2x':>9s}")
print("-" * 90)
for i, row in enumerate(r[:12], 1):
d = row[setname]
tuned = "yes" if row["label"] in TUNED else "no"
star = " <-" if row["label"] not in BASE else ""
print(f"{i:>3d} {row['label']:38s}{tuned:>8s}"
f"{d['solved']:>6d}/{d['n']:<3d}{d['total']:>9d}"
f"{d['over']:>9d}{star}")
print()
for b in ("brent", "toms748", "itp", "itp_oracle", "bisection"):
p = place(rows, setname, b)
d = next(x for x in rows if x["label"] == b)[setname]
print(f" {b:38s}place {p:>3d} total {d['total']}")
print()
print("=" * 90)
print(f"THE PROPOSED CONFIGURATION {PROPOSED}")
print(" (dictated by the theory, not selected from the ranking)")
print("=" * 90)
for setname in ("APS", "CHA"):
d = next(r for r in rows if r["label"] == PROPOSED)[setname]
print(f" {setname}: place {place(rows, setname, PROPOSED):>3d} of "
f"{len(rows)} solved {d['solved']}/{d['n']} "
f"total {d['total']} over 2x bound {d['over']}")
for opp in ("brent", "toms748", "itp", "itp_oracle", "bisection"):
w, t, l, both = head_to_head(rows, PROPOSED, opp, setname)
print(f" vs {opp:12s}: {w} wins / {t} ties / {l} losses "
f"(of {both})")
print()
print("=" * 90)
print("HEAD TO HEAD, best pure configuration of each set")
print("=" * 90)
for setname in ("APS", "CHA"):
best = best_pure(rows, setname)
for opp in ("brent", "toms748", "itp", "itp_oracle"):
w, t, l, both = head_to_head(rows, best, opp, setname)
print(f"{setname} {best} vs {opp:12s}: "
f"{w} wins / {t} ties / {l} losses (of {both})")
print()
print("=" * 90)
print("BEST CONFIGURATION THAT CARRIES THE PROVEN 2x BOUND")
print("=" * 90)
for setname in ("APS", "CHA"):
sound = [x for x in rank(rows, setname)
if x["label"].startswith("pure.")
and x["label"].rsplit(".", 1)[1] in ("bracket", "both")]
b = sound[0]
print(f"{setname}: {b['label']:38s} total {b[setname]['total']:>7d}"
f" place {place(rows, setname, b['label'])}")
print("\n" + "=" * 90)
print("WHICH SIMILARITY, WHICH SCALE (guard = step, both sets summed)")
print("=" * 90)
sims, scales = {}, {}
for row in rows:
if not row["label"].startswith("pure."):
continue
_, sim, scale, guard = row["label"].split(".")
if guard != "step":
continue
tot = row["APS"]["total"] + row["CHA"]["total"]
sims.setdefault(sim, []).append(tot)
scales.setdefault(scale, []).append(tot)
print("similarity (best over scales):")
for sim, v in sorted(sims.items(), key=lambda kv: min(kv[1])):
print(f" {sim:12s} best {min(v):>7d} worst {max(v):>7d}")
print("scale (best over similarities):")
for sc, v in sorted(scales.items(), key=lambda kv: min(kv[1])):
print(f" {sc:12s} best {min(v):>7d} worst {max(v):>7d}")
if __name__ == "__main__":
main()