Article: the similarity in the step is earned, not scaffolding; literature in place.

S-ablation of A' (server): A' with each of the nine similarity functions in the step - tent 4443 on the paper protocol (13032 over 855 problems), the nearest other function e^-|z| 4988 (+12%; +9% over six corpora), quadratic ones 18410-18422 (+315%); ranking as the contraction law predicts; guarantee held with every S. The audit of section 7 rerun on the regenerated sweeps (APS unchanged: triple by shape -493 with the tent, +250 with 1/sqrt(1+z^2); defect -283 vs +215).

Text: abstract and section 3 no longer call the similarity scaffolding - the tent making the step Newton's is a property of the similarity chosen; a paragraph in section 7 on the audit; Table 9a; new 8.6 'What is known, and what is new' - Lagouanelle (the order estimate of 7.1 / 10.5), Rall and Hansen-Patrick (8.1), the log-log slope / COC / ACOC (8.2, formula 6), Schroeder and Traub (the split 7 = false position on sign(f)|f|^(1/m)), Brent's acceptance condition (half), Dekker/Brent (tolerance step); what we found no counterpart for is the decision layer by similarity and analogy and the step set by a similarity whose form is decisive. References 13-19. verify_article: Table 9a, the percentages and the audit numbers added; server 446 OK, 0 BAD; regression x2 1226 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
vvs
2026-09-21 21:22:41 +01:00
co-authored by Claude Opus 5
parent 667f243f54
commit b677283afc
12 changed files with 417 additions and 27 deletions
+50
View File
@@ -0,0 +1,50 @@
"""Section 7 gets the audit that shows the similarity in the step decides whether the readings
pay (audit_similarity_places.py, rerun on the regenerated server sweeps); section 3 and the
abstract refer to it correctly; 314% -> 315% (18422/4443 = 4.146). Exact anchors.
python -u apply_article_audit_step.py
"""
from __future__ import annotations
PATH = "article/sim_numerics.md"
AUDIT_PARAGRAPH = (
"\n\n**Which similarity stands in the step decides whether a reading pays.** The readings above, "
"and the decision *defect* of §7.2, compare quantities directly — an ordinal judgment of which is "
"more similar, in which every decreasing $S$ would decide alike. Their gains nevertheless depend "
"on the $S$ that sets the step (`audit_similarity_places.py`, on the same sweeps): on the canonical "
"set the triple chosen by shape gains 493 evaluations with the tent in the step and loses 250 with "
"$1/\\sqrt{1+z^2}$; *defect* gains 283 with the tent and loses 215 with $1-|z|^{1/3}$. The records "
"of this section are the pairing of the tent step with these judgments, not the judgments alone."
)
REPL = [
("the readings of §7 pay only with the tent in the step (§7, the audit of the gains), and in the "
"proposed method replacing the tent by any other function costs 12% to 314% (Table 9a).",
"the readings of §7 pay most with the tent in the step and some of them lose with other functions "
"(§7), and in the proposed method replacing the tent by any other function costs 12% to 315% "
"(Table 9a)."),
("and the similarity that sets the step, whose form is decisive (replacing it costs 12% to 314%).",
"and the similarity that sets the step, whose form is decisive (replacing it costs 12% to 315%)."),
]
ANCHOR = ("Two selections that are each an improvement interfere, which is a reason to measure "
"composition rather than assume it.")
def main():
with open(PATH, encoding="utf8") as fh:
text = fh.read()
for old, _new in REPL + [(ANCHOR, "")]:
if text.count(old) != 1:
raise SystemExit(f"found {text.count(old)}x: {old[:80]}")
for old, new in REPL:
text = text.replace(old, new)
text = text.replace(ANCHOR, ANCHOR + AUDIT_PARAGRAPH)
with open(PATH, "w", encoding="utf8") as fh:
fh.write(text)
print("audit paragraph written")
if __name__ == "__main__":
main()
+145
View File
@@ -0,0 +1,145 @@
"""Literature and the similarity in the step, written into article/sim_numerics.md:
- the step: the similarity is NOT scaffolding - it sets the step and its form is decisive
(Table 4, the audit of section 7, and the S-ablation of A', Table 9a);
- related work in place: Lagouanelle (7.1, 10.5), Rall and Hansen-Patrick (8.1), the log-log
slope and COC/ACOC (8.2), Schroeder and Traub (8.3), Brent's acceptance condition (8.4);
- a new 8.6 'What is known and what is new', a novelty sentence in the abstract, refs 13-19.
Exact anchors, each found exactly once, or nothing is written.
python -u apply_article_literature.py
"""
from __future__ import annotations
PATH = "article/sim_numerics.md"
REPL = [
# --- the similarity in the step is earned, not scaffolding -------------------------
("projected onto the bisection budget; the similarity function is scaffolding of the derivation "
"and does not appear in the final rule.",
"projected onto the bisection budget. The similarity sets that step, and its form is "
"decisive: with the tent the step is Newton's, with any of the other eight functions the same "
"method costs from 12% to four times more."),
("a Newton step with a three-point divided-difference derivative, clipped to the bracket and then "
"projected as in §3.1. The similarity function does not appear in (4): it is scaffolding of the "
"derivation, not machinery of the algorithm.",
"a Newton step with a three-point divided-difference derivative, clipped to the bracket and then "
"projected as in §3.1. That the tent turns the similarity step into Newton's is a property of the "
"similarity chosen, not a sign that the similarity has dropped out: which $S$ stands in the step "
"decides the step, and it is measured, not assumed — Table 4 ranks the nine functions over the "
"whole grid, the readings of §7 pay only with the tent in the step (§7, the audit of the gains), "
"and in the proposed method replacing the tent by any other function costs 12% to 314% (Table 9a)."),
("We state this ourselves rather than leave it to be discovered, because it locates the "
"contribution precisely. It is not a new family of methods.",
"We state the reduction ourselves rather than leave it to be discovered, because it locates the "
"contribution precisely. The base rule is not a new family of methods."),
# --- 7.1 and 10.5: Lagouanelle -------------------------------------------------------
("The exponent $1/m$ is not a constant — $m=1/(1-ff''/f'^2)$ comes from three evaluations already "
"paid for, as in item 5 of §10,",
"The exponent $1/m$ is not a constant — $m=1/(1-ff''/f'^2)$, Lagouanelle's estimate of the "
"multiplicity [13] with the derivatives replaced by divided differences, comes from three "
"evaluations already paid for, as in item 5 of §10,"),
("measurable as $m = 1/(1-\\theta)$ with $\\theta = f f''/(f')^2$ from three divided differences and "
"no constant.",
"measurable as $m = 1/(1-\\theta)$ with $\\theta = f f''/(f')^2$ from three divided differences and "
"no constant — which is Lagouanelle's multiplicity estimate [13]."),
# --- 8.1: Rall, Hansen-Patrick ------------------------------------------------------
("The constant is bisection's $\\tfrac12$, carried through the formula.",
"The constant is bisection's $\\tfrac12$, carried through the formula. The relation between the "
"order and the contraction, $e(1-1/m)$, is the one behind the classical estimates of multiplicity "
"from successive Newton iterates [14, 15]; here it is not used to estimate $m$ but to set the "
"point at which a model step has lost to a halving."),
# --- 8.2: log-log slope, COC/ACOC ---------------------------------------------------
("Under an exact zoom a pure power of order $m$ reads exactly $m$;",
"Formula (6) is the log–log slope by which any power-law exponent is estimated, and has the shape "
"of the computational order of convergence and its approximation from differences of iterates "
"[18, 19]. What is not classical is *which* two states it compares: not consecutive iterates, but "
"a pair the similarity of their configurations has found. Under an exact zoom a pure power of "
"order $m$ reads exactly $m$;"),
# --- 8.3: Schroeder, Traub ----------------------------------------------------------
("which is exact for a pure power and becomes the midpoint as $m\\to\\infty$.",
"which is exact for a pure power and becomes the midpoint as $m\\to\\infty$. It is false position "
"applied to $\\operatorname{sign}(f)|f|^{1/m}$ — the transformation that turns a root of "
"multiplicity $m$ into a simple one, classical since Schröder [16] and Traub [17]; what is new "
"here is only where $m$ comes from."),
# --- 8.4: Brent's condition ---------------------------------------------------------
("and removing it alone takes the canonical set from 2806 to 2564.",
"and removing it alone takes the canonical set from 2806 to 2564. It is a relative of Brent's "
"acceptance condition [2], which admits an interpolant only between the best point and "
"$(3a+b)/4$: both refuse a model that points towards the worse end of the bracket."),
]
TABLE_9A_AND_8_6 = """
**Table 9a.** The similarity in the step of A′: the same method with each of the nine similarity functions of §5.3 in place of the tent, everything else unchanged. Totals on the protocol of §4 and over the six corpora of §9 (uniform criterion); the guarantee holds with every function.
| $S$ in the step | APS + CHA | six corpora (855) |
|---|---|---|
| **tent $1-|z|$ (A′)** | **4443** | **13032** |
| $e^{-|z|}$ | 4988 | 14142 |
| $1/(1+|z|)$ | 5486 | 14843 |
| $(1+|z|)^{-2}$ | 8360 | 28500 |
| $1-\\sqrt{|z|}$ | 12718 | 45552 |
| $1-|z|^{1/3}$ | 17207 | 63031 |
| $e^{-z^2}$ | 18410 | 67701 |
| $1/\\sqrt{1+z^2}$ | 18412 | 67854 |
| $1/(1+z^2)$ | 18422 | 67394 |
The similarity in the step earns its place in the proposed method as it did in the base rule: the nearest other function costs 12% more on the canonical protocol and 9% more over the six corpora, the functions that approach 1 quadratically cost four to five times more, and the ranking is the one the contraction law of §2.2 predicts, the three functions with a linear approach first and the three with a quadratic approach last.
### 8.6 What is known, and what is new
Several mechanisms of A′ coincide with classical ones, and the coincidence is worth stating, because they were not taken from the literature but reached from the principles of the paper — similarity to a prototype and analogy as similarity of relations — and recognised afterwards:
| in A′ | classical counterpart |
|---|---|
| the three-point order estimate of §7.1 | Lagouanelle's multiplicity estimate $m=f'^2/(f'^2-ff'')$ [13] |
| the contraction $e(1-1/m)$ behind the flag of §8.1 | multiplicity estimates from successive Newton iterates [14, 15] |
| the order (6) of an analogous pair | the log–log slope of a power law; the (approximate) computational order of convergence [18, 19] |
| the split (7) | false position on $\\operatorname{sign}(f)|f|^{1/m}$ [16, 17] |
| the half the step promises | a relative of Brent's acceptance condition [2] |
| the tolerance step | Dekker [9], Brent [2] — borrowed and named as such |
What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 9: 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]; Roots.jl's `Order1B` and `Order2B` [12]); Chandrupatla takes the decision to halve by an empirical acceptance band [3]."""
ABSTRACT_NOVELTY_OLD = "The lead is large on multiple, fractional and nearly flat roots and a matter of per cent on simple ones."
ABSTRACT_NOVELTY_NEW = (
"The lead is large on multiple, fractional and nearly flat roots and a matter of per cent on simple "
"ones. Several of the resulting mechanisms coincide with classical ones — Lagouanelle's multiplicity "
"estimate, false position on $|f|^{1/m}$ — reached here from similarity and analogy and recognised "
"afterwards; what we found no counterpart for is the decision layer, where every choice — when to "
"give the model up, where to split, when to return — is a judgment of similarity or of analogy, and "
"the similarity that sets the step, whose form is decisive (replacing it costs 12% to 314%)."
)
REFS_ANCHOR = "commit cf1d256, 2026."
REFS_ADD = """
13. J. L. Lagouanelle, "Sur une méthode de calcul de l'ordre de multiplicité des zéros d'un polynôme," *C. R. Acad. Sci. Paris Sér. A*, vol. 262, pp. 626–627, 1966.
14. L. B. Rall, "Convergence of the Newton process to multiple solutions," *Numer. Math.*, vol. 9, pp. 23–37, 1966.
15. E. Hansen and M. Patrick, "Estimating the multiplicity of a root," *Numer. Math.*, vol. 27, pp. 121–131, 1976.
16. E. Schröder, "Ueber unendlich viele Algorithmen zur Auflösung der Gleichungen," *Math. Ann.*, vol. 2, pp. 317–365, 1870.
17. J. F. Traub, *Iterative Methods for the Solution of Equations*. Englewood Cliffs, NJ: Prentice-Hall, 1964.
18. S. Weerakoon and T. G. I. Fernando, "A variant of Newton's method with accelerated third-order convergence," *Appl. Math. Lett.*, vol. 13, pp. 87–93, 2000.
19. A. Cordero and J. R. Torregrosa, "Variants of Newton's method using fifth-order quadrature formulas," *Appl. Math. Comput.*, vol. 190, pp. 686–698, 2007."""
T9_ANCHOR = ("they are kept because the pre-registered rule removes only a component that earns "
"nowhere.")
def main():
with open(PATH, encoding="utf8") as fh:
text = fh.read()
for old, _new in REPL + [(ABSTRACT_NOVELTY_OLD, ""), (REFS_ANCHOR, ""), (T9_ANCHOR, "")]:
if text.count(old) != 1:
raise SystemExit(f"found {text.count(old)}x: {old[:80]}")
for old, new in REPL:
text = text.replace(old, new)
text = text.replace(ABSTRACT_NOVELTY_OLD, ABSTRACT_NOVELTY_NEW)
text = text.replace(T9_ANCHOR, T9_ANCHOR + TABLE_9A_AND_8_6)
text = text.replace(REFS_ANCHOR, REFS_ANCHOR + REFS_ADD)
with open(PATH, "w", encoding="utf8") as fh:
fh.write(text)
print("literature and the step written")
if __name__ == "__main__":
main()
+50 -10
View File
@@ -8,9 +8,9 @@ V. Sitnikov
Bisection places the next iterate at the midpoint because it uses no information about the function's value. We replace that rule with a *similarity* rule: the step is proportional to how *dissimilar* the current outcome $f(x)$ is to the expectation $0$, measured by a similarity function $S:\mathbb{R}\to[0,1]$ with $S(0)=1$. We derive the contraction factor of the resulting iteration in closed form; it predicts a linear rate to four digits when $1-S$ has a non-zero slope at the origin, and a sublinear $e_n\sim C/n$ with a predicted $C$ when it does not, both confirmed. Three consequences follow. First, with the *ratio* similarity scaled by the far end — and with that combination only, of the five tested — the rule reproduces the false-position formula identically; so does the truncated linear similarity scaled by a divided difference over the *bracket ends*, which shows that the boundary of novelty runs through which points the difference is taken over. Second, any similarity fixed in advance with the scale also fixed yields at best linear convergence at a rate that is a property of the problem rather than of the method; on the eight standard problems of §2.2, five to eight of them fail. Third, the rate vanishes exactly when the scale equals the local scale of the value axis; reading that scale off the data — a divided difference, not a fitted coefficient — turns the step into $|f|/|f'|$ and the convergence superlinear.
The derivation fixes a *base rule* before any benchmark is consulted: a similarity whose approach to 1 is linear, the finest available data-derived scale, and a safeguard that projects the step onto the admissible interval rather than replacing it. It is, explicitly, a Newton step with a three-point divided-difference derivative, clipped to the bracket and projected onto the bisection budget; the similarity function is scaffolding of the derivation and does not appear in the final rule. It carries a proven worst case of twice bisection plus one step and exactly one free constant, which we declare rather than argue away: the multiplier of that budget. On the 154 problems of Alefeld, Potra and Shi it needs 2806 evaluations of $f$ against 2820 for TOMS 748, 2889 for Brent and 2787 for Chandrupatla's method — level in total — and beats Chandrupatla problem by problem 87 to 42 (exact sign test $p=9\cdot10^{-5}$). On the 45 wide-bracket problems of Chandrupatla it beats Brent and TOMS 748 and loses to ITP and to Chandrupatla (3220 against 2896 and 2441). For every data-derived scale, the ranking of the nine similarity functions matches the derived law without exception.
The derivation fixes a *base rule* before any benchmark is consulted: a similarity whose approach to 1 is linear, the finest available data-derived scale, and a safeguard that projects the step onto the admissible interval rather than replacing it. It is, explicitly, a Newton step with a three-point divided-difference derivative, clipped to the bracket and projected onto the bisection budget. The similarity sets that step, and its form is decisive: with the tent the step is Newton's, with any of the other eight functions the same method costs from 12% to four times more. It carries a proven worst case of twice bisection plus one step and exactly one free constant, which we declare rather than argue away: the multiplier of that budget. On the 154 problems of Alefeld, Potra and Shi it needs 2806 evaluations of $f$ against 2820 for TOMS 748, 2889 for Brent and 2787 for Chandrupatla's method — level in total — and beats Chandrupatla problem by problem 87 to 42 (exact sign test $p=9\cdot10^{-5}$). On the 45 wide-bracket problems of Chandrupatla it beats Brent and TOMS 748 and loses to ITP and to Chandrupatla (3220 against 2896 and 2441). For every data-derived scale, the ranking of the nine similarity functions matches the derived law without exception.
The wide-bracket gap turns out to be not the order of the model but a decision — when to give the model up — and the decision is a similarity after all, of an unfamiliar kind: the similarity of a run to its own past. A pure power is self-similar under zoom, so the dimensionless configuration of the last three points recurs, while at a simple root it tends to the linear prototype; the analogous pair yields the local order, $m=\ln L_f/\ln L_x$, and an exponential, self-similar by translation, is its limit $m=\infty$. Entering a halving regime when that analogy holds with $m\ge2$ — the condition under which a tangent step loses to a halving — splitting at the point the order predicts, and leaving when the split looks linear, together with four smaller readings of the same kind and one borrowed element, gives the method proposed here, A′. On the two sets it needs 2438 and 2005 evaluations against Chandrupatla's 2787 and 2441 and beats him problem by problem on both, 103 to 30 and 29 to 7. The chain of decisions that produced it was selected on those sets; tested once, after its code was frozen, on 240 problems from six new families, it needs 3656 evaluations against Chandrupatla's 5717 and wins 177 problems to 28. Over 855 problems in six corpora it is ahead of Brent and TOMS 748 everywhere and keeps its bound where they break theirs on 118 and 84 problems; against Chandrupatla it is ahead in total on five corpora and level on the sixth. The lead is large on multiple, fractional and nearly flat roots and a matter of per cent on simple ones.
The wide-bracket gap turns out to be not the order of the model but a decision — when to give the model up — and the decision is a similarity after all, of an unfamiliar kind: the similarity of a run to its own past. A pure power is self-similar under zoom, so the dimensionless configuration of the last three points recurs, while at a simple root it tends to the linear prototype; the analogous pair yields the local order, $m=\ln L_f/\ln L_x$, and an exponential, self-similar by translation, is its limit $m=\infty$. Entering a halving regime when that analogy holds with $m\ge2$ — the condition under which a tangent step loses to a halving — splitting at the point the order predicts, and leaving when the split looks linear, together with four smaller readings of the same kind and one borrowed element, gives the method proposed here, A′. On the two sets it needs 2438 and 2005 evaluations against Chandrupatla's 2787 and 2441 and beats him problem by problem on both, 103 to 30 and 29 to 7. The chain of decisions that produced it was selected on those sets; tested once, after its code was frozen, on 240 problems from six new families, it needs 3656 evaluations against Chandrupatla's 5717 and wins 177 problems to 28. Over 855 problems in six corpora it is ahead of Brent and TOMS 748 everywhere and keeps its bound where they break theirs on 118 and 84 problems; against Chandrupatla it is ahead in total on five corpora and level on the sixth. The lead is large on multiple, fractional and nearly flat roots and a matter of per cent on simple ones. Several of the resulting mechanisms coincide with classical ones — Lagouanelle's multiplicity estimate, false position on $|f|^{1/m}$ — reached here from similarity and analogy and recognised afterwards; what we found no counterpart for is the decision layer, where every choice — when to give the model up, where to split, when to return — is a judgment of similarity or of analogy, and the similarity that sets the step, whose form is decisive (replacing it costs 12% to 315%).
---
@@ -102,9 +102,9 @@ Corollaries 1–3 fix every choice in the method before any benchmark is consult
$$x' \;=\; x + \operatorname{sign}(x_\mathrm{far}-x)\cdot\min\!\Bigl(\frac{|f(x)|}{|\hat f'|},\;|x_\mathrm{far}-x|\Bigr), \tag{4}$$
a Newton step with a three-point divided-difference derivative, clipped to the bracket and then projected as in §3.1. The similarity function does not appear in (4): it is scaffolding of the derivation, not machinery of the algorithm.
a Newton step with a three-point divided-difference derivative, clipped to the bracket and then projected as in §3.1. That the tent turns the similarity step into Newton's is a property of the similarity chosen, not a sign that the similarity has dropped out: which $S$ stands in the step decides the step, and it is measured, not assumed — Table 4 ranks the nine functions over the whole grid, the readings of §7 pay most with the tent in the step and some of them lose with other functions (§7), and in the proposed method replacing the tent by any other function costs 12% to 315% (Table 9a).
We state this ourselves rather than leave it to be discovered, because it locates the contribution precisely. It is not a new family of methods. It is (i) a derivation that fixes every choice — which similarity, which scale, which safeguard — before any benchmark is consulted, and then predicts the ranking of all nine similarity functions correctly; (ii) a safeguard of ITP's projection type with ITP's truncation stage, and hence all three of its constants, removed; (iii) the negative results of §10; (iv) the measurements. We call it the **base rule**; the method this paper proposes builds on it in Section 8.
We state the reduction ourselves rather than leave it to be discovered, because it locates the contribution precisely. The base rule is not a new family of methods. It is (i) a derivation that fixes every choice — which similarity, which scale, which safeguard — before any benchmark is consulted, and then predicts the ranking of all nine similarity functions correctly; (ii) a safeguard of ITP's projection type with ITP's truncation stage, and hence all three of its constants, removed; (iii) the negative results of §10; (iv) the measurements. We call it the **base rule**; the method this paper proposes builds on it in Section 8.
**Algorithm.** Given $[a,b]$ with $f(a)f(b)<0$ and tolerance $\varepsilon_x$:
@@ -327,6 +327,8 @@ Two results here are worth stating plainly. First, the canonical set improves fr
The readings do not compose. Taken together, (2) and (3) give 2884 and 2871 — worse than either alone on the canonical set, and on the wide-bracket set worse than (3) alone. Two selections that are each an improvement interfere, which is a reason to measure composition rather than assume it.
**Which similarity stands in the step decides whether a reading pays.** The readings above, and the decision *defect* of §7.2, compare quantities directly — an ordinal judgment of which is more similar, in which every decreasing $S$ would decide alike. Their gains nevertheless depend on the $S$ that sets the step (`audit_similarity_places.py`, on the same sweeps): on the canonical set the triple chosen by shape gains 493 evaluations with the tent in the step and loses 250 with $1/\sqrt{1+z^2}$; *defect* gains 283 with the tent and loses 215 with $1-|z|^{1/3}$. The records of this section are the pairing of the tent step with these judgments, not the judgments alone.
Under the constant-free earned projection the same readings gain far less. Reading (1) gives 3507 and 2997, (1)+(2) 3755 and 3021, (1)+(3) 3857 and 3002, all three together 4354 and 3037, against 3568 and 3020 for the constant-free variant itself: the earned budget binds early on the canonical problems, and what the readings buy under the projection is mostly room that the earned budget does not grant.
### 7.1 The similarity function belongs to the place, not to the method
@@ -335,7 +337,7 @@ Everything above varies *where* the similarity is read while keeping one functio
$$z \;=\; \frac{|f(x)|}{|f(x_\mathrm{far})|} \;=\; \Bigl(\frac{e}{E}\Bigr)^{m}, \qquad\text{so}\qquad z^{1/m} \;=\; \frac{e}{E}, \tag{5}$$
and under the ratio similarity $S=1/(1+|z|)$ the step fraction is $z/(1+z)$, which is exactly inverse linear interpolation. False position therefore reads a dimensionless ratio *at order one* on an approach of order $m$: its three-century-old stall is a mismatch between the similarity function and the place it is read in. The exponent $1/m$ is not a constant — $m=1/(1-ff''/f'^2)$ comes from three evaluations already paid for, as in item 5 of §10, and is 1 whenever the power model does not apply.
and under the ratio similarity $S=1/(1+|z|)$ the step fraction is $z/(1+z)$, which is exactly inverse linear interpolation. False position therefore reads a dimensionless ratio *at order one* on an approach of order $m$: its three-century-old stall is a mismatch between the similarity function and the place it is read in. The exponent $1/m$ is not a constant — $m=1/(1-ff''/f'^2)$, Lagouanelle's estimate of the multiplicity [13] with the derivatives replaced by divided differences, comes from three evaluations already paid for, as in item 5 of §10, and is 1 whenever the power model does not apply.
Measured over the 252 cells of the grid, the correction behaves exactly as that reading predicts and not at all as a universal improvement. Paired inside each (function, safeguard) cell of the far-end reading it is cheaper in 29 of 60 cells — indistinguishable from a coin. But in the one pairing where that reading *is* exact inverse interpolation, the ratio similarity, it is cheaper under all seven safeguards:
@@ -407,7 +409,7 @@ Every statement in §§7.3–7.4 is reproduced by `diag_rescore_cha.py`, `diag_r
### 8.1 The flag: a promise that was not kept
A tangent step on an approach of local order $m$ lands at $e(1-1/m)$ and leaves the residual $r=|f_\text{new}/f_\text{old}|=(1-1/m)^m$ on the same side of the root. It beats a halving exactly when $|1-1/m|<\tfrac12$, that is for $\tfrac23<m<2$. At the upper end $r=(1-\tfrac12)^2=\tfrac14$. So a model step that did not cross the root and left $r\ge\tfrac14$ is a *promise not kept*: the model is in the regime where a halving would have done better. The constant is bisection's $\tfrac12$, carried through the formula.
A tangent step on an approach of local order $m$ lands at $e(1-1/m)$ and leaves the residual $r=|f_\text{new}/f_\text{old}|=(1-1/m)^m$ on the same side of the root. It beats a halving exactly when $|1-1/m|<\tfrac12$, that is for $\tfrac23<m<2$. At the upper end $r=(1-\tfrac12)^2=\tfrac14$. So a model step that did not cross the root and left $r\ge\tfrac14$ is a *promise not kept*: the model is in the regime where a halving would have done better. The constant is bisection's $\tfrac12$, carried through the formula. The relation between the order and the contraction, $e(1-1/m)$, is the one behind the classical estimates of multiplicity from successive Newton iterates [14, 15]; here it is not used to estimate $m$ but to set the point at which a model step has lost to a halving.
The flag sees the regime — on the flat families it rises on most model steps — but acted upon step by step it does not pay. Replacing the one flagged step by a halving costs the canonical set 2806 → 3029, because a simple root far from convergence also breaks its promises (the flag rises at least once on 142 of the 154 canonical problems). Every refinement of *when* to halve that reads the moment alone — twice in a row, the promise together with a creep in one direction, a halving that sticks once begun, a judgment of the evaluated point against the line through the bracket — trades one set for the other (§10, items 12–14).
@@ -423,7 +425,7 @@ Nearness of configurations is one relation. An analogy in the full sense needs a
$$m=\frac{\ln L_f}{\ln L_x}.\tag{6}$$
Under an exact zoom a pure power of order $m$ reads exactly $m$; along a real run the analogous pairs are only nearly homothetic and the reading scatters about the order, but the regime asks only whether it reaches 2, the order from which a tangent step loses to a halving (§8.1) — no new constant. On the traces of the base rule, at the moments the flag rises, the three conditions together hold on 3 of the 154 canonical problems, on all 20 flat problems, and on none of `fun2`, `fun8`, `fun9`.
Formula (6) is the log–log slope by which any power-law exponent is estimated, and has the shape of the computational order of convergence and its approximation from differences of iterates [18, 19]. What is not classical is *which* two states it compares: not consecutive iterates, but a pair the similarity of their configurations has found. Under an exact zoom a pure power of order $m$ reads exactly $m$; along a real run the analogous pairs are only nearly homothetic and the reading scatters about the order, but the regime asks only whether it reaches 2, the order from which a tangent step loses to a halving (§8.1) — no new constant. On the traces of the base rule, at the moments the flag rises, the three conditions together hold on 3 of the 154 canonical problems, on all 20 flat problems, and on none of `fun2`, `fun8`, `fun9`.
**The analogy belongs to the run, the flag to the moment.** In the cycle the base rule runs on a pure power — undershoot, undershoot, crossing, a nearly empty step — the flag rises in the phases whose configuration does *not* recur (the empty step grows emptier every cycle), while the recurring phases have the flag down. Requiring both in one state delayed the entry on the flat problems to their thirteenth state on average. Once established, the analogy is therefore remembered for the run, and the regime is entered at the next unkept promise (eighth state on average).
@@ -437,11 +439,11 @@ Halving is the answer when nothing is known about the shape; inside the regime t
$$t=\frac{|F_A|^{1/m}}{|F_A|^{1/m}+|F_B|^{1/m}},\tag{7}$$
which is exact for a pure power and becomes the midpoint as $m\to\infty$. The order read from a *failed promise*, $(1-1/m)^m=r$, was tried first and gave $m=\infty$ in 163 of 174 entries, because the base step is not a pure tangent; the order read from the *analogy* is the one that works. With it the flat families of the wide-bracket set cost 743–847 evaluations against 1044 for pure bisection and 1068 for Chandrupatla.
which is exact for a pure power and becomes the midpoint as $m\to\infty$. It is false position applied to $\operatorname{sign}(f)|f|^{1/m}$ — the transformation that turns a root of multiplicity $m$ into a simple one, classical since Schröder [16] and Traub [17]; what is new here is only where $m$ comes from. The order read from a *failed promise*, $(1-1/m)^m=r$, was tried first and gave $m=\infty$ in 163 of 174 entries, because the base step is not a pure tangent; the order read from the *analogy* is the one that works. With it the flat families of the wide-bracket set cost 743–847 evaluations against 1044 for pure bisection and 1068 for Chandrupatla.
### 8.4 Five more readings
**The half the step promises.** $S(z)\ge\tfrac12$ means a step of at most half the way to the far end: the model promises the root in the half of the bracket *near* $x$. The line through the bracket ends puts it nearer the end with the smaller $|f|$. When the far end has the smaller $|f|$ the two disagree about the half, and the evaluation halves. On a steep flank — a slope dominated by $f(81)=1.5\cdot10^{35}$ on `fun9.5` — this is the false promise "the root is here", and removing it alone takes the canonical set from 2806 to 2564.
**The half the step promises.** $S(z)\ge\tfrac12$ means a step of at most half the way to the far end: the model promises the root in the half of the bracket *near* $x$. The line through the bracket ends puts it nearer the end with the smaller $|f|$. When the far end has the smaller $|f|$ the two disagree about the half, and the evaluation halves. On a steep flank — a slope dominated by $f(81)=1.5\cdot10^{35}$ on `fun9.5` — this is the false promise "the root is here", and removing it alone takes the canonical set from 2806 to 2564. It is a relative of Brent's acceptance condition [2], which admits an interpolant only between the best point and $(3a+b)/4$: both refuse a model that points towards the worse end of the bracket.
**The sign contradiction.** The bracket says which way $f$ must go between its ends; the last two points say which way it goes here. Opposite signs — the local picture contradicts the bracket — and the evaluation halves. It is the cause of the `fun9` well: a near-cancelling end reads the root as close while $|f|$ doubles for seventeen steps.
@@ -484,6 +486,37 @@ A′ is 12.5% below Chandrupatla on the canonical set and 17.9% below on the wid
Every component is positive in sum; the regime and the split carry the method. Two are marginal and we say so: the step pattern earns on two corpora of six and loses on four, and the sign contradiction is within noise (+28 over 855 problems). Removing both would change A′'s total by under one per cent (117 of 13032 evaluations); they are kept because the pre-registered rule removes only a component that earns nowhere.
**Table 9a.** The similarity in the step of A′: the same method with each of the nine similarity functions of §5.3 in place of the tent, everything else unchanged. Totals on the protocol of §4 and over the six corpora of §9 (uniform criterion); the guarantee holds with every function.
| $S$ in the step | APS + CHA | six corpora (855) |
|---|---|---|
| **tent $1-|z|$ (A′)** | **4443** | **13032** |
| $e^{-|z|}$ | 4988 | 14142 |
| $1/(1+|z|)$ | 5486 | 14843 |
| $(1+|z|)^{-2}$ | 8360 | 28500 |
| $1-\sqrt{|z|}$ | 12718 | 45552 |
| $1-|z|^{1/3}$ | 17207 | 63031 |
| $e^{-z^2}$ | 18410 | 67701 |
| $1/\sqrt{1+z^2}$ | 18412 | 67854 |
| $1/(1+z^2)$ | 18422 | 67394 |
The similarity in the step earns its place in the proposed method as it did in the base rule: the nearest other function costs 12% more on the canonical protocol and 9% more over the six corpora, the functions that approach 1 quadratically cost four to five times more, and the ranking is the one the contraction law of §2.2 predicts, the three functions with a linear approach first and the three with a quadratic approach last.
### 8.6 What is known, and what is new
Several mechanisms of A′ coincide with classical ones, and the coincidence is worth stating, because they were not taken from the literature but reached from the principles of the paper — similarity to a prototype and analogy as similarity of relations — and recognised afterwards:
| in A′ | classical counterpart |
|---|---|
| the three-point order estimate of §7.1 | Lagouanelle's multiplicity estimate $m=f'^2/(f'^2-ff'')$ [13] |
| the contraction $e(1-1/m)$ behind the flag of §8.1 | multiplicity estimates from successive Newton iterates [14, 15] |
| the order (6) of an analogous pair | the log–log slope of a power law; the (approximate) computational order of convergence [18, 19] |
| the split (7) | false position on $\operatorname{sign}(f)|f|^{1/m}$ [16, 17] |
| the half the step promises | a relative of Brent's acceptance condition [2] |
| the tolerance step | Dekker [9], Brent [2] — borrowed and named as such |
What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 9: 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]; Roots.jl's `Order1B` and `Order2B` [12]); Chandrupatla takes the decision to halve by an empirical acceptance band [3].
## 9. 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 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.
@@ -536,7 +569,7 @@ Only the last line of corpora is evidence for A′ in the strict sense; the firs
4. **Regimes exist, at the level of a function family, and cannot be exploited by a switch.** The cube-root similarity beats the base rule on all five members of Chandrupatla's `fun4` — 32/32/40/47/59 against 89/93/113/125/153, a factor of 2.6 — and consistency across a family at different parameters is the signature of structure rather than luck. But the same similarity over the whole Chandrupatla set costs 4109 against 3220, so a switch chosen per benchmark is worse than no switch at all: 6915 against 6026 over both sets. The scale axis offers only 5.3% headroom even to an oracle handed the best scale per problem, two thirds of it inside a single problem family, and the winners are not separated by anything the method can see before it commits — the derived scale wins on bracket widths from $10^0$ to $10^{12}$.
5. **The phase detector: derivation sound, estimator not.** Redoing the contraction law without the assumption $|f|\approx|f'(r)|e$ — taking $|f|\approx K e^m$ instead — does produce the march exponent on its own, $p = L/(L-\ln m)$ with $L=\ln(e/D)$, giving $p=1$ at a simple root and dropping to 0.50 and 0.23 as the approach flattens, which is the neighbourhood of the cube root that wins those families. Substituted back it collapses to the multiplier $m$, measurable as $m = 1/(1-\theta)$ with $\theta = f f''/(f')^2$ from three divided differences and no constant. It preserves the order (2.001) and improves the eight standard problems (82 against 84) — and loses on the full benchmark, 6304 against 6026. The estimator is the failure: on Alefeld–Potra–Shi, where almost every root is simple and the truth is $m=1$, it reports $m>1$ on 27.9% of steps with excursions to $m=34.8$, against 35.8% on the flat families. 27.9 against 35.8 is no separation. A cruder variant, correcting by the fraction of its own promise the previous step kept, fails everything: the order collapses to 0.904 and the standard problems double to 161.
5. **The phase detector: derivation sound, estimator not.** Redoing the contraction law without the assumption $|f|\approx|f'(r)|e$ — taking $|f|\approx K e^m$ instead — does produce the march exponent on its own, $p = L/(L-\ln m)$ with $L=\ln(e/D)$, giving $p=1$ at a simple root and dropping to 0.50 and 0.23 as the approach flattens, which is the neighbourhood of the cube root that wins those families. Substituted back it collapses to the multiplier $m$, measurable as $m = 1/(1-\theta)$ with $\theta = f f''/(f')^2$ from three divided differences and no constant — which is Lagouanelle's multiplicity estimate [13]. It preserves the order (2.001) and improves the eight standard problems (82 against 84) — and loses on the full benchmark, 6304 against 6026. The estimator is the failure: on Alefeld–Potra–Shi, where almost every root is simple and the truth is $m=1$, it reports $m>1$ on 27.9% of steps with excursions to $m=34.8$, against 35.8% on the flat families. 27.9 against 35.8 is no separation. A cruder variant, correcting by the fraction of its own promise the previous step kept, fails everything: the order collapses to 0.904 and the standard problems double to 161.
6. **One problem is scored unsolved for every method**, `aps.13.00`, $f(x)=x e^{-1/x^2}$, all of whose derivatives vanish at the root and which underflows to exactly zero throughout $|x|<0.086$. Every method returns a point where $f(x)=0$ exactly — a genuine root — which the harness scores as a failure because it lies more than $10^{-6}$ from the declared root. It is a property of the scoring, not a failure of the methods; §7.3 finds five more such problems in the wide-bracket set.
@@ -595,3 +628,10 @@ The first is the steep flank. Where the loss remains — `fun9`, the near-cancel
10. N. Ganchovski and A. Traykov, "Modified Anderson-Björck's method for solving non-linear equations in structural mechanics," *IOP Conf. Ser.: Mater. Sci. Eng.*, vol. 1276, 012010, 2023.
11. M. Galassi et al., *GNU Scientific Library Reference Manual*, 3rd ed. Network Theory, 2009; root-finding test suite `roots/test.c`.
12. J. Verzani et al., *Roots.jl*, Julia package; bracketing benchmark `test/benchmark-bracketing-methods.jl`, commit cf1d256, 2026.
13. J. L. Lagouanelle, "Sur une méthode de calcul de l'ordre de multiplicité des zéros d'un polynôme," *C. R. Acad. Sci. Paris Sér. A*, vol. 262, pp. 626–627, 1966.
14. L. B. Rall, "Convergence of the Newton process to multiple solutions," *Numer. Math.*, vol. 9, pp. 23–37, 1966.
15. E. Hansen and M. Patrick, "Estimating the multiplicity of a root," *Numer. Math.*, vol. 27, pp. 121–131, 1976.
16. E. Schröder, "Ueber unendlich viele Algorithmen zur Auflösung der Gleichungen," *Math. Ann.*, vol. 2, pp. 317–365, 1870.
17. J. F. Traub, *Iterative Methods for the Solution of Equations*. Englewood Cliffs, NJ: Prentice-Hall, 1964.
18. S. Weerakoon and T. G. I. Fernando, "A variant of Newton's method with accelerated third-order convergence," *Appl. Math. Lett.*, vol. 13, pp. 87–93, 2000.
19. A. Cordero and J. R. Torregrosa, "Variants of Newton's method using fifth-order quadrature formulas," *Appl. Math. Comput.*, vol. 190, pp. 686–698, 2007.
+11
View File
@@ -0,0 +1,11 @@
A' with S in the step - totals per corpus (violations of the 2x bound)
ratio APS 2259 CHA 1074 NEW 3290 RJL 1371 APP 1382 D 3656 all 13032 (viol 0)
exp_abs APS 2762 CHA 1203 NEW 3497 RJL 1427 APP 1501 D 3752 all 14142 (viol 0)
rational APS 2873 CHA 1551 NEW 3614 RJL 1456 APP 1538 D 3811 all 14843 (viol 0)
ratio_soft APS 5715 CHA 1534 NEW 7118 RJL 2628 APP 4407 D 7098 all 28500 (viol 0)
sqrt APS 9432 CHA 2181 NEW 11325 RJL 3887 APP 7518 D 11209 all 45552 (viol 0)
cbrt APS 13432 CHA 2662 NEW 15590 RJL 5269 APP 10948 D 15130 all 63031 (viol 0)
rat_sq APS 14497 CHA 2955 NEW 15992 RJL 5743 APP 11078 D 17129 all 67394 (viol 0)
exp_sq APS 14481 CHA 2948 NEW 16000 RJL 5806 APP 11068 D 17398 all 67701 (viol 0)
cosine APS 14496 CHA 2991 NEW 16016 RJL 5751 APP 11090 D 17510 all 67854 (viol 0)
ablation S done
+9
View File
@@ -0,0 +1,9 @@
ratio APS 2438 CHA 2005 both 4443 solved 193 over 0
exp_abs APS 2919 CHA 2069 both 4988 solved 193 over 0
rational APS 3058 CHA 2428 both 5486 solved 193 over 0
ratio_soft APS 5900 CHA 2460 both 8360 solved 193 over 0
sqrt APS 9612 CHA 3106 both 12718 solved 193 over 0
cbrt APS 13619 CHA 3588 both 17207 solved 193 over 0
exp_sq APS 14658 CHA 3752 both 18410 solved 193 over 0
cosine APS 14667 CHA 3745 both 18412 solved 193 over 0
rat_sq APS 14670 CHA 3752 both 18422 solved 193 over 0
+14 -14
View File
@@ -1,19 +1,19 @@
Gain of each reading (APS | CHA), by the similarity S used in the STEP. Negative = cheaper.
S in the step slope-sign gate triple by shape far end by dissimilarity decision 'defect' decision 'simpair' (uses S)
tent 1-|z| +42 | -146 -493 | +205 -122 | -289 -283 | -10 +2515 | -310
1-sqrt|z| +16 | +167 -47 | +9 -186 | -43 +195 | -27 +18 | -199
1-|z|^1/3 +3 | +186 -36 | +139 -776 | -368 +215 | +12 +208 | -50
1/(1+|z|) +165 | -87 +126 | +358 -118 | -327 +8 | -8 +3825 | -432
(1+|z|)^-2 +29 | -158 -255 | +182 +29 | -217 +204 | -111 +49 | -670
e^-|z| +64 | -203 -227 | +278 +30 | -382 -2 | -2 +3194 | -503
1/(1+z^2) +2 | +1 +11 | +273 -9 | -223 +14 | -172 +18 | -853
e^-z^2 +1 | -3 -224 | +303 -8 | -214 +14 | -179 +10 | -790
1/sqrt(1+z^2) +0 | +14 +250 | +186 -12 | -211 -10 | -171 +4 | -844
tent 1-|z| +42 | -106 -493 | +194 -122 | -315 -283 | -10 +2515 | -310
1-sqrt|z| +16 | +226 -47 | -17 -186 | -65 +195 | -34 +18 | -206
1-|z|^1/3 +3 | +188 -36 | +131 -776 | -359 +215 | +8 +208 | -58
1/(1+|z|) +165 | -24 +126 | +361 -118 | -354 +8 | -8 +3825 | -407
(1+|z|)^-2 +29 | -100 -255 | +175 +29 | -235 +204 | -111 +49 | -641
e^-|z| +64 | -145 -227 | +276 +30 | -404 -2 | -2 +3194 | -473
1/(1+z^2) +2 | +1 +11 | +275 -9 | -300 +14 | -146 +18 | -825
e^-z^2 +1 | -3 -224 | +321 -8 | -294 +14 | -77 +10 | -767
1/sqrt(1+z^2) +0 | +14 +250 | +192 -12 | -264 -10 | -107 +4 | -778
Does the gain depend on S? Range of the gain over the nine functions:
slope-sign gate APS +0 .. +165 CHA -203 .. +186 (over 9 functions)
triple by shape APS -493 .. +250 CHA +9 .. +358 (over 9 functions)
far end by dissimilarity APS -776 .. +30 CHA -382 .. -43 (over 9 functions)
decision 'defect' APS -283 .. +215 CHA -179 .. +12 (over 9 functions)
decision 'simpair' (uses S) APS +4 .. +3825 CHA -853 .. -50 (over 9 functions)
slope-sign gate APS +0 .. +165 CHA -145 .. +226 (over 9 functions)
triple by shape APS -493 .. +250 CHA -17 .. +361 (over 9 functions)
far end by dissimilarity APS -776 .. +30 CHA -404 .. -65 (over 9 functions)
decision 'defect' APS -283 .. +215 CHA -146 .. +8 (over 9 functions)
decision 'simpair' (uses S) APS +4 .. +3825 CHA -825 .. -58 (over 9 functions)
+37
View File
@@ -439,6 +439,43 @@ Section 9 (out-of-sample corpora):
OK Roots.jl, variant carried: totals got (1464, 1566) want (1464, 1566)
OK Roots.jl, variant carried: per problem got (38, 10, 30) want (38, 10, 30)
OK applied, variant carried: totals got (1580, 1382) want (1580, 1382)
Table 9a and section 7: the similarity in the step (fresh audit run):
OK Table 9a ratio APS+CHA got 4443 want 4443
OK Table 9a ratio six corpora got 13032 want 13032
OK Table 9a ratio guarantee got 0 want 0
OK Table 9a exp_abs APS+CHA got 4988 want 4988
OK Table 9a exp_abs six corpora got 14142 want 14142
OK Table 9a exp_abs guarantee got 0 want 0
OK Table 9a rational APS+CHA got 5486 want 5486
OK Table 9a rational six corpora got 14843 want 14843
OK Table 9a rational guarantee got 0 want 0
OK Table 9a ratio_soft APS+CHA got 8360 want 8360
OK Table 9a ratio_soft six corpora got 28500 want 28500
OK Table 9a ratio_soft guarantee got 0 want 0
OK Table 9a sqrt APS+CHA got 12718 want 12718
OK Table 9a sqrt six corpora got 45552 want 45552
OK Table 9a sqrt guarantee got 0 want 0
OK Table 9a cbrt APS+CHA got 17207 want 17207
OK Table 9a cbrt six corpora got 63031 want 63031
OK Table 9a cbrt guarantee got 0 want 0
OK Table 9a exp_sq APS+CHA got 18410 want 18410
OK Table 9a exp_sq six corpora got 67701 want 67701
OK Table 9a exp_sq guarantee got 0 want 0
OK Table 9a cosine APS+CHA got 18412 want 18412
OK Table 9a cosine six corpora got 67854 want 67854
OK Table 9a cosine guarantee got 0 want 0
OK Table 9a rat_sq APS+CHA got 18422 want 18422
OK Table 9a rat_sq six corpora got 67394 want 67394
OK Table 9a rat_sq guarantee got 0 want 0
OK nearest other S costs more, protocol % got 12 want 12
OK worst S costs more, protocol % got 315 want 315
OK nearest other S costs more, six corpora % got 9 want 9
OK quadratic S: four to five times got (4, 5) want (4, 5)
OK audit: shape gain with the tent (APS) got -493 want -493
OK audit: shape gain with 1/sqrt(1+z^2) (APS) got 250 want 250
OK audit: defect gain with the tent (APS) got -283 want -283
OK audit: defect gain with 1-|z|^1/3 (APS) got 215 want 215
OK sign test p for 103:31 got '3e-10' want '3e-10'
OK sign test p for 31:10 got '0.001' want '0.001'
OK sign test p for 108:65 got '0.001' want '0.001'
File diff suppressed because one or more lines are too long
+57
View File
@@ -0,0 +1,57 @@
"""The S-ablation of A' on all six corpora (uniform criterion, a sign change within 1e-6):
A' with each of the nine similarity functions in the step, everything else unchanged. The
tent row is A' itself. Descriptive: every corpus has been seen.
python -u sweep_ablation_s.py run -> sweep_ablation_s.json, then the table
python -u sweep_ablation_s.py --report
"""
from __future__ import annotations
import json
import sys
from multiprocessing import Pool
import sweep_fourth
from sweep_fourth import evaluate as _eval_one
from sweep_full import APRIME, PURE_SIMS
SETS = ("APS", "CHA", "NEW", "RJL", "APP", "D")
for _s in PURE_SIMS:
sweep_fourth.CONFIGS[f"S:{_s}"] = ("pure", _s, "derived3", "project", "x", APRIME,
"recent", "distance", "none", "pattern")
def evaluate(job):
name, which = job
return name, _eval_one((name, which))[1]
def cost(v):
return v[0] if v[1] else 200
def main():
names = [f"S:{s}" for s in sorted(PURE_SIMS)]
if "--report" not in sys.argv:
jobs = [(n, w) for n in names for w in ("seen", "fourth")]
with Pool(min(12, len(jobs))) as pool:
out = pool.map(evaluate, jobs)
R = {}
for n, res in out:
R.setdefault(n, {}).update(res)
with open("sweep_ablation_s.json", "w", encoding="utf8") as fh:
json.dump(R, fh)
with open("sweep_ablation_s.json", encoding="utf8") as fh:
R = json.load(fh)
tot = {n: {s: sum(cost(v) for v in R[n][s].values()) for s in SETS} for n in R}
viol = {n: sum(v[2] for s in SETS for v in R[n][s].values()) for n in R}
print("A' with S in the step - totals per corpus (violations of the 2x bound)")
for n in sorted(tot, key=lambda k: sum(tot[k].values())):
print(f" {n[2:]:<11} " + " ".join(f"{s} {tot[n][s]:5d}" for s in SETS)
+ f" all {sum(tot[n].values()):6d} (viol {viol[n]})")
print("ablation S done")
if __name__ == "__main__":
main()
File diff suppressed because one or more lines are too long
+14 -3
View File
@@ -352,6 +352,14 @@ def build_grid_aprime(smoke):
return specs
def build_grid_aprime_s(smoke):
"""A' with each of the nine similarity functions in the step (the S-ablation of the
proposed method, on the paper's own protocol); the tent ('ratio') row is A' itself."""
sims = ["ratio", "sqrt"] if smoke else sorted(PURE_SIMS)
return [("pure", s, "derived3", "project", "x", APRIME, "recent", "distance", "none",
"pattern") for s in sims]
def build_grid_extrap2(smoke):
"""PREREG_extrapolation_gates_2026-09-21: the same cells as build_grid_extrap, every
one in all five modes (none, A, G1, G2, G3)."""
@@ -534,10 +542,12 @@ def main():
expmode = "--explimit" in sys.argv # the translation limit of the analogy, m = inf
halfmode = "--half" in sys.argv # the half promised by the step vs the bracket
apmode = "--aprime" in sys.argv # the paper's proposed rule A' and its ablations
apsmode = "--aprimeS" in sys.argv # A' with each of the nine S in the step
combomode = "--combo" in sys.argv # modes A and B together
pointsmode = "--points" in sys.argv # mode A: triple by shape
dirmode = "--direction" in sys.argv # mode B: far end by dissimilarity
specs = (build_grid_aprime(smoke) if apmode else
specs = (build_grid_aprime_s(smoke) if apsmode else
build_grid_aprime(smoke) if apmode else
build_grid_half(smoke) if halfmode else
build_grid_explimit(smoke) if expmode else
build_grid_orderpt(smoke) if ptmode else
@@ -576,8 +586,9 @@ def main():
# the published sweep_full.json is what verify_article.py checks the paper
# against, so the log grid never writes into it
if apmode or halfmode or expmode or ptmode or dcmode or memmode or analogmode or judgemode or exitmode or stickmode or creepmode or flat2mode or flatmode or ext2mode or extmode or decmode or ordermode or capmode or combomode or pointsmode or dirmode:
base = ("sweep_aprime" if apmode else
if apsmode or apmode or halfmode or expmode or ptmode or dcmode or memmode or analogmode or judgemode or exitmode or stickmode or creepmode or flat2mode or flatmode or ext2mode or extmode or decmode or ordermode or capmode or combomode or pointsmode or dirmode:
base = ("sweep_aprime_s" if apsmode else
"sweep_aprime" if apmode else
"sweep_half" if halfmode else
"sweep_explimit" if expmode else
"sweep_orderpt" if ptmode else
+28
View File
@@ -800,6 +800,34 @@ def verify_flat_regime_and_oos():
check("applied, variant carried: totals", (sum(cost(v) for v in app["A"].values()),
sum(cost(v) for v in app["chandrupatla"].values())),
(1580, 1382))
print("\nTable 9a and section 7: the similarity in the step (fresh audit run):")
aps_ = {r["spec"][1]: r for r in _load("sweep_aprime_s.json")}
abs_ = _load("sweep_ablation_s.json")
t9a = {"ratio": (4443, 13032), "exp_abs": (4988, 14142), "rational": (5486, 14843),
"ratio_soft": (8360, 28500), "sqrt": (12718, 45552), "cbrt": (17207, 63031),
"exp_sq": (18410, 67701), "cosine": (18412, 67854), "rat_sq": (18422, 67394)}
for s_, (two, six) in t9a.items():
r = aps_[s_]
check(f"Table 9a {s_} APS+CHA", r["APS"]["total"] + r["CHA"]["total"], two)
check(f"Table 9a {s_} six corpora", sum(tot(abs_[f"S:{s_}"], s) for s in sets), six)
check(f"Table 9a {s_} guarantee", r["APS"]["over"] + r["CHA"]["over"]
+ sum(v[2] for s in sets for v in abs_[f"S:{s_}"][s].values()), 0)
check("nearest other S costs more, protocol %", round(100 * (4988 / 4443 - 1)), 12)
check("worst S costs more, protocol %", round(100 * (18422 / 4443 - 1)), 315)
check("nearest other S costs more, six corpora %", round(100 * (14142 / 13032 - 1)), 9)
check("quadratic S: four to five times",
(int(18410 / 4443), int(67854 / 13032)), (4, 5))
import audit_similarity_places
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
audit_similarity_places.main()
rows_a = {ln.split(" ")[0].strip(): re.findall(r"([+-]\d+) \|", ln)
for ln in buf.getvalue().splitlines() if " | " in ln}
check("audit: shape gain with the tent (APS)", int(rows_a["tent 1-|z|"][1]), -493)
check("audit: shape gain with 1/sqrt(1+z^2) (APS)", int(rows_a["1/sqrt(1+z^2)"][1]), 250)
check("audit: defect gain with the tent (APS)", int(rows_a["tent 1-|z|"][3]), -283)
check("audit: defect gain with 1-|z|^1/3 (APS)", int(rows_a["1-|z|^1/3"][3]), 215)
# every sign-test p the paper prints in Section 9, at the precision printed
for (w, l), printed in (((103, 31), "3e-10"), ((31, 10), "0.001"), ((108, 65), "0.001"),
((44, 20), "0.004"), ((48, 32), "0.09"), ((177, 28), "1e-27"),