Revision step 3: restructured and shortened paper, full listing of A', code availability.
Title: 'Root Finding by Similarity and Analogy: A Bracketing Method with a Data-Selected Decision Layer'. Abstract 246 words. Main text 10.4k words (was 17.4k): search reports moved to Appendices A (old 6-7), B (wall-clock), C (negative results); revision history removed; pronouns for Chandrupatla's method fixed; tables numbered in order. New: Algorithm 2 (complete A'), the decision layer counted honestly in 6.5, Code and data availability, Appendix D (30 pre-registrations against the first commit of their own results, read from git by check_prereg_order.py: 25 before, 4 same commit, 1 decided on the smoke; A' frozen at8027d7fbetween corpus 4's definition657df10and its results6d2531e). Literature: Bus & Dekker 1975, Fernandez-Diaz & Menendez-Perez 2023 (two dimensionless parameters; SFRFm on sign(f)|f|^(1/m) with known multiplicity - the nearest precursor of the split), Cordero-Neta-Torregrosa 2021; Illinois and Ridders cited. verify_article: explicit check that every head-to-head row sums to its set. check_new_numbers.py: no number new to the text except headings, references, hashes. Server: verify 527 OK / 0 BAD, regression x2 1232 passed, PDF 30 pages, 0 errors, 0 undefined, 0 overfull. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
"""Algorithm 2 within 72 characters a line (it overflowed the page), same content; and the one
|
||||
character pdflatex does not know (U+2265 in the availability statement).
|
||||
|
||||
python -u apply_listing_width.py
|
||||
"""
|
||||
import re
|
||||
|
||||
PATH = "article/sim_numerics.md"
|
||||
NEW = """```
|
||||
state: bracket [A,B], FA, FB; points x, xp, xp2; values fx, fp, fp2
|
||||
memory: configs (configurations), moves (displacements)
|
||||
flags: last_model, in_regime,
|
||||
analogy_seen (with order m_a), shallow_seen (with order m_s)
|
||||
initialise as Algorithm 1; allow <- 2^n_max * xtol/2
|
||||
while |B - A| > xtol:
|
||||
far <- end of [A,B] further from x; mid <- (A+B)/2; model <- false
|
||||
f' <- derivative at x of the parabola through (x, xp, xp2)
|
||||
sigma <- |f'| * |far - x|
|
||||
if sigma is 0 or not finite: xn <- mid
|
||||
else:
|
||||
z <- |fx| / sigma
|
||||
# the flat regime (6.1-6.3)
|
||||
c <- (xi, phi, |x-xp|, |fx-fp|), last three points, if defined
|
||||
# unkept promise, and unkept promise with a crossing
|
||||
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
|
||||
# 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
|
||||
if m >= 2: analogy_seen <- true; m_a <- m
|
||||
if 0 < m <= 2/3: shallow_seen <- true; m_s <- m
|
||||
if flag and analogy_seen: in_regime <- true
|
||||
elif flag_over and shallow_seen: in_regime <- true; m_a <- m_s
|
||||
append c to configs
|
||||
if in_regime: xn <- split point (7) with m = m_a
|
||||
elif x != xp and
|
||||
sign((fx-fp)/(x-xp)) != sign((FB-FA)/(B-A)): xn <- mid
|
||||
elif S(z) >= 1/2 and |f(far)| < |fx|: xn <- mid
|
||||
else:
|
||||
step <- (1 - S(z)) * (far - x) # eq. (4)
|
||||
append x - xp to moves
|
||||
# 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:
|
||||
s <- min(|step|,|x-xp|) / max(|step|,|x-xp|)
|
||||
step <- step / (1 - s), at most |far - x| long
|
||||
if |step| < xtol/2 and last_model and |fx/fp| < 1/4:
|
||||
step <- sign(far - x) * xtol/2 # tolerance step
|
||||
xn <- x + step; model <- true
|
||||
xn <- clamp(xn, hi - allow, lo + allow) # projection (3)
|
||||
if xn outside (A,B) or xn in {x, xp}:
|
||||
xn <- mid; if mid in {x, xp}: stop
|
||||
last_model <- model and xn is the model's own point
|
||||
fn <- f(xn)
|
||||
if in_regime: # exit
|
||||
t <- (xn - A)/(B - A)
|
||||
if |fn - (FA(1-t) + FB t)| < |fn|:
|
||||
in_regime <- false; analogy_seen <- false
|
||||
allow <- allow/2; (xp2, xp, x) <- (xp, x, xn)
|
||||
keep the sign change in [A,B]
|
||||
return midpoint(A,B)
|
||||
```"""
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
start = src.index("**Algorithm 2 (A′).**")
|
||||
a = src.index("```", start)
|
||||
b = src.index("```", a + 3) + 3
|
||||
assert src.count("**Algorithm 2 (A′).**") == 1
|
||||
src = src[:a] + NEW + src[b:]
|
||||
assert src.count("Python ≥ 3.10") == 1
|
||||
src = src.replace("Python ≥ 3.10", "Python 3.10 or later")
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
print("longest listing line:", max(len(l) for l in NEW.split("\n")))
|
||||
print("non-latin1 characters left outside math:", sorted({c for c in re.sub(r"\$[^$]*\$", "", src)
|
||||
if ord(c) > 0x2FFF}))
|
||||
Reference in New Issue
Block a user