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:
vvs
2026-09-22 09:31:19 +01:00
co-authored by Claude Opus 5
parent 34b2a30d6c
commit 6a1c264910
6 changed files with 415 additions and 31 deletions
+133
View File
@@ -0,0 +1,133 @@
"""Revision 2: points 2-7 into article/sim_numerics.md.
2 'pre-registered' -> 'recorded in advance'; Appendix D says the order is attested only by the
author's git history
3 why Dekker, Illinois and false position show the same totals under both criteria
4 exact-zero stops in Table 11, per method
5 control K3 (PREREG_estimated_transform): Table 12 and its paragraph; 6.6, conclusion, future work
6 Algorithms 1-2: lo/hi, the return on a stall, L_x and L_f, an empty memory, the step pattern
as a formula, the O(n^2) search
7 Table 3's two missing bracket-scaled rows; dashes in Table 5; the abstract's last sentence
Exact anchors, each found exactly once, or nothing is written.
python -u apply_article_revision2.py
"""
from __future__ import annotations
PATH = "article/sim_numerics.md"
R = []
def E(old, new):
R.append((old, new))
# ---- point 2
E("The code, the corpora and the pre-registrations are released", "The code, the corpora and the documents that recorded each test before its run are released")
E("Every rule below was pre-registered with a stop rule (Appendix D);", "Every rule below was recorded, with its criteria and stop rule, before its code and run (Appendix D);")
E("because the pre-registered rule removes only a component", "because the rule recorded in advance removes only a component")
E("Pre-registration protects each decision but not the chain:", "Recording each decision in advance protects the decision but not the chain:")
E("by every pre-registered criterion (per problem", "by every criterion recorded in advance (per problem")
E("Both were pre-registered, with what the paper would say under every outcome, before the run", "Both were recorded, with what the paper would say under every outcome, before the run")
E("as the pre-registered criterion required.", "as the criterion recorded in advance required.")
E("the pre-registrations with the commits of Appendix D;", "the advance records with the commits of Appendix D;")
E("and it passed every pre-registered criterion there.", "and it passed every criterion recorded for it there.")
E("was rejected by its own pre-registration,", "was rejected by its own advance record,")
E("## Appendix D. Pre-registrations and the frozen code", "## Appendix D. Advance records and the frozen code")
E("The code of A′ was committed (`8027d7f`)",
"We call these documents advance records, not pre-registrations: they live in the author's repository, and their order relative to the runs is attested only by the author's git history, whose timestamps the author sets; no external registry was used. A deposit with an external timestamp (Zenodo, OSF) before a run would remove that limitation for future tests. The code of A′ was committed (`8027d7f`)")
E("**Table D1.** Pre-registrations, in the order they were written.", "**Table D1.** Advance records, in the order they were written.")
E("| pre-registration | commit | results file | commit | order |", "| advance record | commit | results file | commit | order |")
# ---- point 3
E("and 79/5/70 against Brent.",
"and 79/5/70 against Brent. Dekker, Illinois and false position fail `aps.13.00` under either criterion and so keep their totals: they spend the whole budget without converging, Dekker and Illinois stalled on one side of the zero where $|f|<10^{-62}$ but $f$ does not change sign within $10^{-6}$.")
# ---- point 4
E("With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′.",
"With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. Every method, A′ included, stops on an exact zero of the function it evaluates, and on the pure powers of the Chandrupatla set $g$ is exactly linear, so the secant lands on the root: 15 of Brent's 20 runs and 4 of Chandrupatla's end that way there (A′: 2). On new corpus 1 no transformed run ends on a zero, and the transformation is still 3.4 times cheaper.")
# ---- point 5: K3
K3 = """
**The multiplicity estimated during the run.** Between A′ and the oracle lies the natural classical method: Chandrupatla's interpolation on $g=\\operatorname{sign}(f)|f|^{1/\\hat m}$ with $\\hat m$ estimated during the run. Our implementation of Chandrupatla's method (identical to the library on all 199 problems, and to itself when $\\hat m\\equiv1$) keeps the true $f$ at its three points and reads $G(v)=\\operatorname{sign}(v)|v|^{1/\\hat m}$ only in the acceptance band and the interpolation; $\\hat m$ starts at 1 and takes an order read from the last three evaluations whenever that order lies on a branch of §6.1 ($m\\ge2$ or $0<m\\le\\tfrac23$), without reset — the hysteresis of the controls above. The order is read either by Lagouanelle's estimate or by A′'s own analogy (recorded in advance, `sweep_estimated.py`):
**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set.
| method | corpus 4 | six corpora | multiple/fractional (148) | APS |
|---|---|---|---|---|
| **A′** | **3656** | **13032** | 4042 | **2259** |
| Chandrupatla on $g$, $\\hat m$ by analogy | 3806 | 15733 | 2809 | 3453 |
| Chandrupatla on $g$, $\\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |
| Chandrupatla on $g$, $m^*$ known (Table 11) | — | — | **1355** | — |
| Chandrupatla on $f$ | 5717 | 16481 | 7011 | 2595 |
A′ is ahead of both estimated forms on corpus 4, in total and problem by problem (against the analogy form 126/38/76, $p=5\\cdot10^{-4}$), and over the six corpora. The two estimators behave differently in this frame. Lagouanelle's reads the parabola through Chandrupatla's points, which alternate sides of the root; there it reports a fractional order on 115 of the 154 simple roots of the canonical set, holds it, and turns the method into little more than bisection. (A variant restricted to the branch $m\\ge2$ was not among the controls recorded.) The analogy's order is the better one here too, and on the multiple and fractional roots it does better inside Chandrupatla's interpolation than inside A′'s split: it closes 59%, 58% and 31% of the gap from A′ to the oracle on the Chandrupatla set, corpus 1 and corpus 4 (322 against 654, 721 against 1229, 1766 against 2159). It pays on simple roots, where it has no exit to take a false reading back (3453 against 2595 on the canonical set). So the decision layer of A′ earns its place against the classical method with an estimated order as well; and the split (7), not the order estimate, is where A′ leaves most to the transformation."""
E("large, and the clearest direction for improving the method.", "large, and the clearest direction for improving the method." + K3)
E("§7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance.",
"§7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance or estimated during the run.")
E("Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place;",
"Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and Chandrupatla's method on the transformed function with the order estimated during the run;")
E("the order read from the analogous pair, or its use in the split, loses most of what the transformation could deliver.",
"closing that gap is open.")
# ---- point 6: the algorithms
E(" xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)",
" lo, hi <- min(A,B), max(A,B)\n xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)")
E(" if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)",
" if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)\n (if the midpoint too was evaluated: return it)")
E(""" # order (6) of the analogous pair: the past configuration
# nearest to c (Euclidean in (xi, phi)), if nearer than the
# line phi = xi; inf if the pair shows L_f < 1 <= L_x; else none
m <- order of the analogous pair""",
""" # order (6) of the analogous pair. q <- the configuration in
# configs nearest to c (Euclidean in (xi, phi)); no m if c or
# configs is empty or q is not nearer than the line phi = xi.
# L_x <- |x-xp| / q.dx, L_f <- |fx-fp| / q.df
# m <- inf if L_f < 1 <= L_x (translation), else ln L_f / ln L_x
m <- order of the analogous pair""")
E(""" # step pattern: the lag 2 .. half the history of highest
# mean similarity of successive length ratios has mean > 1/2,
# and step and x - xp point the same way
if the pattern repeats:""",
""" # step pattern: q_j <- |d_j|/|d_(j-1)| over successive nonzero
# moves d (k of them); rho(u,v) <- min(u,v)/max(u,v); repeats iff
# max over p = 2..floor(k/2) of mean_j rho(q_j, q_(j-p)) > 1/2
if repeats and step, x - xp point the same way:""")
E(" xn <- clamp(xn, hi - allow, lo + allow) # projection (3)",
" lo, hi <- min(A,B), max(A,B)\n xn <- clamp(xn, hi - allow, lo + allow) # projection (3)")
E(" xn <- mid; if mid in {x, xp}: stop", " xn <- mid; if mid in {x, xp}: return mid")
E("implement exactly this and agree bit for bit.",
"implement exactly this and agree bit for bit. The nearest-configuration search runs over the run's memory: $O(n)$ per step, $O(n^2)$ per run of $n$ evaluations ($n\\le200$ here), arithmetic that matters only when $f$ is cheap (Appendix B).")
# ---- point 7
E("| 3 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |",
"| 3 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |\n| 4 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, bracket guard | no | 45/45 | 1848 | 0 |")
E("| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |",
"| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |\n| 6 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, earned projection | no | 45/45 | 1952 | 0 |")
E("| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | | |", "| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | — | — |")
E("| base rule (§3) | 2634 | 2357 | 4991 | | |", "| base rule (§3) | 2634 | 2357 | 4991 | — | — |")
E("We replace bisection's midpoint rule by a similarity rule — the step grows with how dissimilar $f(x)$ is to the target 0, under a similarity $S$ with $S(0)=1$ — and derive",
"We replace bisection's midpoint rule by a similarity rule — the step grows with the dissimilarity of $f(x)$ to 0 under a similarity $S$ — and derive")
E("With the multiplicity known, the classical transformation $\\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots.",
"With the multiplicity known, the classical transformation $\\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots; what A′ adds is an estimate of the order made without knowing it, within a guarantee of twice bisection.")
def main():
src = open(PATH, encoding="utf8").read()
bad = [o[:80] for o, _ in R if src.count(o) != 1]
if bad:
for b in bad:
print("ANCHOR NOT FOUND EXACTLY ONCE:", repr(b))
raise SystemExit(f"{len(bad)} anchors failed; nothing written")
for o, n in R:
src = src.replace(o, n)
open(PATH, "w", encoding="utf8").write(src)
ab = src.split("## Abstract\n\n")[1].split("\n\n---\n")[0]
code = src.split("**Algorithm 2 (A′).**")[1].split("```")[1]
print(f"applied {len(R)}; abstract {len(ab.split())} words; longest Algorithm 2 line "
f"{max(len(l) for l in code.split(chr(10)))}; 'pre-regist' left: {src.lower().count('pre-regist')}")
if __name__ == "__main__":
main()
+28
View File
@@ -0,0 +1,28 @@
"""Revision 2 follow-up: the step-pattern comment of Algorithm 2 within 72 characters a line, and the
abstract back under 250 words (same claims).
python -u apply_revision2_fit.py
"""
PATH = "article/sim_numerics.md"
R = [
(""" # step pattern: q_j <- |d_j|/|d_(j-1)| over successive nonzero
# moves d (k of them); rho(u,v) <- min(u,v)/max(u,v); repeats iff
# max over p = 2..floor(k/2) of mean_j rho(q_j, q_(j-p)) > 1/2""",
""" # step pattern: q_j <- |d_j|/|d_(j-1)| over the
# successive nonzero moves d (k ratios);
# rho(u,v) <- min(u,v)/max(u,v); repeats iff
# max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2"""),
("The derivation fixes a base rule before any benchmark is consulted:", "It fixes, before any benchmark, a base rule:"),
("This decision layer, about ten discrete rules selected on two development sets, gives the method A′.",
"This decision layer — about ten discrete rules selected on two development sets — gives A′."),
("what A′ adds is an estimate of the order made without knowing it, within a guarantee of twice bisection.",
"A′ adds an estimate of the order, within a guarantee of twice bisection."),
]
src = open(PATH, encoding="utf8").read()
for o, n in R:
assert src.count(o) == 1, o[:60]
src = src.replace(o, n)
open(PATH, "w", encoding="utf8").write(src)
ab = src.split("## Abstract\n\n")[1].split("\n\n---\n")[0]
code = src.split("**Algorithm 2 (A′).**")[1].split("```")[1]
print(f"abstract {len(ab.split())} words; longest Algorithm 2 line {max(len(l) for l in code.split(chr(10)))}")
+106
View File
@@ -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")
+53 -31
View File
@@ -4,7 +4,7 @@ V. Sitnikov
## Abstract ## Abstract
We replace bisection's midpoint rule by a similarity rule — the step grows with how dissimilar $f(x)$ is to the target 0, under a similarity $S$ with $S(0)=1$ — and derive its contraction factor in closed form. The derivation fixes a base rule before any benchmark is consulted: with the tent similarity and a three-point divided-difference scale it is a Newton step of Muller's order 1.839, clipped to the bracket and projected onto a budget of twice bisection whose multiplier is its one numerical constant. On the 154 problems of Alefeld, Potra and Shi it is level with TOMS 748 and 1.5% behind Chandrupatla's method; on wide brackets it is clearly behind. The gap is a decision, when to give the model up, and we take it by analogy: at a flat root the dimensionless configuration of the last three points recurs under zoom, at a simple root it tends to a line, and the analogous pair gives the order that says whether and where to split. This decision layer, about ten discrete rules selected on two development sets, gives the method A′. On 240 problems fixed before its code was frozen it needs 3656 evaluations against 5717 for Chandrupatla, 5535 for ModAB and 4488 with Lagouanelle's multiplicity estimate in place of the analogy; the lead lies in multiple and fractional roots, present in two of the six families. With the multiplicity known, the classical transformation $\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots. We replace bisection's midpoint rule by a similarity rule — the step grows with the dissimilarity of $f(x)$ to 0 under a similarity $S$ — and derive its contraction factor in closed form. It fixes, before any benchmark, a base rule: with the tent similarity and a three-point divided-difference scale it is a Newton step of Muller's order 1.839, clipped to the bracket and projected onto a budget of twice bisection whose multiplier is its one numerical constant. On the 154 problems of Alefeld, Potra and Shi it is level with TOMS 748 and 1.5% behind Chandrupatla's method; on wide brackets it is clearly behind. The gap is a decision, when to give the model up, and we take it by analogy: at a flat root the dimensionless configuration of the last three points recurs under zoom, at a simple root it tends to a line, and the analogous pair gives the order that says whether and where to split. This decision layer — about ten discrete rules selected on two development sets — gives A′. On 240 problems fixed before its code was frozen it needs 3656 evaluations against 5717 for Chandrupatla, 5535 for ModAB and 4488 with Lagouanelle's multiplicity estimate in place of the analogy; the lead lies in multiple and fractional roots, present in two of six families. With the multiplicity known, the transformation $\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots; A′ adds an estimate of the order, within a guarantee of twice bisection.
--- ---
@@ -21,7 +21,7 @@ The paper makes four claims, each measured.
3. The base rule's gap on wide brackets is a decision — when to give the model up — and a similarity of the run to its own past takes it (§6). The resulting method, A′, is tested once on a corpus fixed before its code was frozen, against simpler detectors put in its place, and against the classical transformation with the multiplicity known in advance (§7). 3. The base rule's gap on wide brackets is a decision — when to give the model up — and a similarity of the run to its own past takes it (§6). The resulting method, A′, is tested once on a corpus fixed before its code was frozen, against simpler detectors put in its place, and against the classical transformation with the multiplicity known in advance (§7).
4. Every table uses one criterion, a sign change within $10^{-6}$ of the answer, because the benchmarks' published roots score six problems unsolved for every method (§4, §A.5). 4. Every table uses one criterion, a sign change within $10^{-6}$ of the answer, because the benchmarks' published roots score six problems unsolved for every method (§4, §A.5).
The search that produced these results — readings of the similarity that did not pay, the decomposition of the wide-bracket gap, wall-clock time, and the rejected rules — is reported in Appendices A–C. The code, the corpora and the pre-registrations are released (Appendix D and the availability statement). The search that produced these results — readings of the similarity that did not pay, the decomposition of the wide-bracket gap, wall-clock time, and the rejected rules — is reported in Appendices A–C. The code, the corpora and the documents that recorded each test before its run are released (Appendix D and the availability statement).
--- ---
@@ -116,8 +116,10 @@ while |B - A| > xtol:
if sigma is 0 or not finite: xn <- midpoint(A,B) if sigma is 0 or not finite: xn <- midpoint(A,B)
else: else:
xn <- x + min(1, |f(x)|/sigma) * (far - x) # the step, eq (4) xn <- x + min(1, |f(x)|/sigma) * (far - x) # the step, eq (4)
lo, hi <- min(A,B), max(A,B)
xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3) xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)
if xn outside (A,B) or already evaluated: xn <- midpoint(A,B) if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)
(if the midpoint too was evaluated: return it)
evaluate fn = f(xn); allow <- allow / 2 evaluate fn = f(xn); allow <- allow / 2
xp2, xp, x <- xp, x, xn xp2, xp, x <- xp, x, xn
update the bracket: whichever of A,B keeps the sign change update the bracket: whichever of A,B keeps the sign change
@@ -211,7 +213,7 @@ The grid is nine similarity functions × four scales × seven safeguards = 252 c
| 237 | Illinois [7] | yes | 153/154 | 7045 | 0 | | 237 | Illinois [7] | yes | 153/154 | 7045 | 0 |
| 244 | false position | no | 127/154 | 10560 | — | | 244 | false position | no | 127/154 | 10560 | — |
The base rule and the same rule without any safeguard tie at 2634: the projection never binds on this set. By total, Chandrupatla's method is first with 2595, 1.5% fewer; the base rule and TOMS 748 are level (2634 against 2636). Problem by problem the base rule wins against Chandrupatla 87/24/43 (wins/ties/losses; exact two-sided sign test $p=1.4\cdot10^{-4}$), against TOMS 748 86/16/52, Brent 102/11/41, ITP at its recommended constants 132/3/19, the per-problem ITP oracle 121/4/29, and bisection 152/1/1. It trails Chandrupatla in total because its losses are the larger ones; by function family, the unit in which these problems are independent (§7), the comparison is 6/1/8 of 15 families, a tie. The constant-free variant goes 79/3/72 against Chandrupatla ($p=0.63$), 78/9/67 against TOMS 748 and 79/5/70 against Brent. The base rule and the same rule without any safeguard tie at 2634: the projection never binds on this set. By total, Chandrupatla's method is first with 2595, 1.5% fewer; the base rule and TOMS 748 are level (2634 against 2636). Problem by problem the base rule wins against Chandrupatla 87/24/43 (wins/ties/losses; exact two-sided sign test $p=1.4\cdot10^{-4}$), against TOMS 748 86/16/52, Brent 102/11/41, ITP at its recommended constants 132/3/19, the per-problem ITP oracle 121/4/29, and bisection 152/1/1. It trails Chandrupatla in total because its losses are the larger ones; by function family, the unit in which these problems are independent (§7), the comparison is 6/1/8 of 15 families, a tie. The constant-free variant goes 79/3/72 against Chandrupatla ($p=0.63$), 78/9/67 against TOMS 748 and 79/5/70 against Brent. Dekker, Illinois and false position fail `aps.13.00` under either criterion and so keep their totals: they spend the whole budget without converging, Dekker and Illinois stalled on one side of the zero where $|f|<10^{-62}$ but $f$ does not change sign within $10^{-6}$.
**Table 3.** Chandrupatla, 45 problems, brackets up to $10^{12}$ wide, out of 264 configurations. **Table 3.** Chandrupatla, 45 problems, brackets up to $10^{12}$ wide, out of 264 configurations.
@@ -220,7 +222,9 @@ The base rule and the same rule without any safeguard tie at 2634: the projectio
| 1 | Chandrupatla | no | 45/45 | 1505 | 0 | | 1 | Chandrupatla | no | 45/45 | 1505 | 0 |
| 2 | ITP, per-problem oracle | yes | 45/45 | 1675 | 0 | | 2 | ITP, per-problem oracle | yes | 45/45 | 1675 | 0 |
| 3 | similarity, $e^{-\lvert z\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 | | 3 | similarity, $e^{-\lvert z\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |
| 4 | similarity, $e^{-\lvert z\rvert}$, bracket scale, bracket guard | no | 45/45 | 1848 | 0 |
| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 | | 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |
| 6 | similarity, $e^{-\lvert z\rvert}$, bracket scale, earned projection | no | 45/45 | 1952 | 0 |
| 9 | constant-free variant: earned projection | no | 45/45 | 2073 | 0 | | 9 | constant-free variant: earned projection | no | 45/45 | 2073 | 0 |
| 15 | bisection | no | 45/45 | 2136 | 0 | | 15 | bisection | no | 45/45 | 2136 | 0 |
| **49** | **base rule: tent, 3-point, projection ($c=2$)** | **no** | 45/45 | **2357** | 0 | | **49** | **base rule: tent, 3-point, projection ($c=2$)** | **no** | 45/45 | **2357** | 0 |
@@ -253,7 +257,7 @@ Ranked individually and best over scales, the similarities come out $1-|z|$ (542
## 6. The flat regime, recognised by analogy ## 6. The flat regime, recognised by analogy
The base rule's gap on wide brackets is a decision, *when to give the model up* (§A.6): on the pure powers `fun3`–`fun6` the right move is to halve, Chandrupatla's method halves on up to all of its steps, and no reading of a single state measured takes that decision correctly. This section takes it by a similarity of the run to *its own past* — an analogy in Pólya's sense [8], two situations agreeing in more than one relation. Every rule below was pre-registered with a stop rule (Appendix D); the rejected ones are in Appendix C. The base rule's gap on wide brackets is a decision, *when to give the model up* (§A.6): on the pure powers `fun3`–`fun6` the right move is to halve, Chandrupatla's method halves on up to all of its steps, and no reading of a single state measured takes that decision correctly. This section takes it by a similarity of the run to *its own past* — an analogy in Pólya's sense [8], two situations agreeing in more than one relation. Every rule below was recorded, with its criteria and stop rule, before its code and run (Appendix D); the rejected ones are in Appendix C.
### 6.1 The flag: a promise that was not kept ### 6.1 The flag: a promise that was not kept
@@ -305,7 +309,7 @@ which is exact for a pure power and becomes the midpoint as $m\to\infty$. It is
The method this paper proposes, **A′**, is the base rule of §3 — tent similarity, three-point scale, projection with the declared multiplier $c=2$ — with the regime of §6.2–6.3 (the analogy remembered, its translation limit, the split (7), the exit) and the five readings of §6.4. Its constants are bisection's $\tfrac12$ and what follows from it: $\tfrac14=(1-\tfrac12)^2$ and the two branches $m\ge2$, $m\le\tfrac23$ of $|1-1/m|>\tfrac12$. Three choices are declared rather than derived: the multiplier $c$ of the projection (§3.1), the Euclidean geometry of the $(\xi,\varphi)$ plane, and the pattern test of the step lengthening (lags from 2 to half the history, threshold $\tfrac12$). The projection carries the guarantee, $2\lceil\log_2(w_0/\varepsilon_x)\rceil+3$ evaluations; it is verified with no violation on every corpus of this paper and under every safeguard of the grid. The method this paper proposes, **A′**, is the base rule of §3 — tent similarity, three-point scale, projection with the declared multiplier $c=2$ — with the regime of §6.2–6.3 (the analogy remembered, its translation limit, the split (7), the exit) and the five readings of §6.4. Its constants are bisection's $\tfrac12$ and what follows from it: $\tfrac14=(1-\tfrac12)^2$ and the two branches $m\ge2$, $m\le\tfrac23$ of $|1-1/m|>\tfrac12$. Three choices are declared rather than derived: the multiplier $c$ of the projection (§3.1), the Euclidean geometry of the $(\xi,\varphi)$ plane, and the pattern test of the step lengthening (lags from 2 to half the history, threshold $\tfrac12$). The projection carries the guarantee, $2\lceil\log_2(w_0/\varepsilon_x)\rceil+3$ evaluations; it is verified with no violation on every corpus of this paper and under every safeguard of the grid.
Counting numerical constants does not measure the method's freedom, however. Beyond these numbers A′ is a decision layer of about ten discrete rules — the flag, the analogy and its memory, the entry, the exit, the overshoot branch, the split, the step pattern, the half, the contradiction, the tolerance step — chosen on the two development sets among the many candidates of Appendix C. That selection is why the method was tested once on a corpus fixed before its code was frozen, and against simpler rules put in its place (§7). Algorithm 2 is the complete method; `simroot/pure.py` and the compiled `simbracket` implement exactly this and agree bit for bit. Counting numerical constants does not measure the method's freedom, however. Beyond these numbers A′ is a decision layer of about ten discrete rules — the flag, the analogy and its memory, the entry, the exit, the overshoot branch, the split, the step pattern, the half, the contradiction, the tolerance step — chosen on the two development sets among the many candidates of Appendix C. That selection is why the method was tested once on a corpus fixed before its code was frozen, and against simpler rules put in its place (§7). Algorithm 2 is the complete method; `simroot/pure.py` and the compiled `simbracket` implement exactly this and agree bit for bit. The nearest-configuration search runs over the run's memory: $O(n)$ per step, $O(n^2)$ per run of $n$ evaluations ($n\le200$ here), arithmetic that matters only when $f$ is cheap (Appendix B).
**Algorithm 2 (A′).** Notation of Algorithm 1; $S(z)=\max(0,1-|z|)$. **Algorithm 2 (A′).** Notation of Algorithm 1; $S(z)=\max(0,1-|z|)$.
@@ -327,9 +331,11 @@ while |B - A| > xtol:
# unkept promise, and unkept promise with a crossing # unkept promise, and unkept promise with a crossing
flag <- not in_regime and last_model and fx/fp >= 1/4 flag <- not in_regime and last_model and fx/fp >= 1/4
flag_over <- not in_regime and last_model and fx/fp <= -1/4 flag_over <- not in_regime and last_model and fx/fp <= -1/4
# order (6) of the analogous pair: the past configuration # order (6) of the analogous pair. q <- the configuration in
# nearest to c (Euclidean in (xi, phi)), if nearer than the # configs nearest to c (Euclidean in (xi, phi)); no m if c or
# line phi = xi; inf if the pair shows L_f < 1 <= L_x; else none # configs is empty or q is not nearer than the line phi = xi.
# L_x <- |x-xp| / q.dx, L_f <- |fx-fp| / q.df
# m <- inf if L_f < 1 <= L_x (translation), else ln L_f / ln L_x
m <- order of the analogous pair m <- order of the analogous pair
if m >= 2: analogy_seen <- true; m_a <- m if m >= 2: analogy_seen <- true; m_a <- m
if 0 < m <= 2/3: shallow_seen <- true; m_s <- m if 0 < m <= 2/3: shallow_seen <- true; m_s <- m
@@ -343,18 +349,20 @@ while |B - A| > xtol:
else: else:
step <- (1 - S(z)) * (far - x) # eq. (4) step <- (1 - S(z)) * (far - x) # eq. (4)
append x - xp to moves append x - xp to moves
# step pattern: the lag 2 .. half the history of highest # step pattern: q_j <- |d_j|/|d_(j-1)| over the
# mean similarity of successive length ratios has mean > 1/2, # successive nonzero moves d (k ratios);
# and step and x - xp point the same way # rho(u,v) <- min(u,v)/max(u,v); repeats iff
if the pattern repeats: # max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2
if repeats and step, x - xp point the same way:
s <- min(|step|,|x-xp|) / max(|step|,|x-xp|) s <- min(|step|,|x-xp|) / max(|step|,|x-xp|)
step <- step / (1 - s), at most |far - x| long step <- step / (1 - s), at most |far - x| long
if |step| < xtol/2 and last_model and |fx/fp| < 1/4: if |step| < xtol/2 and last_model and |fx/fp| < 1/4:
step <- sign(far - x) * xtol/2 # tolerance step step <- sign(far - x) * xtol/2 # tolerance step
xn <- x + step; model <- true xn <- x + step; model <- true
lo, hi <- min(A,B), max(A,B)
xn <- clamp(xn, hi - allow, lo + allow) # projection (3) xn <- clamp(xn, hi - allow, lo + allow) # projection (3)
if xn outside (A,B) or xn in {x, xp}: if xn outside (A,B) or xn in {x, xp}:
xn <- mid; if mid in {x, xp}: stop xn <- mid; if mid in {x, xp}: return mid
last_model <- model and xn is the model's own point last_model <- model and xn is the model's own point
fn <- f(xn) fn <- f(xn)
if in_regime: # exit if in_regime: # exit
@@ -371,8 +379,8 @@ return midpoint(A,B)
| | APS-154 | CHA-45 | both | A′ per problem, APS | A′ per problem, CHA | | | APS-154 | CHA-45 | both | A′ per problem, APS | A′ per problem, CHA |
|---|---|---|---|---|---| |---|---|---|---|---|---|
| **A′ (proposed)** | **2259** | **1074** | **3333** | — | — | | **A′ (proposed)** | **2259** | **1074** | **3333** | — | — |
| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | | | | A′, earned budget (no free constant) | 3417 | 1852 | 5269 | — | — |
| base rule (§3) | 2634 | 2357 | 4991 | | | | base rule (§3) | 2634 | 2357 | 4991 | — | — |
| Chandrupatla | 2595 | 1505 | 4100 | 103/20/31, $p=3\cdot10^{-10}$ | 31/4/10, $p=0.001$ | | Chandrupatla | 2595 | 1505 | 4100 | 103/20/31, $p=3\cdot10^{-10}$ | 31/4/10, $p=0.001$ |
| TOMS 748 | 2636 | 3088 | 5724 | 127/6/21 | 42/2/1 | | TOMS 748 | 2636 | 3088 | 5724 | 127/6/21 | 42/2/1 |
| Brent | 2707 | 3238 | 5945 | 118/17/19 | 39/3/3 | | Brent | 2707 | 3238 | 5945 | 118/17/19 | 39/3/3 |
@@ -394,7 +402,7 @@ A′ is 12.9% below Chandrupatla on the canonical set and 28.6% below on the wid
| repeated step pattern | −22 | −6 | +123 | −30 | −10 | +34 | +89 | | repeated step pattern | −22 | −6 | +123 | −30 | −10 | +34 | +89 |
| sign contradiction | +11 | −12 | +29 | 0 | +1 | −1 | +28 | | sign contradiction | +11 | −12 | +29 | 0 | +1 | −1 | +28 |
Every component is positive in sum; the regime and the split carry the method. The step pattern (earns on two corpora of six) and the sign contradiction (+28 over 855 problems) are marginal — together under one per cent, 117 of 13032 evaluations — and are kept because the pre-registered rule removes only a component that earns nowhere. Every component is positive in sum; the regime and the split carry the method. The step pattern (earns on two corpora of six) and the sign contradiction (+28 over 855 problems) are marginal — together under one per cent, 117 of 13032 evaluations — and are kept because the rule recorded in advance removes only a component that earns nowhere.
**Table 7.** The similarity in the step of A′: the same method with each of the nine similarity functions of §5.2 in place of the tent, everything else unchanged. Totals on the two sets of §4 and over the six corpora of §7; the guarantee holds with every function. **Table 7.** The similarity in the step of A′: the same method with each of the nine similarity functions of §5.2 in place of the tent, everything else unchanged. Totals on the two sets of §4 and over the six corpora of §7; the guarantee holds with every function.
@@ -427,13 +435,13 @@ Several mechanisms of A′ coincide with classical ones, reached from similarity
| the tolerance step | Dekker [9], Brent [2] — borrowed and named as such | | the tolerance step | Dekker [9], Brent [2] — borrowed and named as such |
| the exit judgment of §6.2 (the value at a split against the line) | ModAB's linearity check at the midpoint [10, 20], $|y_m-y_3|<k\,(|y_3|+|y_m|)$ with $k$ from a symmetry factor; ours compares two predictions, the line and 0, without a factor | | the exit judgment of §6.2 (the value at a split against the line) | ModAB's linearity check at the midpoint [10, 20], $|y_m-y_3|<k\,(|y_3|+|y_m|)$ with $k$ from a symmetry factor; ours compares two predictions, the line and 0, without a factor |
What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 6: the *decision* layer. A bracketing method that recognises the regime in which its model has lost by the similarity of the run to its own past — the recurrence of a dimensionless configuration against the linear prototype — reads the order from the analogous pair itself, distinguishes similarity by scaling from similarity by translation, and leaves the regime by a similarity judgment at a point the model did not choose; and a step whose length is set by a similarity function whose form, measured, is decisive. The methods for multiple roots we found are single-point iterations without a bracket, with the multiplicity assumed, estimated from derivatives, or removed by a transformation ([17, 23]; Roots.jl's `Order1B` and `Order2B` [12]); inside a bracket, [22] needs the multiplicity given and recognises a multiple root only by the number of evaluations spent, against a third of bisection's; Chandrupatla takes the decision to halve by an empirical acceptance band [3]. §7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance. What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 6: the *decision* layer. A bracketing method that recognises the regime in which its model has lost by the similarity of the run to its own past — the recurrence of a dimensionless configuration against the linear prototype — reads the order from the analogous pair itself, distinguishes similarity by scaling from similarity by translation, and leaves the regime by a similarity judgment at a point the model did not choose; and a step whose length is set by a similarity function whose form, measured, is decisive. The methods for multiple roots we found are single-point iterations without a bracket, with the multiplicity assumed, estimated from derivatives, or removed by a transformation ([17, 23]; Roots.jl's `Order1B` and `Order2B` [12]); inside a bracket, [22] needs the multiplicity given and recognises a multiple root only by the number of evaluations spent, against a third of bisection's; Chandrupatla takes the decision to halve by an empirical acceptance band [3]. §7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance or estimated during the run.
--- ---
## 7. Out-of-sample evidence ## 7. Out-of-sample evidence
Every decision above was taken on the two sets of §4. Pre-registration protects each decision but not the chain: the final configuration — a decision layer of about ten discrete rules, chosen among the many candidates listed in Appendix C — was selected on the same 199 problems. Four further corpora were therefore used, each fixed and committed before any method was run on it, each with its criteria and stop rule written down first. Every decision above was taken on the two sets of §4. Recording each decision in advance protects the decision but not the chain: the final configuration — a decision layer of about ten discrete rules, chosen among the many candidates listed in Appendix C — was selected on the same 199 problems. Four further corpora were therefore used, each fixed and committed before any method was run on it, each with its criteria and stop rule written down first.
1. **New corpus 1** — 206 problems: SciPy's `original` set (6) and five generated classes of 40 (seed 20260921): smooth and transcendental simple roots, multiple roots $|x-r|^p$ with $p\sim U(2,20)$, exponential flanks, near-cancelling terms. 1. **New corpus 1** — 206 problems: SciPy's `original` set (6) and five generated classes of 40 (seed 20260921): smooth and transcendental simple roots, multiple roots $|x-r|^p$ with $p\sim U(2,20)$, exponential flanks, near-cancelling terms.
2. **Roots.jl / ModAB** — the bracketing benchmark of Roots.jl [12] used by ModAB's authors [10]: 91 problems, 13 of which coincide with APS or Chandrupatla functions and are excluded, leaving 78. 2. **Roots.jl / ModAB** — the bracketing benchmark of Roots.jl [12] used by ModAB's authors [10]: 91 problems, 13 of which coincide with APS or Chandrupatla functions and are excluded, leaving 78.
@@ -444,7 +452,7 @@ A root must carry a sign change to be bracketed, so the multiple roots in these
ModAB, the most recent bracketing method we know of, is run from its authors' package (`pymodab` 1.0.9) with the stopping rule and the counting of every other method. The criterion, tolerance, budget and charging are those of §4. ModAB, the most recent bracketing method we know of, is run from its authors' package (`pymodab` 1.0.9) with the stopping rule and the counting of every other method. The criterion, tolerance, budget and charging are those of §4.
The variant carried to corpora 1–3 was A′ without the tolerance step and the overshoot branch. It transferred to corpus 1 by every pre-registered criterion (per problem 105/34/67 against Chandrupatla, $p=0.005$), did *not* transfer to Roots.jl (38/10/30, $p=0.4$) and lost on the applied corpus; the two readings that closed those gaps were developed on the seen corpora and tested once, on corpus 4. The variant carried to corpora 1–3 was A′ without the tolerance step and the overshoot branch. It transferred to corpus 1 by every criterion recorded in advance (per problem 105/34/67 against Chandrupatla, $p=0.005$), did *not* transfer to Roots.jl (38/10/30, $p=0.4$) and lost on the applied corpus; the two readings that closed those gaps were developed on the seen corpora and tested once, on corpus 4.
**Table 8.** A′ against the library rivals on all six corpora (uniform criterion): total evaluations; in brackets the runs that break the $2\times$-bisection bound. **Table 8.** A′ against the library rivals on all six corpora (uniform criterion): total evaluations; in brackets the runs that break the $2\times$-bisection bound.
@@ -488,7 +496,7 @@ Only the last line of corpora is evidence for A′ in the strict sense; the firs
### 7.1 Controls: simpler detectors, and the multiplicity known in advance ### 7.1 Controls: simpler detectors, and the multiplicity known in advance
Two controls ask whether the gain of §6 comes from the recognition by analogy or only from the split (7) with any reasonable detector. Both were pre-registered, with what the paper would say under every outcome, before the run (`sweep_controls.py`). Two controls ask whether the gain of §6 comes from the recognition by analogy or only from the split (7) with any reasonable detector. Both were recorded, with what the paper would say under every outcome, before the run (`sweep_controls.py`).
**Other detectors in A′.** A′ is run with only its detector swapped; the memory, the split, the exit and the five readings of §6.4 are unchanged. (a) *Lagouanelle's estimate* $m_L=1/(1-\theta)$, $\theta=ff''/f'^2$ from the parabola through the last three points ($m_L=\infty$ for $\theta\ge1$), with the same memory — once seen, held until the exit, a hysteresis — entering at $m_L\ge2$ and at $0<m_L\le\tfrac23$ and splitting at $m_L$. (b) *Chandrupatla's acceptance band*, entering when the band rejects the current triple and splitting at the current $m_L$. (c) *No detector*: the regime is entered at every unkept promise. **Other detectors in A′.** A′ is run with only its detector swapped; the memory, the split, the exit and the five readings of §6.4 are unchanged. (a) *Lagouanelle's estimate* $m_L=1/(1-\theta)$, $\theta=ff''/f'^2$ from the parabola through the last three points ($m_L=\infty$ for $\theta\ge1$), with the same memory — once seen, held until the exit, a hysteresis — entering at $m_L\ge2$ and at $0<m_L\le\tfrac23$ and splitting at $m_L$. (b) *Chandrupatla's acceptance band*, entering when the band rejects the current triple and splitting at the current $m_L$. (c) *No detector*: the regime is entered at every unkept promise.
@@ -501,7 +509,7 @@ Two controls ask whether the gain of §6 comes from the recognition by analogy o
| Chandrupatla's band | 2682 | 2526 | 6236 | 20668 | 110/96/34 | $1.5\cdot10^{-10}$ | | Chandrupatla's band | 2682 | 2526 | 6236 | 20668 | 110/96/34 | $1.5\cdot10^{-10}$ |
| none | 2693 | 2526 | 6165 | 20749 | 113/87/40 | $3\cdot10^{-9}$ | | none | 2693 | 2526 | 6165 | 20749 | 113/87/40 | $3\cdot10^{-9}$ |
On corpus 4, the one test, A′ beats all three in total and problem by problem, as the pre-registered criterion required. The competent alternative is Lagouanelle's estimate: it is slightly better on the canonical set (2235 against 2259), and on corpus 4 A′'s lead over it lies in the multiple-root and fractional-power families (1163 against 1739, 924 against 1207); it is behind on $\log(1+q^2)$ of a cubic (503 against 477) and level on the rest. The band and the regime without a detector are worse than no regime at all. The decision layer by analogy therefore earns its place against the detectors a reader would try first. On corpus 4, the one test, A′ beats all three in total and problem by problem, as the criterion recorded in advance required. The competent alternative is Lagouanelle's estimate: it is slightly better on the canonical set (2235 against 2259), and on corpus 4 A′'s lead over it lies in the multiple-root and fractional-power families (1163 against 1739, 924 against 1207); it is behind on $\log(1+q^2)$ of a cubic (503 against 477) and level on the rest. The band and the regime without a detector are worse than no regime at all. The decision layer by analogy therefore earns its place against the detectors a reader would try first.
**The multiplicity known in advance.** The second control asks how good the classical transformation is when its multiplicity is given. Library Chandrupatla and Brent are run on $g=\operatorname{sign}(f)\,|f|^{1/m^*}$, with $m^*$ the order read at the known root — the slope of $\ln|f|$ against $\ln|x-r|$ on both sides at $h=10^{-5}$, rounded to 0.01, and 1 where either side shows no zero (a jump). It is not an achievable method but an upper bound. On the multiple and fractional roots, $m^*\ge2$ or $m^*\le\tfrac23$ — the branches of §6.1 where a tangent step loses to a halving: **The multiplicity known in advance.** The second control asks how good the classical transformation is when its multiplicity is given. Library Chandrupatla and Brent are run on $g=\operatorname{sign}(f)\,|f|^{1/m^*}$, with $m^*$ the order read at the known root — the slope of $\ln|f|$ against $\ln|x-r|$ on both sides at $h=10^{-5}$, rounded to 0.01, and 1 where either side shows no zero (a jump). It is not an achievable method but an upper bound. On the multiple and fractional roots, $m^*\ge2$ or $m^*\le\tfrac23$ — the branches of §6.1 where a tangent step loses to a halving:
@@ -513,7 +521,21 @@ On corpus 4, the one test, A′ beats all three in total and problem by problem,
| new corpus 1 | 40 | 1229 | 358 | 337 | 1792 | | new corpus 1 | 40 | 1229 | 358 | 337 | 1792 |
| corpus 4 | 88 | 2159 | 901 | 844 | 4151 | | corpus 4 | 88 | 2159 | 901 | 844 | 4151 |
With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. A′ is far ahead of Chandrupatla on $f$ itself, which does not know the multiplicity either. On the remaining problems the transformed and untransformed runs differ little and A′ is close to them: ahead on the canonical sets (2259 against 2640, 420 against 437 for Chandrupatla on $g$), behind on corpora 1 and 4 (2061 against 1924, 1497 against 1427). So on multiple roots the contribution of A′ is the estimate of the order without knowing it, and the gap to Table 11 is the price of that estimate — large, and the clearest direction for improving the method. With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. Every method, A′ included, stops on an exact zero of the function it evaluates, and on the pure powers of the Chandrupatla set $g$ is exactly linear, so the secant lands on the root: 15 of Brent's 20 runs and 4 of Chandrupatla's end that way there (A′: 2). On new corpus 1 no transformed run ends on a zero, and the transformation is still 3.4 times cheaper. A′ is far ahead of Chandrupatla on $f$ itself, which does not know the multiplicity either. On the remaining problems the transformed and untransformed runs differ little and A′ is close to them: ahead on the canonical sets (2259 against 2640, 420 against 437 for Chandrupatla on $g$), behind on corpora 1 and 4 (2061 against 1924, 1497 against 1427). So on multiple roots the contribution of A′ is the estimate of the order without knowing it, and the gap to Table 11 is the price of that estimate — large, and the clearest direction for improving the method.
**The multiplicity estimated during the run.** Between A′ and the oracle lies the natural classical method: Chandrupatla's interpolation on $g=\operatorname{sign}(f)|f|^{1/\hat m}$ with $\hat m$ estimated during the run. Our implementation of Chandrupatla's method (identical to the library on all 199 problems, and to itself when $\hat m\equiv1$) keeps the true $f$ at its three points and reads $G(v)=\operatorname{sign}(v)|v|^{1/\hat m}$ only in the acceptance band and the interpolation; $\hat m$ starts at 1 and takes an order read from the last three evaluations whenever that order lies on a branch of §6.1 ($m\ge2$ or $0<m\le\tfrac23$), without reset — the hysteresis of the controls above. The order is read either by Lagouanelle's estimate or by A′'s own analogy (recorded in advance, `sweep_estimated.py`):
**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set.
| method | corpus 4 | six corpora | multiple/fractional (148) | APS |
|---|---|---|---|---|
| **A′** | **3656** | **13032** | 4042 | **2259** |
| Chandrupatla on $g$, $\hat m$ by analogy | 3806 | 15733 | 2809 | 3453 |
| Chandrupatla on $g$, $\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |
| Chandrupatla on $g$, $m^*$ known (Table 11) | — | — | **1355** | — |
| Chandrupatla on $f$ | 5717 | 16481 | 7011 | 2595 |
A′ is ahead of both estimated forms on corpus 4, in total and problem by problem (against the analogy form 126/38/76, $p=5\cdot10^{-4}$), and over the six corpora. The two estimators behave differently in this frame. Lagouanelle's reads the parabola through Chandrupatla's points, which alternate sides of the root; there it reports a fractional order on 115 of the 154 simple roots of the canonical set, holds it, and turns the method into little more than bisection. (A variant restricted to the branch $m\ge2$ was not among the controls recorded.) The analogy's order is the better one here too, and on the multiple and fractional roots it does better inside Chandrupatla's interpolation than inside A′'s split: it closes 59%, 58% and 31% of the gap from A′ to the oracle on the Chandrupatla set, corpus 1 and corpus 4 (322 against 654, 721 against 1229, 1766 against 2159). It pays on simple roots, where it has no exit to take a false reading back (3453 against 2595 on the canonical set). So the decision layer of A′ earns its place against the classical method with an estimated order as well; and the split (7), not the order estimate, is where A′ leaves most to the transformation.
--- ---
@@ -523,11 +545,11 @@ A root finder can be derived from a similarity function alone, and the derivatio
The base rule is level with TOMS 748 and 1.5% behind Chandrupatla's method on the canonical set, and clearly behind Chandrupatla on wide brackets (1505 against 2357); the cause is not the order of the model but the decision to give it up. The base rule is level with TOMS 748 and 1.5% behind Chandrupatla's method on the canonical set, and clearly behind Chandrupatla on wide brackets (1505 against 2357); the cause is not the order of the model but the decision to give it up.
That decision is a similarity too, of the run to its own past: a pure power repeats its configuration under zoom, an exponential under translation, a simple root tends to the line, and the analogous pair reads the order that decides between the model and a split. The method built on it, A′, is ahead of Chandrupatla on both canonical sets, and on a corpus fixed before its code was frozen it needs 36% fewer evaluations and wins 177 problems to 28. Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place; with the multiplicity known in advance the classical transformation is 2.4 to 6.8 times cheaper on multiple roots, which measures what estimating the order costs. The claim the measurements support is a lead over Brent, TOMS 748, ITP and ModAB everywhere, within a bound of twice bisection that Brent, TOMS 748 and ModAB do not promise and exceed, and over Chandrupatla a lead that is large where roots are multiple, fractional or nearly flat and small where they are simple — not superiority by the same margin everywhere. `fun9`, near-cancelling terms and smooth applied equations are where it is behind or level. That decision is a similarity too, of the run to its own past: a pure power repeats its configuration under zoom, an exponential under translation, a simple root tends to the line, and the analogous pair reads the order that decides between the model and a split. The method built on it, A′, is ahead of Chandrupatla on both canonical sets, and on a corpus fixed before its code was frozen it needs 36% fewer evaluations and wins 177 problems to 28. Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and Chandrupatla's method on the transformed function with the order estimated during the run; with the multiplicity known in advance the classical transformation is 2.4 to 6.8 times cheaper on multiple roots, which measures what estimating the order costs. The claim the measurements support is a lead over Brent, TOMS 748, ITP and ModAB everywhere, within a bound of twice bisection that Brent, TOMS 748 and ModAB do not promise and exceed, and over Chandrupatla a lead that is large where roots are multiple, fractional or nearly flat and small where they are simple — not superiority by the same margin everywhere. `fun9`, near-cancelling terms and smooth applied equations are where it is behind or level.
### Future work ### Future work
The first is the price of estimating the order. With the multiplicity given, the transformation of §6.3 is 2.4 to 6.8 times cheaper than A′ on multiple and fractional roots (Table 11): the order read from the analogous pair, or its use in the split, loses most of what the transformation could deliver. The first is the price of estimating the order. With the multiplicity given, the transformation of §6.3 is 2.4 to 6.8 times cheaper than A′ on multiple and fractional roots (Table 11): closing that gap is open.
The second is the steep flank. Where the loss remains — `fun9`, the near-cancelling class, 4 − tan x at its pole — the base step approaches along a flank far steeper than its model, and the half contradiction of §6.4 removes only part of the cost. The third is the one geometric choice of §6.2, the Euclidean metric of the $(\xi,\varphi)$ plane: a metric derived from the configuration's own sensitivity would remove it. The second is the steep flank. Where the loss remains — `fun9`, the near-cancelling class, 4 − tan x at its pole — the base step approaches along a flank far steeper than its model, and the half contradiction of §6.4 removes only part of the cost. The third is the one geometric choice of §6.2, the Euclidean metric of the $(\xi,\varphi)$ plane: a metric derived from the configuration's own sensitivity would remove it.
@@ -535,7 +557,7 @@ The second is the steep flank. Where the loss remains — `fun9`, the near-cance
## Code and data availability ## Code and data availability
Everything behind this paper is released with it: the reference implementation of the base rule and of A′ (`simroot/pure.py`); `simbracket`, a compiled library of A′ (Cython; wheels for Linux and Windows, Python 3.10 or later) whose results equal the reference bit for bit on all 868 problems of the six corpora; the corpora as code (`corpus_*.py`); every sweep script with its results file; the pre-registrations with the commits of Appendix D; and `verify_article.py`, which recomputes or re-reads every number stated in this paper and is part of the test suite. All numbers come from one Linux machine (§4). Repository: ⟨repository URL⟩. Everything behind this paper is released with it: the reference implementation of the base rule and of A′ (`simroot/pure.py`); `simbracket`, a compiled library of A′ (Cython; wheels for Linux and Windows, Python 3.10 or later) whose results equal the reference bit for bit on all 868 problems of the six corpora; the corpora as code (`corpus_*.py`); every sweep script with its results file; the advance records with the commits of Appendix D; and `verify_article.py`, which recomputes or re-reads every number stated in this paper and is part of the test suite. All numbers come from one Linux machine (§4). Repository: ⟨repository URL⟩.
--- ---
@@ -687,19 +709,19 @@ Three caveats, all of them limitations of the measurement rather than of the met
14. **The model's own point cannot tell a flat root from a simple one.** Judging the evaluated point against the line through the bracket ends and against 0 — the exit judgment of §6.2 — also at *entry* gives 2820 and 1532 against 2935 and 1546 for the exit alone: the model aims at the root, so $f$ is small there by construction and looks flat at a simple root as readily as at a power. The same judgment works at a split, which the model did not choose. 14. **The model's own point cannot tell a flat root from a simple one.** Judging the evaluated point against the line through the bracket ends and against 0 — the exit judgment of §6.2 — also at *entry* gives 2820 and 1532 against 2935 and 1546 for the exit alone: the model aims at the root, so $f$ is small there by construction and looks flat at a simple root as readily as at a power. The same judgment works at a split, which the model did not choose.
15. **The decision reading "defect" does not transfer.** Combined with the regime it was the best configuration on the two development sets (§A.4's defect reading with the flat families of §6), and it passed every pre-registered criterion there. On new corpus 1 it did not: per problem 95/33/78 against Chandrupatla ($p=0.22$), losing the class of exponential flanks 9 to 26. It is therefore not part of A′. 15. **The decision reading "defect" does not transfer.** Combined with the regime it was the best configuration on the two development sets (§A.4's defect reading with the flat families of §6), and it passed every criterion recorded for it there. On new corpus 1 it did not: per problem 95/33/78 against Chandrupatla ($p=0.22$), losing the class of exponential flanks 9 to 26. It is therefore not part of A′.
16. **A component rejected alone can pay in combination.** Remembering the analogy for the run was rejected by its own pre-registration, under the harness scoring of the time (canonical set 2814 against 2806 without the regime; under the sign-change criterion the two are level, 2633 against 2634), and with the split of §6.3 it is the better form (with the step pattern, wide brackets 1250 against 1388 for the analogy read in one state). Composition was measured, not assumed, throughout — which is also why §A.2's readings (2) and (3), each an improvement, are not combined. 16. **A component rejected alone can pay in combination.** Remembering the analogy for the run was rejected by its own advance record, under the harness scoring of the time (canonical set 2814 against 2806 without the regime; under the sign-change criterion the two are level, 2633 against 2634), and with the split of §6.3 it is the better form (with the step pattern, wide brackets 1250 against 1388 for the analogy read in one state). Composition was measured, not assumed, throughout — which is also why §A.2's readings (2) and (3), each an improvement, are not combined.
--- ---
## Appendix D. Pre-registrations and the frozen code ## Appendix D. Advance records and the frozen code
Every rule of §6 and every test of §7 was written down, with its criteria and stop rule, before its code and its run. Table D1 gives, for each document, the commit that first added it and the commit that first added the results its run wrote, both read from git by `check_prereg_order.py`: 25 of the 30 were committed before their results; four were committed together with them, so git cannot order them; one was decided on its smoke run and has no results file. The code of A′ was committed (`8027d7f`) after corpus 4 was defined (`657df10`) and before its results (`6d2531e`); `simroot/pure.py` did not change in between. Every rule of §6 and every test of §7 was written down, with its criteria and stop rule, before its code and its run. Table D1 gives, for each document, the commit that first added it and the commit that first added the results its run wrote, both read from git by `check_prereg_order.py`: 25 of the 30 were committed before their results; four were committed together with them, so git cannot order them; one was decided on its smoke run and has no results file. We call these documents advance records, not pre-registrations: they live in the author's repository, and their order relative to the runs is attested only by the author's git history, whose timestamps the author sets; no external registry was used. A deposit with an external timestamp (Zenodo, OSF) before a run would remove that limitation for future tests. The code of A′ was committed (`8027d7f`) after corpus 4 was defined (`657df10`) and before its results (`6d2531e`); `simroot/pure.py` did not change in between.
**Table D1.** Pre-registrations, in the order they were written. **Table D1.** Advance records, in the order they were written.
| pre-registration | commit | results file | commit | order | | advance record | commit | results file | commit | order |
|------------------------------|---------|--------------------------------------|---------|-------------| |------------------------------|---------|--------------------------------------|---------|-------------|
| `logarithmic_2026-09-20` | `f9b062e` | `sweep_log.json` | `84ff1c7` | before | | `logarithmic_2026-09-20` | `f9b062e` | `sweep_log.json` | `84ff1c7` | before |
| `prestep_gate_2026-09-21` | `0617243` | `sweep_gate.json` | `a6116cd` | before | | `prestep_gate_2026-09-21` | `0617243` | `sweep_gate.json` | `a6116cd` | before |
+4
View File
@@ -58,6 +58,8 @@ def ends_on_zero(method, f, g, a, b):
def point4(): def point4():
"""Returns {corpus: {method: [problems, exact-zero stops, evaluations]}} and prints it."""
out = {}
for s in ("CHA", "NEW", "D"): for s in ("CHA", "NEW", "D"):
tally = {"chandrupatla_g": [0, 0, 0], "brent_g": [0, 0, 0], "Aprime": [0, 0, 0]} tally = {"chandrupatla_g": [0, 0, 0], "brent_g": [0, 0, 0], "Aprime": [0, 0, 0]}
for pid, f, a, b, r in k1_problems(s): for pid, f, a, b, r in k1_problems(s):
@@ -78,6 +80,8 @@ def point4():
t[2] += n t[2] += n
print(f"{s}: problems {tally['Aprime'][0]}; runs ending on an exact zero / total evaluations: " + print(f"{s}: problems {tally['Aprime'][0]}; runs ending on an exact zero / total evaluations: " +
"; ".join(f"{k} {v[1]}/{v[2]}" for k, v in tally.items())) "; ".join(f"{k} {v[1]}/{v[2]}" for k, v in tally.items()))
out[s] = tally
return out
if __name__ == "__main__": if __name__ == "__main__":
+91
View File
@@ -222,6 +222,7 @@ def main():
verify_flat_regime_and_oos() verify_flat_regime_and_oos()
verify_revision1() verify_revision1()
verify_controls() verify_controls()
verify_revision2()
print() print()
if FAILS: if FAILS:
@@ -1089,5 +1090,95 @@ def verify_controls():
want) want)
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_)
if __name__ == "__main__": if __name__ == "__main__":
main() main()