Revision 2 into the paper.
2: 'pre-registered' -> 'recorded in advance'; Appendix D states the order is attested only by the author's git history. 3: Dekker, Illinois and false position exhaust the budget on aps.13.00 under either criterion (stalled where |f|<1e-62, no sign change within 1e-6) - hence unchanged totals. 4: exact-zero stops in Table 11 (CHA: Brent 15/20, Chandrupatla 4/20, A' 2/20; corpus 1: none, transformation still 3.4x cheaper). 5: Table 12, the multiplicity estimated during the run (A' ahead; the analogy order inside Chandrupatla closes 31-59% of the gap on multiple roots and pays on simple ones; Lagouanelle blind on side-alternating triples); 6.6, conclusion, future work. 6: Algorithms 1-2 - lo/hi, return on a stall, L_x/L_f and the empty memory, the step pattern as a formula, O(n^2). 7: Table 3's two bracket-scaled rows, dashes in Table 5, the abstract's last sentence (250 words). verify_revision2: 17 checks. Server: verify 544 OK / 0 BAD, regression x2 1238 passed, PDF 32 pages, 0 errors, 0 overfull. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
"""verify_article.py checks the numbers the second revision added: Table 12 and its paragraph
|
||||
(sweep_estimated.json), the exact-zero stops of Table 11 (diag_revision2.point4, fresh), the three
|
||||
unchanged rows of Table 2 (fresh runs on aps.13.00), the two new rows of Table 3, and the fractional
|
||||
readings of Lagouanelle's estimate on the canonical set (fresh). Adds verify_revision2() and its call.
|
||||
|
||||
python -u apply_verify_revision2.py
|
||||
"""
|
||||
PATH = "verify_article.py"
|
||||
FUNC = '''
|
||||
|
||||
def verify_revision2():
|
||||
"""Revision 2 (points 3, 4, 5, 7)."""
|
||||
import math
|
||||
print("\\nRevision 2:")
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
|
||||
def sign_p(w, l):
|
||||
k, n = min(w, l), w + l
|
||||
return min(1.0, 2.0 * sum(math.comb(n, i) for i in range(k + 1)) / 2.0 ** n)
|
||||
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
K = _load("sweep_estimated.json")
|
||||
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
|
||||
ap, ch = dict(seen["Aprime"]), dict(seen["chandrupatla"])
|
||||
ap.update(four["Aprime"])
|
||||
ch.update(four["chandrupatla"])
|
||||
K1 = _load("sweep_controls.json")["K1"]
|
||||
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
|
||||
|
||||
def group(r):
|
||||
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
rows = {"A'": ap, "K3A": K["k3_analogy"], "K3L": K["k3_lag"], "Ch(f)": ch}
|
||||
want = {"A'": (3656, 13032, 4042, 2259), "K3A": (3806, 15733, 2809, 3453),
|
||||
"K3L": (7526, 30991, 6041, 7215), "Ch(f)": (5717, 16481, 7011, 2595)}
|
||||
for k, r in rows.items():
|
||||
check(f"Table 12 {k}", (tot(r["D"]), sum(tot(r[s]) for s in sets), group(r), tot(r["APS"])), want[k])
|
||||
oracle = sum(tot(K1[s]["chandrupatla_g"], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]))
|
||||
for s in ("CHA", "NEW", "D"))
|
||||
check("Table 12 oracle row (Table 11 sum)", oracle, 1355)
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
check("A' vs Chandrupatla-on-g with the analogy order, corpus 4", (w, len(ps) - w - l, l), (126, 38, 76))
|
||||
check("its p (1 digit)", f"{sign_p(w, l):.1g}", "0.0005")
|
||||
shares = []
|
||||
for s in ("CHA", "NEW", "D"):
|
||||
keep = lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]) # noqa: E731
|
||||
a_, k_, o_ = tot(ap[s], keep), tot(K["k3_analogy"][s], keep), tot(K1[s]["chandrupatla_g"], keep)
|
||||
shares.append((k_, a_, round(100 * (a_ - k_) / (a_ - o_))))
|
||||
check("share of the A'-to-oracle gap closed by the analogy order", shares,
|
||||
[(322, 654, 59), (721, 1229, 58), (1766, 2159, 31)])
|
||||
check("K3 bound violations", sum(v[2] for k in K for s in sets for v in K[k][s].values()), 0)
|
||||
# Lagouanelle's fractional readings on the simple roots of the canonical set (fresh)
|
||||
from simroot.transformed import chandrupatla_transformed
|
||||
from sweep_full import load_problems
|
||||
frac = 0
|
||||
for s, pid, f, a, b, _r in load_problems():
|
||||
if s != "APS":
|
||||
continue
|
||||
st = {}
|
||||
chandrupatla_transformed(f, a, b, 1e-12, 200, estimator="lag", stats=st)
|
||||
m = st.get("m_hat", 1.0)
|
||||
frac += (0.0 < m <= 2.0 / 3.0)
|
||||
check("Lagouanelle holds a fractional order on simple APS roots", frac, 115)
|
||||
# point 4: exact-zero stops (fresh)
|
||||
import contextlib
|
||||
import io
|
||||
import diag_revision2
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
z = diag_revision2.point4()
|
||||
check("exact-zero stops on CHA: Brent(g), Chandrupatla(g), A'",
|
||||
(z["CHA"]["brent_g"][1], z["CHA"]["chandrupatla_g"][1], z["CHA"]["Aprime"][1]), (15, 4, 2))
|
||||
check("exact-zero stops of the transformed runs on corpus 1",
|
||||
(z["NEW"]["chandrupatla_g"][1], z["NEW"]["brent_g"][1]), (0, 0))
|
||||
check("corpus 1: transformation 3.4 times cheaper", round(1229 / 358, 1), 3.4)
|
||||
# point 3: the three unchanged rows of Table 2 (fresh)
|
||||
from corpus_roots_jl import solved
|
||||
from sweep_full import make_method
|
||||
f, a, b = next((f, a, b) for s, pid, f, a, b, _r in load_problems() if pid == "aps.13.00")
|
||||
got = []
|
||||
for name in ("dekker", "illinois", "regula_falsi"):
|
||||
x, n, conv = make_method(("base", name))(f, a, b, 1e-12, 200)
|
||||
got.append((name, int(n), bool(conv), bool(solved(f, float(x)))))
|
||||
check("aps.13.00: Dekker, Illinois, false position spend the budget unsolved",
|
||||
got, [("dekker", 200, False, False), ("illinois", 200, False, False),
|
||||
("regula_falsi", 200, False, False)])
|
||||
small = [abs(float(f(float(make_method(("base", nm))(f, a, b, 1e-12, 200)[0])))) < 1e-62
|
||||
for nm in ("dekker", "illinois")]
|
||||
check("Dekker and Illinois stall where |f| < 1e-62", small, [True, True])
|
||||
# point 7: Table 3's two added rows
|
||||
full = {r["label"]: r for r in _load("sweep_full.json")}
|
||||
for lb, want_ in (("pure.exp_abs.bracket.bracket", (1848, 45, 0)), ("pure.exp_abs.bracket.credit", (1952, 45, 0))):
|
||||
c = full[lb]["CHA"]
|
||||
check(f"Table 3 row {lb}", (c["total"], c["solved"], c["over"]), want_)
|
||||
'''
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
call_old = " verify_controls()\n\n print()"
|
||||
marker = '\n\nif __name__ == "__main__":\n main()\n'
|
||||
assert src.count(call_old) == 1 and src.count(marker) == 1
|
||||
src = src.replace(call_old, " verify_controls()\n verify_revision2()\n\n print()").replace(marker, FUNC + marker)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
print("added verify_revision2")
|
||||
Reference in New Issue
Block a user