Files
vvsandClaude Opus 5 f5d036c9d8 Why the wide-bracket gap remains, taken apart on the SAME evaluations: 'order of the model' explains only a third. Of the 262 evaluations lost on 33 problems, 178 sit on fun3-fun6 - pure powers of order 3, 5, 9, 19 - where no interpolating model works (our step 0.41-0.81 bracket halvings per evaluation, IQI from our own points 0.01-0.17) and Chandrupatla wins by BISECTING 93-100% of his steps; our step is slower than bisection there and our 2x-bisection guarantee licenses it. His band inside our step confirms it per family: fun4/5/6 573/456/456 -> 296/239/235 against his 293/228/228, while +164/+111/+170/+144 on fun1/2/8/9 where it refuses good steps - slot 2's total was two opposite effects summed. Only fun1 (58) is model order: IQI from our three points 10.37 halvings against our 0.62; a convex two-point step cannot carry IQI's negative weight (428/428 non-degenerate states; five underflowed to -0.0).
The flat regime is not detectable by the three-point order estimate: m >= 2 (the exact condition for a tangent step to lose to a halving) fires on 0.2% of APS states and on only 5.8% of states of pure powers of order 3-19. Paper corrected where it said the whole gap is model order (widelimit, decision, abstract, future work - the refuted log transform removed). WARNING recorded in FINDINGS_model_order.md: article/sim_numerics.tex has carried a STALE header since the first commit (current text = sim_numerics.md, unchanged since 08-24); every paper edit of 09-20/21 went into the .tex, the .md has none of them. Which file is canonical is Valeri's call. The new text numbers trace to results_diag_*.txt but are not yet machine-checked by verify_article.py. Trace hook in pure_root is behaviour-neutral and pinned; 762 pass on the server twice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 07:38:16 +01:00

43 lines
1.3 KiB
Python

"""Pins for the diagnostic trace hook in pure_root (diag_model_order.py relies on it)."""
from __future__ import annotations
import math
import pytest
from simroot.pure import pure_root
PROBS = (
(lambda t: t ** 3 - 2.0 * t - 5.0, 1.0, 4.0),
(lambda t: math.exp(t) - 2.0, 0.0, 3.0),
(lambda t: (t - 3.0) ** 3, 0.0, 10.0),
)
CFG = dict(similarity="ratio", scale="derived3", guard="safe", prestep="slope",
direction="dissimilar")
@pytest.mark.parametrize("f,a,b", PROBS)
def test_trace_is_behaviour_neutral(f, a, b):
"""Asking for a trace must not change a single evaluation."""
plain = pure_root(f, a, b, 1e-12, 200, **CFG)
st = {"trace": []}
traced = pure_root(f, a, b, 1e-12, 200, stats=st, **CFG)
assert plain == traced
@pytest.mark.parametrize("f,a,b", PROBS)
def test_trace_records_every_similarity_step(f, a, b):
st = {"trace": []}
_x, n, ok = pure_root(f, a, b, 1e-12, 200, stats=st, **CFG)
assert ok and 0 < len(st["trace"]) < n
for s in st["trace"]:
lo, hi = min(s["A"], s["B"]), max(s["A"], s["B"])
assert lo <= s["x"] <= hi
assert s["far"] in (s["A"], s["B"])
def test_no_trace_key_means_no_trace():
st = {}
pure_root(lambda t: t - 1.0, 0.0, 3.0, 1e-10, 100, stats=st, **CFG)
assert "trace" not in st