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:
@@ -0,0 +1,18 @@
|
||||
== no G2
|
||||
flatanalogpt APS 2807->2807 CHA 2635->2338 flat 1238->958 P1 ✓ P2 ✓ P3 ✓ P4 ✓ GOAL no vsCh APS 87/24/42 CHA 21/4/15 p=0.41
|
||||
fun1:82 fun2:141 fun3:314 fun4:288 fun5:100 fun6:256 fun7:1000 fun8:52 fun9:105
|
||||
flatanalogmempt APS 2814->2814 CHA 2552->2119 flat 1151->743 P1 ✓ P2 ✓ P3 ✓ P4 ✓ GOAL no vsCh APS 87/24/42 CHA 23/4/13 p=0.13
|
||||
fun1:79 fun2:141 fun3:132 fun4:151 fun5:252 fun6:208 fun7:1000 fun8:52 fun9:104
|
||||
defect+flatanalogmempt APS 2530->2532 CHA 2561->2164 flat 1156->789 P1 ✓ P2 ✓ P3 ✗ P4 ✓ GOAL YES vsCh APS 86/20/47 CHA 20/3/17 p=0.74
|
||||
fun1:99 fun2:144 fun3:132 fun4:141 fun5:177 fun6:339 fun7:1000 fun8:57 fun9:75
|
||||
contra+flatanalogmempt APS 2792->2794 CHA 2537->2105 flat 1151->743 P1 ✓ P2 ✓ P3 ✗ P4 ✓ GOAL no vsCh APS 90/23/40 CHA 22/4/14 p=0.24
|
||||
fun1:89 fun2:141 fun3:132 fun4:151 fun5:252 fun6:208 fun7:1000 fun8:52 fun9:80
|
||||
== G2
|
||||
flatanalogpt APS 2780->2780 CHA 2625->2221 flat 1234->847 P1 ✓ P2 ✓ P3 ✓ P4 ✓ GOAL YES vsCh APS 95/20/38 CHA 24/3/13 p=0.099
|
||||
fun1:82 fun2:146 fun3:230 fun4:261 fun5:100 fun6:256 fun7:1000 fun8:52 fun9:94
|
||||
flatanalogmempt APS 2787->2787 CHA 2548->2117 flat 1152->747 P1 ✓ P2 ✓ P3 ✓ P4 ✓ GOAL no vsCh APS 95/20/38 CHA 23/3/14 p=0.19
|
||||
fun1:79 fun2:146 fun3:144 fun4:143 fun5:252 fun6:208 fun7:1000 fun8:52 fun9:93
|
||||
defect+flatanalogmempt APS 2587->2589 CHA 2564->2177 flat 1158->801 P1 ✓ P2 ✓ P3 ✗ P4 ✓ GOAL YES vsCh APS 85/20/48 CHA 20/2/18 p=0.87
|
||||
fun1:99 fun2:145 fun3:144 fun4:141 fun5:177 fun6:339 fun7:1000 fun8:57 fun9:75
|
||||
contra+flatanalogmempt APS 2773->2775 CHA 2548->2119 flat 1152->747 P1 ✓ P2 ✓ P3 ✗ P4 ✓ GOAL YES vsCh APS 98/18/37 CHA 22/3/15 p=0.32
|
||||
fun1:94 fun2:146 fun3:144 fun4:143 fun5:252 fun6:208 fun7:1000 fun8:52 fun9:80
|
||||
@@ -5,6 +5,9 @@ TOTALS (evaluations of f, failures charged 200)
|
||||
+ G2 + analogy entry 2780 2625 5405
|
||||
+ contra + remembered analogy 2792 2537 5329
|
||||
+ defect + remembered analogy 2530 2561 5091
|
||||
+ G2 + analogy + ORDER POINT 2780 2221 5001
|
||||
+ G2 + contra + rem. + ORDER PT 2775 2119 4894
|
||||
+ defect + rem. + ORDER POINT 2532 2164 4696
|
||||
Chandrupatla 2787 2441 5228
|
||||
Brent 2889 4115 7004
|
||||
TOMS748 2820 4000 6820
|
||||
@@ -16,12 +19,18 @@ PER PROBLEM, ours against each rival: wins/ties/losses (sign-test p)
|
||||
+ G2 + analogy entry Chandrupatla 95/20/38 p=8.2e-07 Brent 110/9/34 p=1.5e-10 TOMS748 97/15/41 p=2.1e-06
|
||||
+ contra + remembered analogy Chandrupatla 90/23/40 p=1.4e-05 Brent 105/11/37 p=9.9e-09 TOMS748 87/16/50 p=0.002
|
||||
+ defect + remembered analogy Chandrupatla 86/20/47 p=0.00091 Brent 101/13/39 p=1.6e-07 TOMS748 107/11/35 p=1.1e-09
|
||||
+ G2 + analogy + ORDER POINT Chandrupatla 95/20/38 p=8.2e-07 Brent 110/9/34 p=1.5e-10 TOMS748 97/15/41 p=2.1e-06
|
||||
+ G2 + contra + rem. + ORDER PT Chandrupatla 98/18/37 p=1.5e-07 Brent 112/8/33 p=3e-11 TOMS748 98/15/40 p=8.5e-07
|
||||
+ defect + rem. + ORDER POINT Chandrupatla 86/20/47 p=0.00091 Brent 101/12/40 p=2.9e-07 TOMS748 107/11/35 p=1.1e-09
|
||||
CHA
|
||||
proposed rule Chandrupatla 9/5/26 p=0.006 Brent 30/4/4 p=6.2e-06 TOMS748 31/1/8 p=0.00029
|
||||
+ G2 (step pattern) Chandrupatla 10/3/27 p=0.0076 Brent 30/2/6 p=7e-05 TOMS748 31/1/8 p=0.00029
|
||||
+ G2 + analogy entry Chandrupatla 9/6/25 p=0.009 Brent 30/2/6 p=7e-05 TOMS748 36/1/3 p=3.6e-08
|
||||
+ contra + remembered analogy Chandrupatla 8/7/25 p=0.0046 Brent 31/4/3 p=7.7e-07 TOMS748 37/1/2 p=2.8e-09
|
||||
+ defect + remembered analogy Chandrupatla 8/5/27 p=0.0019 Brent 30/2/6 p=7e-05 TOMS748 35/1/4 p=3.4e-07
|
||||
+ G2 + analogy + ORDER POINT Chandrupatla 24/3/13 p=0.099 Brent 30/2/6 p=7e-05 TOMS748 35/1/4 p=3.4e-07
|
||||
+ G2 + contra + rem. + ORDER PT Chandrupatla 22/3/15 p=0.32 Brent 31/2/5 p=1.3e-05 TOMS748 36/1/3 p=3.6e-08
|
||||
+ defect + rem. + ORDER POINT Chandrupatla 20/3/17 p=0.74 Brent 30/2/6 p=7e-05 TOMS748 34/1/5 p=2.4e-06
|
||||
|
||||
CHA PER FAMILY (ours / Chandrupatla)
|
||||
fun1 fun2 fun3 fun4 fun5 fun6 fun7 fun8 fun9
|
||||
@@ -30,4 +39,7 @@ CHA PER FAMILY (ours / Chandrupatla)
|
||||
+ G2 + analogy entry 99 146 336 331 254 313 1000 52 94
|
||||
+ contra + remembered analogy 108 141 304 318 254 275 1000 52 85
|
||||
+ defect + remembered analogy 123 144 304 315 257 280 1000 57 81
|
||||
+ G2 + analogy + ORDER POINT 82 146 230 261 100 256 1000 52 94
|
||||
+ G2 + contra + rem. + ORDER PT 94 146 144 143 252 208 1000 52 80
|
||||
+ defect + rem. + ORDER POINT 99 144 132 141 177 339 1000 57 75
|
||||
Chandrupatla 103 152 305 297 233 233 1000 63 55
|
||||
|
||||
+52
-16
@@ -607,25 +607,33 @@ def _config3(x, fx, xp, fp, xp2, fp2):
|
||||
return xi, phi, abs(x - xp), abs(fx - fp)
|
||||
|
||||
|
||||
def _analogous_and_steep(cur, past):
|
||||
"""Is the configuration nearer to its own past than to the line phi = xi, and does the
|
||||
analogous pair scale like a power of order m >= 2? Two ordinal judgments and the
|
||||
flag's own break-even (1/4 = (1 - 1/2)^2 <-> m = 2); no new constant.
|
||||
def _analogy_order(cur, past):
|
||||
"""The order m of the analogous pair, or None when the configuration is not nearer to
|
||||
its own past than to the line phi = xi (or the pair's scales are undefined). The judgment
|
||||
is ordinal; m = ln(f ratio) / ln(x ratio) is read, not chosen.
|
||||
|
||||
Nearness: Euclidean in the (xi, phi) plane, the line by its perpendicular. Order: the
|
||||
pair shrank x by L and f by L^m, m = ln(f ratio) / ln(x ratio)."""
|
||||
if cur is None or not past:
|
||||
return False
|
||||
return None
|
||||
xi, phi = cur[0], cur[1]
|
||||
best = min(past, key=lambda q: math.hypot(xi - q[0], phi - q[1]))
|
||||
if not math.hypot(xi - best[0], phi - best[1]) < abs(phi - xi) / math.sqrt(2.0):
|
||||
return False
|
||||
return None
|
||||
if best[2] <= 0.0 or best[3] <= 0.0 or cur[2] <= 0.0 or cur[3] <= 0.0:
|
||||
return False
|
||||
return None
|
||||
lx, lf = cur[2] / best[2], cur[3] / best[3]
|
||||
if not (math.isfinite(lx) and math.isfinite(lf)) or lx == 1.0 or lf <= 0.0:
|
||||
return False
|
||||
return math.log(lf) / math.log(lx) >= 2.0
|
||||
return None
|
||||
return math.log(lf) / math.log(lx)
|
||||
|
||||
|
||||
def _analogous_and_steep(cur, past):
|
||||
"""Is the configuration nearer to its own past than to the line phi = xi, and does the
|
||||
analogous pair scale like a power of order m >= 2? Two ordinal judgments and the
|
||||
flag's own break-even (1/4 = (1 - 1/2)^2 <-> m = 2); no new constant."""
|
||||
m = _analogy_order(cur, past)
|
||||
return m is not None and m >= 2.0
|
||||
|
||||
|
||||
def _local_order(x2, f2, x1, f1, x0, f0):
|
||||
@@ -750,17 +758,23 @@ def pure_root(f, a, b, xtol, maxfev, similarity="ratio", scale="derived",
|
||||
# category variables below then carry the same string the old tests compared.
|
||||
if "+" in prestep:
|
||||
parts = prestep.split("+")
|
||||
cats = ({"defect"}, {"contra"}, {"flatanalog", "flatanalogmem"})
|
||||
cats = ({"defect"}, {"contra"}, {"flatanalog", "flatanalogmem", "flatanalogpt",
|
||||
"flatanalogmempt"})
|
||||
if (len(parts) != len(set(parts)) or any(not any(p in c for c in cats) for p in parts)
|
||||
or any(sum(p in c for p in parts) > 1 for c in cats)):
|
||||
raise ValueError(f"unknown composite prestep {prestep!r}")
|
||||
elif prestep not in ("none", "progress", "slope", "band", "defect", "simpair", "flat",
|
||||
"flat2", "flatcreep", "flatstick", "flatstickmid", "flatstickexit",
|
||||
"flatjudge", "flatanalog", "flatanalogmem", "contra"):
|
||||
"flatjudge", "flatanalog", "flatanalogmem", "contra",
|
||||
"flatanalogpt", "flatanalogmempt"):
|
||||
raise ValueError(f"unknown prestep {prestep!r}")
|
||||
parts = prestep.split("+")
|
||||
pre_dec = next((p for p in parts if p in ("band", "defect", "simpair")), "none")
|
||||
pre_flat = next((p for p in parts if p in ("flatanalog", "flatanalogmem")), "none")
|
||||
pre_flat = next((p for p in parts if p in ("flatanalog", "flatanalogmem", "flatanalogpt",
|
||||
"flatanalogmempt")), "none")
|
||||
# PREREG_flat_order_point: the "pt" twins split at the point from the pair's order
|
||||
flat_mem = pre_flat in ("flatanalogmem", "flatanalogmempt")
|
||||
flat_pt = pre_flat in ("flatanalogpt", "flatanalogmempt")
|
||||
pre_contra = "contra" in parts
|
||||
if pre_dec != "none" and scale not in (
|
||||
"derived3", "derived3_cap", "derived3_m", "bracket", "far"):
|
||||
@@ -819,6 +833,8 @@ def pure_root(f, a, b, xtol, maxfev, similarity="ratio", scale="derived",
|
||||
judged = 0 # flatjudge: +1 the last point looked flat, -1 linear, 0 tie
|
||||
configs = [] # flatanalog: the run's memory of (xi, phi, |dx|, |df|)
|
||||
analogy_seen = False # flatanalogmem: the run has been judged analogous to its past
|
||||
analogy_m = math.inf # flatanalog*pt: the order read from the latest analogous pair
|
||||
regime_target = None # flatanalog*pt: the point the regime step aimed at
|
||||
if stats is not None:
|
||||
stats['forced'] = 0
|
||||
stats['pre_refused'] = 0
|
||||
@@ -1049,12 +1065,17 @@ def pure_root(f, a, b, xtol, maxfev, similarity="ratio", scale="derived",
|
||||
cur = _config3(x, fx, x_prev, f_prev, x_prev2, f_prev2)
|
||||
flag = (sticky_m is None and last_model and f_prev != 0.0
|
||||
and fx / f_prev >= 0.25)
|
||||
if pre_flat == "flatanalogmem":
|
||||
if _analogous_and_steep(cur, configs):
|
||||
m_pair = _analogy_order(cur, configs)
|
||||
steep = m_pair is not None and m_pair >= 2.0
|
||||
if flat_mem:
|
||||
if steep:
|
||||
analogy_seen = True
|
||||
analogy_m = m_pair
|
||||
enter = flag and analogy_seen
|
||||
else:
|
||||
enter = flag and _analogous_and_steep(cur, configs)
|
||||
enter = flag and steep
|
||||
if enter:
|
||||
analogy_m = m_pair
|
||||
if enter:
|
||||
sticky_m = math.inf
|
||||
if stats is not None:
|
||||
@@ -1064,7 +1085,13 @@ def pure_root(f, a, b, xtol, maxfev, similarity="ratio", scale="derived",
|
||||
if sticky_m is not None:
|
||||
if step is None:
|
||||
pre_refused += 1
|
||||
step = 0.5 * (A + B) - x
|
||||
if flat_pt:
|
||||
# PREREG_flat_order_point 2026-09-21: split where |f| ~
|
||||
# |x - r|^m puts the root, m read from the analogous pair
|
||||
regime_target = _order_split(A, FA, B, FB, analogy_m)
|
||||
step = regime_target - x
|
||||
else:
|
||||
step = 0.5 * (A + B) - x
|
||||
if step is None and pre_contra and x != x_prev:
|
||||
# PREREG_defect_contra_flat 2026-09-21 (contra). The bracket says
|
||||
# which way f must go between its ends; the last two points say which
|
||||
@@ -1197,6 +1224,15 @@ def pure_root(f, a, b, xtol, maxfev, similarity="ratio", scale="derived",
|
||||
w_before = abs(B - A)
|
||||
mid_now, lin_mid = 0.5 * (A + B), 0.5 * (FA + FB) # before the bracket moves
|
||||
fnew = g(x_new)
|
||||
if flat_pt and sticky_m is not None and regime_target is not None:
|
||||
# PREREG_flat_order_point: the exit judgment at whatever point the regime
|
||||
# aimed at - the line through the bracket ends predicts FA(1-t) + FB t there
|
||||
# (at the midpoint this is (FA+FB)/2, the rule below). A point the
|
||||
# safeguard moved is judged at its own t, the same line.
|
||||
t_at = (x_new - A) / (B - A)
|
||||
lin_mid = FA * (1.0 - t_at) + FB * t_at
|
||||
mid_now = x_new
|
||||
regime_target = None
|
||||
if ((prestep == "flatstickexit" or pre_flat != "none") and sticky_m is not None
|
||||
and x_new == mid_now
|
||||
and abs(fnew - lin_mid) < abs(fnew)):
|
||||
|
||||
+25
-3
@@ -266,6 +266,25 @@ def build_grid_defcontra(smoke):
|
||||
for gu in guards for ext in ("none", "pattern") for pre in DEFCONTRA_PRESTEPS]
|
||||
|
||||
|
||||
ORDERPT_PRESTEPS = (
|
||||
"none", "flatanalog", "flatanalogpt", "flatanalogmem", "flatanalogmempt",
|
||||
"defect+flatanalogmem", "defect+flatanalogmempt",
|
||||
"contra+flatanalogmem", "contra+flatanalogmempt")
|
||||
|
||||
|
||||
def build_grid_orderpt(smoke):
|
||||
"""PREREG_flat_order_point_2026-09-21: midpoint / point-from-order twins with the same
|
||||
entry, on the proposed rule with and without G2."""
|
||||
for pre in ORDERPT_PRESTEPS[1:]:
|
||||
x, _n, ok = pure_root(lambda t: t - 1.0, 0.0, 3.0, 1e-10, 100, similarity="ratio",
|
||||
scale="derived3", guard="project", prestep=pre)
|
||||
if not (ok and abs(x - 1.0) < 1e-8):
|
||||
raise SystemExit(f"prestep={pre} preflight FAILED: refusing to report zeros")
|
||||
guards = ("project", "credit") if smoke else GUARD_MODES
|
||||
return [("pure", "ratio", "derived3", gu, "x", pre, "recent", "distance", "none", ext)
|
||||
for gu in guards for ext in ("none", "pattern") for pre in ORDERPT_PRESTEPS]
|
||||
|
||||
|
||||
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)."""
|
||||
@@ -444,10 +463,12 @@ def main():
|
||||
analogmode = "--flatanalog" in sys.argv # entry by analogy with the run's own past
|
||||
memmode = "--flatanalogmem" in sys.argv # the analogy remembered as a property of the run
|
||||
dcmode = "--defcontra" in sys.argv # defect x contra x flat regime, composites
|
||||
ptmode = "--orderpt" in sys.argv # split at the point from the pair's order
|
||||
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_defcontra(smoke) if dcmode else
|
||||
specs = (build_grid_orderpt(smoke) if ptmode else
|
||||
build_grid_defcontra(smoke) if dcmode else
|
||||
build_grid_flat(smoke, ("flatanalogmem", "flatanalog")) if memmode else
|
||||
build_grid_flat(smoke, ("flatanalog", "flatstickexit")) if analogmode else
|
||||
build_grid_flat(smoke, ("flatjudge", "flatstickexit")) if judgemode else
|
||||
@@ -482,8 +503,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 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_defcontra" if dcmode else
|
||||
if 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_orderpt" if ptmode else
|
||||
"sweep_defcontra" if dcmode else
|
||||
"sweep_flatanalogmem" if memmode else
|
||||
"sweep_flatanalog" if analogmode else
|
||||
"sweep_flatjudge" if judgemode else
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -22,6 +22,7 @@ def load(p):
|
||||
def main():
|
||||
full = load("sweep_full.json")
|
||||
dc = load("sweep_defcontra.json")
|
||||
op = load("sweep_orderpt.json")
|
||||
rivals = {"Chandrupatla": full["chandrupatla"], "Brent": full["brent"],
|
||||
"TOMS748": full["toms748"]}
|
||||
ours = {
|
||||
@@ -30,6 +31,9 @@ def main():
|
||||
"+ G2 + analogy entry": dc["pure+extP+flatanalog.ratio.derived3.project"],
|
||||
"+ contra + remembered analogy": dc["contra+flatanalogmem.ratio.derived3.project"],
|
||||
"+ defect + remembered analogy": dc["defect+flatanalogmem.ratio.derived3.project"],
|
||||
"+ G2 + analogy + ORDER POINT": op["pure+extP+flatanalogpt.ratio.derived3.project"],
|
||||
"+ G2 + contra + rem. + ORDER PT": op["pure+extP+contra+flatanalogmempt.ratio.derived3.project"],
|
||||
"+ defect + rem. + ORDER POINT": op["defect+flatanalogmempt.ratio.derived3.project"],
|
||||
}
|
||||
print("TOTALS (evaluations of f, failures charged 200)")
|
||||
print(f" {'method':<32} {'APS':>6} {'CHA':>6} {'both':>6}")
|
||||
|
||||
@@ -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