PREREG_applied outcome (server): variant A does NOT transfer - total 1580 vs Chandrupatla 1382 (+14%), per problem 40/46/46 p=0.59; guarantee held, 132/132 solved. Wins where roots are (near-)multiple: Kepler e->1 20/11/4, van der Waals near-critical 9/7/4. Losses traced to two gaps in the BASE step (the plain rule loses the same): (1) no bracket closing at the end - on sin[3,4] the root is reached in 7 evaluations (|f| 1e-16) but the far end stays 1.3e-7 away and 17 halvings follow, where Chandrupatla steps a tolerance past the root (Dekker/Brent's device); likely also the IRR losses (1/0/11); (2) roots of order < 1 (sqrt|x| sgn x): the step overshoots and oscillates (+0.15, -0.10, +0.066 ... ratio 0.8), 84 vs 4 - the unkept-promise flag only sees undershoots, the regime only m >= 2.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
vvs
2026-09-21 19:49:36 +01:00
co-authored by Claude Opus 5
parent 8ea89dd38d
commit c2b0eea0f6
3 changed files with 121 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
== ALL 132
base total 1590 solved 132/132 violations 0
A total 1580 solved 132/132 violations 0
B total 1601 solved 132/132 violations 0
chandrupatla total 1382 solved 132/132 violations 0
brent total 1503 solved 132/132 violations 1
toms748 total 1756 solved 132/132 violations 1
A: T1 ✗ (1580 vs 1382, +14.3%) T2 ✗ (40/46/46 p=0.59) T3 ✓ (viol 0, solved 132 vs 132) -> does NOT transfer
vs brent total 1580 vs 1503 per problem 48/48/36 p=0.23
vs toms748 total 1580 vs 1756 per problem 97/17/18 p=2.8e-14
B: T1 ✗ (1601 vs 1382, +15.8%) T2 ✗ (39/53/40 p=1) T3 ✓ (viol 0, solved 132 vs 132) -> does NOT transfer
vs brent total 1601 vs 1503 per problem 55/41/36 p=0.059
vs toms748 total 1601 vs 1756 per problem 96/19/17 p=1.5e-14
== PER GROUP: A / B / Chandrupatla / Brent / TOMS748 totals; A vs Chandrupatla w/t/l
GSL n= 10 268 / 267 / 123 / 202 / 203 2/1/7
colebrook n= 36 426 / 402 / 400 / 431 / 530 3/17/16
irr n= 12 199 / 213 / 167 / 186 / 270 1/0/11
kepler n= 35 310 / 312 / 325 / 322 / 339 20/11/4
lambert n= 7 79 / 105 / 65 / 66 / 84 3/2/2
planck n= 7 66 / 67 / 68 / 66 / 74 2/5/0
vdw n= 20 183 / 186 / 190 / 192 / 207 9/7/4
well n= 5 49 / 49 / 44 / 38 / 49 0/3/2
applied done
File diff suppressed because one or more lines are too long
+96
View File
@@ -0,0 +1,96 @@
"""PREREG_applied_2026-09-21: variants A, B, the plain rule and the three library rivals on
the GSL test suite and the applied equations (corpus_applied.py).
python -u sweep_applied.py run -> sweep_applied.json, then the verdicts
python -u sweep_applied.py --report verdicts only
"""
from __future__ import annotations
import json
import math
import sys
from multiprocessing import Pool
from corpus_applied import build
from corpus_roots_jl import solved
from sweep_full import MAXFEV, XTOL, make_method
from sweep_oos import CONFIGS as OOS_CONFIGS
from sweep_oos import sign_p
NAMES = ("base", "A", "B", "chandrupatla", "brent", "toms748")
def evaluate(name):
method = make_method(OOS_CONFIGS[name])
probs, _ = build()
res = {}
for pid, f, a, b in probs:
try:
x, n, conv = method(f, a, b, XTOL, MAXFEV)
x = float(x)
except Exception:
x, n, conv = float("nan"), MAXFEV, False
ok = bool(conv and solved(f, x))
over = ok and int(n) > 2 * math.ceil(math.log2(abs(b - a) / XTOL)) + 4
res[pid] = [int(n), ok, bool(over)]
return name, res
def cost(v):
return v[0] if v[1] else MAXFEV
def group(pid):
return "GSL" if pid.startswith("G.") else pid.split(".")[1]
def report(R):
ch = R["chandrupatla"]
pids = list(R["A"])
print("== ALL 132")
for k in NAMES:
r = R[k]
print(f" {k:<14} total {sum(cost(v) for v in r.values()):6d} solved "
f"{sum(v[1] for v in r.values()):3d}/{len(r)} violations {sum(v[2] for v in r.values())}")
for v_name in ("A", "B"):
r = R[v_name]
tot, tot_ch = sum(cost(r[p]) for p in pids), sum(cost(ch[p]) for p in pids)
w = sum(cost(r[p]) < cost(ch[p]) for p in pids)
l = sum(cost(r[p]) > cost(ch[p]) for p in pids)
viol = sum(r[p][2] for p in pids)
sv, sc = sum(r[p][1] for p in pids), sum(ch[p][1] for p in pids)
t1, t2, t3 = tot < tot_ch, w > l and sign_p(w, l) < 0.05, viol == 0 and sv >= sc
print(f" {v_name}: T1 {'✓' if t1 else '✗'} ({tot} vs {tot_ch}, {100 * (tot - tot_ch) / tot_ch:+.1f}%)"
f" T2 {'✓' if t2 else '✗'} ({w}/{len(pids) - w - l}/{l} p={sign_p(w, l):.2g})"
f" T3 {'✓' if t3 else '✗'} (viol {viol}, solved {sv} vs {sc}) -> "
+ ("TRANSFERS" if t1 and t2 and t3 else "does NOT transfer"))
for rn in ("brent", "toms748"):
o = R[rn]
w2 = sum(cost(r[p]) < cost(o[p]) for p in pids)
l2 = sum(cost(r[p]) > cost(o[p]) for p in pids)
print(f" vs {rn:<8} total {tot} vs {sum(cost(o[p]) for p in pids)} "
f"per problem {w2}/{len(pids) - w2 - l2}/{l2} p={sign_p(w2, l2):.2g}")
print("\n== PER GROUP: A / B / Chandrupatla / Brent / TOMS748 totals; A vs Chandrupatla w/t/l")
for g in sorted({group(p) for p in pids}):
sel = [p for p in pids if group(p) == g]
tots = [sum(cost(R[k][p]) for p in sel) for k in ("A", "B", "chandrupatla", "brent", "toms748")]
w = sum(cost(R["A"][p]) < cost(ch[p]) for p in sel)
l = sum(cost(R["A"][p]) > cost(ch[p]) for p in sel)
print(f" {g:<10} n={len(sel):3d} " + " / ".join(f"{t:5d}" for t in tots)
+ f" {w}/{len(sel) - w - l}/{l}")
def main():
if "--report" not in sys.argv:
with Pool(len(NAMES)) as pool:
R = dict(pool.map(evaluate, NAMES))
with open("sweep_applied.json", "w", encoding="utf8") as fh:
json.dump(R, fh)
with open("sweep_applied.json", encoding="utf8") as fh:
R = json.load(fh)
report(R)
print("applied done")
if __name__ == "__main__":
main()