Files
sim-numerics/order_high_precision.py
vvsandClaude Opus 5 862feaff86 Revision 1, step 1: one scoring criterion, the correct order, and the internal inconsistencies.
Point 1. The base step's order is Muller's 1.839, not 2: the derivative of the parabola through
the last three points errs by f'''/6 (x_n - x_{n-1})(x_n - x_{n-2}) = O(e_{n-1} e_{n-2}).
order_high_precision.py (3000 digits, to 1e-2900): 1.840 on cos x - x, e^x - 2, x^3 - x - 2,
sin x - 1/2; 2.000 only on x^2 - 2; two-point 1.618. The double-precision medians (2.000, 1.94)
are removed from the text.

Point 3. Every protocol number is re-scored under the criterion of section 9 - a sign change
within 1e-6 or f(x) == 0. rescore_uniform.py re-runs all 2779 distinct configurations of the 25
protocol sweeps on APS and CHA (the runs did not keep x) -> sweep_uniform.json, same row format;
it reproduces the APS/CHA lines of Table 10 exactly (built-in check). verify_article.py,
audit_similarity_places.py and the gap diagnostics read the re-scored data; the multiplier and
endowment measurements score by the same criterion. Table 7 (two criteria side by side) is gone;
7.3 now explains why the criterion is a sign change. Consequences stated in the text: the base
rule 2634 / 2357 against Chandrupatla 2595 / 1505 (1.5% behind on APS, no longer "level"); A'
2259 / 1074 (12.9% and 28.6% below Chandrupatla); the defect reading 2351 is second to the
shape reading 2337, not the record; the remembered analogy is level with no regime (2633 vs
2634) under this criterion; Table 9a's range is 19% to 425%.

Point 8. report_sweep.head_to_head counts every problem, failures charged (it counted only the
problems both methods solved, which is why Table 8 rows summed to 153 and 40). Family-level
comparisons added (A' vs Chandrupatla 8/1/6 of 15 and 7/0/2 of 9 families, not significant), and
an independence paragraph in section 9.

Point 11. sweep_itp.py: ITP (recommended constants and per-problem oracle) on all six corpora ->
Table 10; behind A' on every corpus, 0 bound violations.

Points 7, 9, 10 and the internals: the 2x bound is ours, not the rivals' promise; the law
predicts the group order only; "outside the proven bracket" explained (narrowest bracket of all
observed signs); 7.4's fun1 paragraph corrected (five costs under safe; the unguarded numbers
belong to fun1.4, fun1.5 and to fun3.1, fun5.1 separately); Table 1's last cell; the corpus-4
composition and odd multiplicities stated, also in the abstract.

build_tex.py: pdflatex output decoded with errors="replace" (a UTF-8 character cut by TeX's log
wrap crashed the build). Table 10 column widths rebalanced.

Checks: verify_article on the server 500 OK / 0 BAD (467 existing with the new values, 33 new);
regression x2 on the server 1232 passed, 0 failed; PDF 28 pages, 0 errors, 0 undefined, 0 overfull.

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

73 lines
3.0 KiB
Python

"""Revision point 1 (2026-09-22): the order of the base rule's step, measured where it can be.
Near a simple root the base rule's step is Newton's step with the derivative of the parabola
through the last three points (tent similarity, step shorter than the distance to the far end,
projection inactive). The error of that derivative is f'''/6 (x_n - x_{n-1})(x_n - x_{n-2}),
i.e. O(e_{n-1} e_{n-2}), so e_{n+1} ~ e_n e_{n-1} e_{n-2} and the order is the root of
p^3 = p^2 + p + 1, 1.839 - Muller's order. On a quadratic f the parabola is exact and the
order is Newton's 2. In double precision a run has 3-4 superlinear steps before the error
reaches the tolerance, too few to tell 1.84 from 2; here the iteration is carried to 10^-2900
in 3000-digit arithmetic and the computational order e_{n+1} ~ e_n^p is read per step.
The two-point (secant) scale is measured the same way for reference.
python -u order_high_precision.py -> results_order_high_precision.txt (stdout)
"""
from __future__ import annotations
import mpmath as mp
mp.mp.dps = 3000
FLOOR = mp.mpf(10) ** -2900
def iterate(f, x0, x1, x2, points, steps=60):
xs = [mp.mpf(x0), mp.mpf(x1), mp.mpf(x2)]
for _ in range(steps):
a, b, c = xs[-3], xs[-2], xs[-1]
fb, fc = f(b), f(c)
d12 = (fc - fb) / (c - b)
if points == 3:
d01 = (fb - f(a)) / (b - a)
slope = d12 + (d12 - d01) / (c - a) * (c - b)
else:
slope = d12
xs.append(c - fc / slope)
if xs[-1] == c:
break
return xs
def orders(xs, root):
"""Computational order per step, from errors above the precision floor only."""
e = [abs(x - root) for x in xs]
e = [v for v in e if v > FLOOR]
return [mp.log(e[i + 1]) / mp.log(e[i]) for i in range(3, len(e) - 1)]
CASES = (
("cos x - x", lambda x: mp.cos(x) - x, (0.5, 0.9, 0.7), lambda: mp.findroot(lambda x: mp.cos(x) - x, 0.74)),
("exp(x) - 2", lambda x: mp.exp(x) - 2, (0.5, 1.0, 0.8), lambda: mp.log(2)),
("x^3 - x - 2", lambda x: x ** 3 - x - 2, (1.3, 1.7, 1.5), lambda: mp.findroot(lambda x: x ** 3 - x - 2, 1.52)),
("sin x - 1/2", lambda x: mp.sin(x) - mp.mpf(1) / 2, (0.3, 0.7, 0.5), lambda: mp.asin(mp.mpf(1) / 2)),
("x^2 - 2", lambda x: x ** 2 - 2, (1.2, 1.6, 1.3), lambda: mp.sqrt(2)),
)
def main():
muller = mp.findroot(lambda p: p ** 3 - p ** 2 - p - 1, 1.8)
golden = (1 + mp.sqrt(5)) / 2
print(f"Muller order (root of p^3 = p^2 + p + 1): {float(muller):.4f}")
print(f"secant order (golden ratio): {float(golden):.4f}")
print(f"{'function':<14}{'three-point: last orders':<40}{'two-point: last orders'}")
for name, f, (a, b, c), root in CASES:
r = root()
o3 = orders(iterate(f, a, b, c, 3), r)
o2 = orders(iterate(f, a, b, c, 2), r)
print(f"{name:<14}{' '.join(f'{float(v):.3f}' for v in o3[-3:]):<40}"
f"{' '.join(f'{float(v):.3f}' for v in o2[-3:])}")
print("order high precision done")
if __name__ == "__main__":
main()