PREREG_flat_order_point outcome: ACCEPTED, and the GOAL is reached - below Chandrupatla on BOTH sets (server numbers, all projection cells equal to the smoke).
Splitting in the flat regime at the point from the analogous pair's order (t = |FA|^(1/m) / (|FA|^(1/m) + |FB|^(1/m))) instead of the midpoint: G2 + analogy + order point APS 2780 CHA 2221 both 5001 (P1-P4 all hold; vs Chandrupatla 2787 / 2441 / 5228) G2 + contra + remembered + point APS 2775 CHA 2119 both 4894 (P3 fails by 2 against its midpoint twin) defect + remembered + point APS 2532 CHA 2164 both 4696 (P3 fails by 2) Flat fun3-6: 1234 -> 847 (analogy), 1151 -> 743 (remembered) - below pure bisection 1044 and Chandrupatla 1068. Per problem on the wide set vs Chandrupatla now 20-24 wins / 13-17 losses (p 0.1-0.7, not significant); on the canonical set the edge is kept (95/20/38 p=8e-7). Guarantee: 0 violations and >= 193 solved in every project/safe/credit cell. Server regression x2: 1150 passed, 1 failed = the paper-number check. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -338,3 +338,46 @@ def test_contra_is_silent_on_a_line_and_breaks_the_fun9_well():
|
||||
_x, n1, ok = pure_root(_fun9, 0.0002, 27.0, XTOL, MAXFEV, similarity="ratio",
|
||||
scale="derived3", guard="project", prestep="contra")
|
||||
assert ok and n1 < n0, (n0, n1)
|
||||
|
||||
|
||||
# ---- PREREG_flat_order_point_2026-09-21: split at the point from the pair's order ----
|
||||
from simroot.pure import _analogy_order # noqa: E402
|
||||
|
||||
|
||||
@pytest.mark.parametrize("f,a,b", PROBS)
|
||||
@pytest.mark.parametrize("guard", ("project", "credit"))
|
||||
@pytest.mark.parametrize("pre", ("flatanalogpt", "flatanalogmempt", "defect+flatanalogmempt",
|
||||
"contra+flatanalogmempt"))
|
||||
def test_the_guarantee_holds_with_the_order_point(f, a, b, guard, pre):
|
||||
x, n, ok = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard=guard, prestep=pre)
|
||||
assert ok and min(a, b) <= x <= max(a, b)
|
||||
half = math.ceil(math.log2(abs(b - a) / XTOL))
|
||||
assert n <= (2 * half + 3 if guard == "project" else half + 4), n
|
||||
|
||||
|
||||
def test_the_pair_reads_the_order_of_an_exact_power():
|
||||
p = lambda t: t ** 5 # noqa: E731
|
||||
old = _config3(0.4, p(0.4), 0.8, p(0.8), 1.6, p(1.6))
|
||||
new = _config3(0.1, p(0.1), 0.2, p(0.2), 0.4, p(0.4))
|
||||
assert _analogy_order(new, [old]) == pytest.approx(5.0, rel=1e-9)
|
||||
|
||||
|
||||
def test_the_order_point_spares_simple_roots_and_beats_the_midpoint_on_powers():
|
||||
"""Measured before pinning (remembered analogy): x^9 50 -> 33, x^19 57 -> 32,
|
||||
6(x-2)^5 53 -> 32; simple roots cost exactly the rule without the regime."""
|
||||
for f, a, b in ((lambda t: 3.0 * t - 1.0, -2.0, 5.0),
|
||||
(lambda t: t ** 3 - 2.0 * t - 5.0, 1.0, 4.0),
|
||||
(lambda t: math.exp(t) - 2.0, 0.0, 3.0)):
|
||||
_x, n1, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalogmempt")
|
||||
_x, n0, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project")
|
||||
assert n1 == n0
|
||||
for f, a, b in ((lambda t: t ** 9, -1.0, 2.0), (lambda t: t ** 19, -10.0, 100.0),
|
||||
(lambda t: 6.0 * (t - 2.0) ** 5, 0.0, 10.0)):
|
||||
_x, npt, ok = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalogmempt")
|
||||
_x, nmid, _ = pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep="flatanalogmem")
|
||||
assert ok and npt < nmid, (npt, nmid)
|
||||
|
||||
Reference in New Issue
Block a user