Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886b3f4244 | ||
|
|
ce5b42f284 | ||
|
|
2bc57fcc83 | ||
|
|
fc91d3b8aa | ||
|
|
1c63b829d9 | ||
|
|
9c1638af07 | ||
|
|
5c0550a0de | ||
|
|
1eb2c1664f | ||
|
|
aa304cd262 | ||
|
|
6a1c264910 |
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,8 @@
|
||||
sim-numerics — Root Finding by Similarity and Analogy
|
||||
Copyright 2026 Valeri Sitnikov
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
||||
|
||||
This product includes the proposed bracketing method A′, its reference implementation (simroot),
|
||||
the compiled library simbracket, the benchmark harness, the problem corpora and every results file
|
||||
behind the paper.
|
||||
@@ -0,0 +1,21 @@
|
||||
# POST HOC — Лагуанель в Chandrupatla, только ветвь m ≥ 2
|
||||
|
||||
Записано 2026-09-22 **после** прогона `PREREG_estimated_transform_2026-09-22.md` (К3) и до этого
|
||||
прогона. Доработка 3, п. 5: вариант К3-Л с двумя ветвями фиксирует дробный порядок на 115
|
||||
из 154 простых корней APS (точки Chandrupatla лежат по разные стороны корня, θ < 0) и вырождается в
|
||||
бисекцию; «очевидная поправка — ограничение ветвью m ≥ 2 — должна быть запущена, с пометкой post hoc».
|
||||
|
||||
Это **не** запись до прогона: вариант выбран, зная исход К3-Л. В статье он помечается как post hoc и
|
||||
не входит ни в какое правило вывода из PREREG_estimated_transform.
|
||||
|
||||
## Определение
|
||||
|
||||
К3-Л2: всё как в К3-Л (`simroot/transformed.py`, оценщик Лагуанеля по трём последним вычислениям,
|
||||
гистерезис без сброса), кроме одного: m̂ заменяется прочитанным m **только при m ≥ 2** (включая
|
||||
m = ∞ при θ ≥ 1); ветвь 0 < m ≤ ⅔ не используется.
|
||||
|
||||
## Что сообщается
|
||||
|
||||
Те же числа, что для К3 в табл. 12: корпус 4, шесть корпусов, 148 кратных/дробных корней, APS; и
|
||||
сколько простых корней APS заканчивают прогон с m̂ ≠ 1. Один прогон; определение после него не
|
||||
меняется.
|
||||
@@ -1,82 +1,71 @@
|
||||
# sim-numerics — similarity as a step rule for root finding
|
||||
# sim-numerics — similarity and analogy as step rules for root finding
|
||||
|
||||
Artifact for the paper `article/sim_numerics.tex`. Every claim in the paper is
|
||||
produced by one of the scripts below; nothing in the text is transcribed by
|
||||
hand, and `verify_article.py` checks all 72 stated numbers against the run
|
||||
data as part of the test suite.
|
||||
A bracketing root finder derived from a similarity function, with a decision layer that recognises
|
||||
multiple and fractional roots by analogy, and a worst case of twice bisection plus three evaluations
|
||||
that holds whatever proposes the step.
|
||||
|
||||
Everything here is released under the Apache License 2.0; copyright Valeri Sitnikov (`NOTICE`).
|
||||
Archive of record, with the paper, the data and the full history:
|
||||
[10.5281/zenodo.22894336](https://doi.org/10.5281/zenodo.22894336) (version 1.0.0:
|
||||
[10.5281/zenodo.22894337](https://doi.org/10.5281/zenodo.22894337)).
|
||||
|
||||
## Using the method
|
||||
|
||||
`lib/` builds `simbracket`, the method as a compiled library (Cython, Python 3.10 or later, wheels for
|
||||
Linux and Windows in the archive). It agrees with the reference implementation bit for bit, point and
|
||||
evaluation count, on all 868 problems of the six corpora.
|
||||
|
||||
```python
|
||||
from simbracket import find_root, evaluation_bound
|
||||
|
||||
x, nfev, converged = find_root(f, a, b, xtol=1e-12, maxfev=200)
|
||||
# f(a) and f(b) of opposite signs; stops when the bracket is no wider than xtol or f(x) == 0;
|
||||
# never more than evaluation_bound(a, b, xtol) = 2*ceil(log2(|b-a|/xtol)) + 3 evaluations
|
||||
```
|
||||
|
||||
From source instead: `simroot.pure.pure_root` with the configuration named `APRIME` in
|
||||
`sweep_full.py`.
|
||||
|
||||
## What it costs
|
||||
|
||||
On the 240 problems of corpus 4, fixed before the method's code was frozen, the method needs 3656
|
||||
evaluations. Chandrupatla's method needs 5717 there, ModAB 5535, Brent 8267 and TOMS 748 8084. It is
|
||||
the cheapest of those methods on 77% of the problems, and on 88% of the multiple and fractional
|
||||
roots.
|
||||
|
||||
## Reproducing
|
||||
|
||||
Use one platform for all numbers. The test functions call `libm`, whose last digit differs between
|
||||
platforms, and the same SciPy version scores 2635 for TOMS 748 on Windows against 2636 on Linux for
|
||||
the same set. The published numbers are from Linux (Ubuntu 24.04, Python 3.12.3).
|
||||
|
||||
```
|
||||
python -m pytest tests/ -q # 490 tests
|
||||
python sweep_full.py # the full grid, writes sweep_full.json
|
||||
python verify_article.py # every paper number vs the data
|
||||
python -m pytest tests -q # 1240 tests
|
||||
python -u verify_article.py # 548 numbers of the paper against the run data
|
||||
```
|
||||
|
||||
Heavy runs go to a Linux machine (Python 3.12, run detached with a log,
|
||||
`setsid nohup ... > sweep.log 2>&1`). **Use one platform for all numbers**: the
|
||||
test functions call `libm`, whose last digit differs between Windows and Linux,
|
||||
and the same SciPy version scores 2819 for TOMS 748 on Windows against 2820 on
|
||||
Linux for the same set. The paper's numbers are the Linux ones.
|
||||
|
||||
## Where each claim comes from
|
||||
|
||||
| Paper | Claim | Script |
|
||||
|---|---|---|
|
||||
| Prop. 1 | the two-point similarity step **is** regula falsi | `tests/test_simroot.py::test_the_pure_two_point_similarity_step_is_regula_falsi_exactly` |
|
||||
| Prop. 2, Table 1 | contraction law, predicted 0.1716 vs measured 0.1716 | `stage0c_why_pure_fails.py` |
|
||||
| Cor. 1 | a chosen similarity fails on 5–8 of 8 problems | `stage0b_pure_similarity.py` |
|
||||
| Cor. 2 | faster similarity is not better (`sqrt`, `cbrt`) | `stage0d_derived_similarity.py` |
|
||||
| Cor. 3 | derived scale ⇒ the step is \|f\|/\|f'\| ⇒ superlinear | `stage0d_derived_similarity.py`, `stage0e_guard_cost.py` |
|
||||
| §3 safeguards | bracket vs step vs both, and what each costs | `stage2_guard_modes.py`, `stage3_bound_check.py` |
|
||||
| §3 order | 1.584 (2-point) vs 1.944 (3-point) | `stage5_three_point.py` |
|
||||
| §3.1 | project vs replace; the guarantee costs nothing | `stage6_projection.py` |
|
||||
| §3.1 | the projection invariant, instrumented per step | `stage6b_invariant.py` |
|
||||
| §4 fairness | ITP is not handicapped; κ₁ and n₀ sweeps | `stage2b_itp_fairness.py` |
|
||||
| Tables 2, 3 | the 154-configuration ranking on both sets | `sweep_full.py` → `report_sweep.py` |
|
||||
| Table 4 | the law across the whole grid | `sweep_full.py` → `report_sweep.py` |
|
||||
| §6 | approach vs endgame, order, boldness, step quality | `stage4_why.py` |
|
||||
| §7.1 | the prototype-aggregation form loses 0/6/147 | `bench_full.py` (`SIM.pair2d.*`) |
|
||||
| §7.2 | the 2× bound and high order are incompatible | `stage5_three_point.py`, `tests/test_three_point.py` |
|
||||
| §7.4 | the symmetric ratio similarity degenerates | `simroot/pure.py` (`PURE_SIMS["ratio"]` docstring), `stage0d` |
|
||||
Any table of the paper can be recomputed from scratch with its sweep script; each script's docstring
|
||||
names the table it produces. Heavy runs belong on a Linux machine, detached, with a log.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
simroot/pure.py the method: one similarity, one step rule, three guards
|
||||
simroot/baselines.py bisection, 4 false-position variants, Ridders, Brent,
|
||||
TOMS 748 (SciPy), ITP (own, validated against its theorem)
|
||||
simroot/sim.py the prototype-aggregation form — a NEGATIVE result, kept
|
||||
because the paper reports it
|
||||
stage0*..stage5* the derivation, in the order it was actually established
|
||||
bench_full.py 17 methods on both sets
|
||||
sweep_full.py 9 similarities x 4 scales x 4 guards + 10 baselines
|
||||
report_sweep.py reads sweep_full.json, produces the paper's tables
|
||||
verify_article.py asserts the paper against the data (72 checks)
|
||||
tests/ 490 tests; every bug found in audit is pinned here
|
||||
simroot/pure.py the method: the similarity step, the decision layer, the projection
|
||||
simroot/baselines.py bisection, the false-position family, Ridders, Brent, TOMS 748, ITP
|
||||
lib/ the source of the compiled library simbracket
|
||||
corpus_*.py the problem corpora, as code
|
||||
sweep_*.py the runs; each writes its results file
|
||||
verify_article.py every number stated in the paper, against the data
|
||||
article/ the paper
|
||||
PREREG_*.md POSTHOC_*.md what was recorded before each run, and what after
|
||||
FINDINGS_*.md what the diagnoses found
|
||||
tests/ 1240 tests; every bug found in an audit is pinned here
|
||||
```
|
||||
|
||||
## Negative results, so they are not reopened
|
||||
## What was refuted
|
||||
|
||||
1. Similarity normalised by the two bracket ends **is** regula falsi, identically.
|
||||
2. A faster-changing similarity is not better; what matters is the slope of
|
||||
`1 - S` at zero matching the problem, and only the data supplies it.
|
||||
3. Prototype-pair aggregation with softmax over the whole memory loses to the
|
||||
simplest form: 0 wins / 6 ties / 147 losses against Brent on APS.
|
||||
4. "Our safeguard fires less often" — refuted: Brent discards 53% of its
|
||||
interpolations on the set it wins, 34% on the set it loses.
|
||||
5. "Our steps are bolder" — refuted: on Chandrupatla Brent is bolder (56.3%
|
||||
against 41.8%) and still loses. The mechanism is step *quality*: median
|
||||
bracket removed 0.275 against 0.058.
|
||||
6. Every safeguard that REPLACES the computed step with a midpoint destroys the
|
||||
order: with the three-point scale, order falls from 1.94 to 1.00 and the APS
|
||||
total from 2806 to 7260. **Resolved** by projecting the step onto the
|
||||
admissible interval instead (`guard="project"`), which costs nothing on APS
|
||||
(2806 either way) and gains on Chandrupatla (40/45 at 3220 against 35/45 at
|
||||
4104 unguarded).
|
||||
7. Zero slack in the projection is degenerate: a worst case of exactly bisection
|
||||
demands a halving at every step, leaving the projection no freedom.
|
||||
8. Writing the projection as a radius around the midpoint instead of a clamp
|
||||
loses the invariant to cancellation — a relative 8.9e-5 overshoot on eleven
|
||||
Chandrupatla problems.
|
||||
```
|
||||
The archive keeps eleven negative results in the form in which they were written, among them: a
|
||||
similarity normalised by the two bracket ends is regula falsi identically; a faster-changing
|
||||
similarity is not better; every safeguard that *replaces* the computed step with a midpoint destroys
|
||||
the order, which is why the step is projected instead; and the phase detector whose derivation is
|
||||
sound and whose estimator is not. They are kept so that they are not reopened.
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
"""Revision 2: points 2-7 into article/sim_numerics.md.
|
||||
|
||||
2 'pre-registered' -> 'recorded in advance'; Appendix D says the order is attested only by the
|
||||
author's git history
|
||||
3 why Dekker, Illinois and false position show the same totals under both criteria
|
||||
4 exact-zero stops in Table 11, per method
|
||||
5 control K3 (PREREG_estimated_transform): Table 12 and its paragraph; 6.6, conclusion, future work
|
||||
6 Algorithms 1-2: lo/hi, the return on a stall, L_x and L_f, an empty memory, the step pattern
|
||||
as a formula, the O(n^2) search
|
||||
7 Table 3's two missing bracket-scaled rows; dashes in Table 5; the abstract's last sentence
|
||||
Exact anchors, each found exactly once, or nothing is written.
|
||||
|
||||
python -u apply_article_revision2.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
PATH = "article/sim_numerics.md"
|
||||
R = []
|
||||
|
||||
|
||||
def E(old, new):
|
||||
R.append((old, new))
|
||||
|
||||
|
||||
# ---- point 2
|
||||
E("The code, the corpora and the pre-registrations are released", "The code, the corpora and the documents that recorded each test before its run are released")
|
||||
E("Every rule below was pre-registered with a stop rule (Appendix D);", "Every rule below was recorded, with its criteria and stop rule, before its code and run (Appendix D);")
|
||||
E("because the pre-registered rule removes only a component", "because the rule recorded in advance removes only a component")
|
||||
E("Pre-registration protects each decision but not the chain:", "Recording each decision in advance protects the decision but not the chain:")
|
||||
E("by every pre-registered criterion (per problem", "by every criterion recorded in advance (per problem")
|
||||
E("Both were pre-registered, with what the paper would say under every outcome, before the run", "Both were recorded, with what the paper would say under every outcome, before the run")
|
||||
E("as the pre-registered criterion required.", "as the criterion recorded in advance required.")
|
||||
E("the pre-registrations with the commits of Appendix D;", "the advance records with the commits of Appendix D;")
|
||||
E("and it passed every pre-registered criterion there.", "and it passed every criterion recorded for it there.")
|
||||
E("was rejected by its own pre-registration,", "was rejected by its own advance record,")
|
||||
E("## Appendix D. Pre-registrations and the frozen code", "## Appendix D. Advance records and the frozen code")
|
||||
E("The code of A′ was committed (`8027d7f`)",
|
||||
"We call these documents advance records, not pre-registrations: they live in the author's repository, and their order relative to the runs is attested only by the author's git history, whose timestamps the author sets; no external registry was used. A deposit with an external timestamp (Zenodo, OSF) before a run would remove that limitation for future tests. The code of A′ was committed (`8027d7f`)")
|
||||
E("**Table D1.** Pre-registrations, in the order they were written.", "**Table D1.** Advance records, in the order they were written.")
|
||||
E("| pre-registration | commit | results file | commit | order |", "| advance record | commit | results file | commit | order |")
|
||||
|
||||
# ---- point 3
|
||||
E("and 79/5/70 against Brent.",
|
||||
"and 79/5/70 against Brent. Dekker, Illinois and false position fail `aps.13.00` under either criterion and so keep their totals: they spend the whole budget without converging, Dekker and Illinois stalled on one side of the zero where $|f|<10^{-62}$ but $f$ does not change sign within $10^{-6}$.")
|
||||
|
||||
# ---- point 4
|
||||
E("With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′.",
|
||||
"With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. Every method, A′ included, stops on an exact zero of the function it evaluates, and on the pure powers of the Chandrupatla set $g$ is exactly linear, so the secant lands on the root: 15 of Brent's 20 runs and 4 of Chandrupatla's end that way there (A′: 2). On new corpus 1 no transformed run ends on a zero, and the transformation is still 3.4 times cheaper.")
|
||||
|
||||
# ---- point 5: K3
|
||||
K3 = """
|
||||
|
||||
**The multiplicity estimated during the run.** Between A′ and the oracle lies the natural classical method: Chandrupatla's interpolation on $g=\\operatorname{sign}(f)|f|^{1/\\hat m}$ with $\\hat m$ estimated during the run. Our implementation of Chandrupatla's method (identical to the library on all 199 problems, and to itself when $\\hat m\\equiv1$) keeps the true $f$ at its three points and reads $G(v)=\\operatorname{sign}(v)|v|^{1/\\hat m}$ only in the acceptance band and the interpolation; $\\hat m$ starts at 1 and takes an order read from the last three evaluations whenever that order lies on a branch of §6.1 ($m\\ge2$ or $0<m\\le\\tfrac23$), without reset — the hysteresis of the controls above. The order is read either by Lagouanelle's estimate or by A′'s own analogy (recorded in advance, `sweep_estimated.py`):
|
||||
|
||||
**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set.
|
||||
|
||||
| method | corpus 4 | six corpora | multiple/fractional (148) | APS |
|
||||
|---|---|---|---|---|
|
||||
| **A′** | **3656** | **13032** | 4042 | **2259** |
|
||||
| Chandrupatla on $g$, $\\hat m$ by analogy | 3806 | 15733 | 2809 | 3453 |
|
||||
| Chandrupatla on $g$, $\\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |
|
||||
| Chandrupatla on $g$, $m^*$ known (Table 11) | — | — | **1355** | — |
|
||||
| Chandrupatla on $f$ | 5717 | 16481 | 7011 | 2595 |
|
||||
|
||||
A′ is ahead of both estimated forms on corpus 4, in total and problem by problem (against the analogy form 126/38/76, $p=5\\cdot10^{-4}$), and over the six corpora. The two estimators behave differently in this frame. Lagouanelle's reads the parabola through Chandrupatla's points, which alternate sides of the root; there it reports a fractional order on 115 of the 154 simple roots of the canonical set, holds it, and turns the method into little more than bisection. (A variant restricted to the branch $m\\ge2$ was not among the controls recorded.) The analogy's order is the better one here too, and on the multiple and fractional roots it does better inside Chandrupatla's interpolation than inside A′'s split: it closes 59%, 58% and 31% of the gap from A′ to the oracle on the Chandrupatla set, corpus 1 and corpus 4 (322 against 654, 721 against 1229, 1766 against 2159). It pays on simple roots, where it has no exit to take a false reading back (3453 against 2595 on the canonical set). So the decision layer of A′ earns its place against the classical method with an estimated order as well; and the split (7), not the order estimate, is where A′ leaves most to the transformation."""
|
||||
E("large, and the clearest direction for improving the method.", "large, and the clearest direction for improving the method." + K3)
|
||||
E("§7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance.",
|
||||
"§7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance or estimated during the run.")
|
||||
E("Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place;",
|
||||
"Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and Chandrupatla's method on the transformed function with the order estimated during the run;")
|
||||
E("the order read from the analogous pair, or its use in the split, loses most of what the transformation could deliver.",
|
||||
"closing that gap is open.")
|
||||
|
||||
# ---- point 6: the algorithms
|
||||
E(" xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)",
|
||||
" lo, hi <- min(A,B), max(A,B)\n xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)")
|
||||
E(" if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)",
|
||||
" if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)\n (if the midpoint too was evaluated: return it)")
|
||||
E(""" # order (6) of the analogous pair: the past configuration
|
||||
# nearest to c (Euclidean in (xi, phi)), if nearer than the
|
||||
# line phi = xi; inf if the pair shows L_f < 1 <= L_x; else none
|
||||
m <- order of the analogous pair""",
|
||||
""" # order (6) of the analogous pair. q <- the configuration in
|
||||
# configs nearest to c (Euclidean in (xi, phi)); no m if c or
|
||||
# configs is empty or q is not nearer than the line phi = xi.
|
||||
# L_x <- |x-xp| / q.dx, L_f <- |fx-fp| / q.df
|
||||
# m <- inf if L_f < 1 <= L_x (translation), else ln L_f / ln L_x
|
||||
m <- order of the analogous pair""")
|
||||
E(""" # step pattern: the lag 2 .. half the history of highest
|
||||
# mean similarity of successive length ratios has mean > 1/2,
|
||||
# and step and x - xp point the same way
|
||||
if the pattern repeats:""",
|
||||
""" # step pattern: q_j <- |d_j|/|d_(j-1)| over successive nonzero
|
||||
# moves d (k of them); rho(u,v) <- min(u,v)/max(u,v); repeats iff
|
||||
# max over p = 2..floor(k/2) of mean_j rho(q_j, q_(j-p)) > 1/2
|
||||
if repeats and step, x - xp point the same way:""")
|
||||
E(" xn <- clamp(xn, hi - allow, lo + allow) # projection (3)",
|
||||
" lo, hi <- min(A,B), max(A,B)\n xn <- clamp(xn, hi - allow, lo + allow) # projection (3)")
|
||||
E(" xn <- mid; if mid in {x, xp}: stop", " xn <- mid; if mid in {x, xp}: return mid")
|
||||
E("implement exactly this and agree bit for bit.",
|
||||
"implement exactly this and agree bit for bit. The nearest-configuration search runs over the run's memory: $O(n)$ per step, $O(n^2)$ per run of $n$ evaluations ($n\\le200$ here), arithmetic that matters only when $f$ is cheap (Appendix B).")
|
||||
|
||||
# ---- point 7
|
||||
E("| 3 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |",
|
||||
"| 3 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |\n| 4 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, bracket guard | no | 45/45 | 1848 | 0 |")
|
||||
E("| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |",
|
||||
"| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |\n| 6 | similarity, $e^{-\\lvert z\\rvert}$, bracket scale, earned projection | no | 45/45 | 1952 | 0 |")
|
||||
E("| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | | |", "| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | — | — |")
|
||||
E("| base rule (§3) | 2634 | 2357 | 4991 | | |", "| base rule (§3) | 2634 | 2357 | 4991 | — | — |")
|
||||
E("We replace bisection's midpoint rule by a similarity rule — the step grows with how dissimilar $f(x)$ is to the target 0, under a similarity $S$ with $S(0)=1$ — and derive",
|
||||
"We replace bisection's midpoint rule by a similarity rule — the step grows with the dissimilarity of $f(x)$ to 0 under a similarity $S$ — and derive")
|
||||
E("With the multiplicity known, the classical transformation $\\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots.",
|
||||
"With the multiplicity known, the classical transformation $\\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots; what A′ adds is an estimate of the order made without knowing it, within a guarantee of twice bisection.")
|
||||
|
||||
|
||||
def main():
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
bad = [o[:80] for o, _ in R if src.count(o) != 1]
|
||||
if bad:
|
||||
for b in bad:
|
||||
print("ANCHOR NOT FOUND EXACTLY ONCE:", repr(b))
|
||||
raise SystemExit(f"{len(bad)} anchors failed; nothing written")
|
||||
for o, n in R:
|
||||
src = src.replace(o, n)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
ab = src.split("## Abstract\n\n")[1].split("\n\n---\n")[0]
|
||||
code = src.split("**Algorithm 2 (A′).**")[1].split("```")[1]
|
||||
print(f"applied {len(R)}; abstract {len(ab.split())} words; longest Algorithm 2 line "
|
||||
f"{max(len(l) for l in code.split(chr(10)))}; 'pre-regist' left: {src.lower().count('pre-regist')}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Revision 3 into article/sim_numerics.md:
|
||||
4 the exact-zero stop stated in section 4 (it holds for every method on every corpus)
|
||||
5 Table 12: the post hoc Lagouanelle variant on the branch m >= 2 (marked), the missing exit of
|
||||
the controls in the caption, and the conclusion from Table 12 restated in 7.1, 6.6 and 8
|
||||
Exact anchors, each found exactly once, or nothing is written.
|
||||
|
||||
python -u apply_article_revision3.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
PATH = "article/sim_numerics.md"
|
||||
R = []
|
||||
|
||||
|
||||
def E(old, new):
|
||||
R.append((old, new))
|
||||
|
||||
|
||||
E("$x$-tolerance $10^{-12}$; budget 200 evaluations.",
|
||||
"$x$-tolerance $10^{-12}$; budget 200 evaluations. Every method, ours included, stops when its bracket is no wider than $\\varepsilon_x$ or when it evaluates an exact zero of the function it works on; none stops on a small $|f|$.")
|
||||
E("**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set.",
|
||||
"**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set. The estimated forms have no exit: an order once taken is held to the end of the run. A′ leaves its regime by the exit of §6.2.")
|
||||
E("| Chandrupatla on $g$, $\\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |",
|
||||
"| Chandrupatla on $g$, $\\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |\n| the same, branch $m\\ge2$ only (post hoc) | 5568 | 18372 | 6540 | 2960 |")
|
||||
E("(A variant restricted to the branch $m\\ge2$ was not among the controls recorded.)",
|
||||
"Restricted after the fact to the branch $m\\ge2$ (post hoc, `POSTHOC_lag_branch_2026-09-22.md`), it no longer breaks, but in this frame it hardly sees a multiple root either: 6540 on the 148 multiple and fractional roots against 7011 for Chandrupatla on $f$, and 5568 on corpus 4, with A′ ahead 178/34/28.")
|
||||
E("So the decision layer of A′ earns its place against the classical method with an estimated order as well; and the split (7), not the order estimate, is where A′ leaves most to the transformation.",
|
||||
"Two conclusions follow. First, the order read by analogy transfers to the classical frame and works better there than in A′'s own split: on the multiple and fractional roots Chandrupatla's interpolation with that order beats A′ itself (2809 against 4042). Second, A′'s decision layer as a whole — the detector together with its exit — earns its place: without an exit the transferred detector loses more on simple roots than it gains on multiple ones, and A′ stays ahead on corpus 4 and over the six corpora.")
|
||||
E("§7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance or estimated during the run.",
|
||||
"§7.1 tests this against the detectors a reader would try first and against the classical transformation with the multiplicity known or estimated, and the outcome is sharper than the claim: the order read by analogy transfers to the classical frame and works better there than in A′'s own split, while A′'s exit is what keeps simple roots cheap.")
|
||||
E("Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and Chandrupatla's method on the transformed function with the order estimated during the run;",
|
||||
"Its detector, the order read by analogy, beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and it transfers: inside Chandrupatla's interpolation on the transformed function it does better on multiple roots than A′'s own split, while only A′'s exit keeps simple roots cheap;")
|
||||
|
||||
|
||||
def main():
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
bad = [o[:80] for o, _ in R if src.count(o) != 1]
|
||||
if bad:
|
||||
for b in bad:
|
||||
print("ANCHOR NOT FOUND EXACTLY ONCE:", repr(b))
|
||||
raise SystemExit(f"{len(bad)} anchors failed; nothing written")
|
||||
for o, n in R:
|
||||
src = src.replace(o, n)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
print(f"applied {len(R)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Revision 2 follow-up: the step-pattern comment of Algorithm 2 within 72 characters a line, and the
|
||||
abstract back under 250 words (same claims).
|
||||
|
||||
python -u apply_revision2_fit.py
|
||||
"""
|
||||
PATH = "article/sim_numerics.md"
|
||||
R = [
|
||||
(""" # step pattern: q_j <- |d_j|/|d_(j-1)| over successive nonzero
|
||||
# moves d (k of them); rho(u,v) <- min(u,v)/max(u,v); repeats iff
|
||||
# max over p = 2..floor(k/2) of mean_j rho(q_j, q_(j-p)) > 1/2""",
|
||||
""" # step pattern: q_j <- |d_j|/|d_(j-1)| over the
|
||||
# successive nonzero moves d (k ratios);
|
||||
# rho(u,v) <- min(u,v)/max(u,v); repeats iff
|
||||
# max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2"""),
|
||||
("The derivation fixes a base rule before any benchmark is consulted:", "It fixes, before any benchmark, a base rule:"),
|
||||
("This decision layer, about ten discrete rules selected on two development sets, gives the method A′.",
|
||||
"This decision layer — about ten discrete rules selected on two development sets — gives A′."),
|
||||
("what A′ adds is an estimate of the order made without knowing it, within a guarantee of twice bisection.",
|
||||
"A′ adds an estimate of the order, within a guarantee of twice bisection."),
|
||||
]
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
for o, n in R:
|
||||
assert src.count(o) == 1, o[:60]
|
||||
src = src.replace(o, n)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
ab = src.split("## Abstract\n\n")[1].split("\n\n---\n")[0]
|
||||
code = src.split("**Algorithm 2 (A′).**")[1].split("```")[1]
|
||||
print(f"abstract {len(ab.split())} words; longest Algorithm 2 line {max(len(l) for l in code.split(chr(10)))}")
|
||||
@@ -0,0 +1,106 @@
|
||||
"""verify_article.py checks the numbers the second revision added: Table 12 and its paragraph
|
||||
(sweep_estimated.json), the exact-zero stops of Table 11 (diag_revision2.point4, fresh), the three
|
||||
unchanged rows of Table 2 (fresh runs on aps.13.00), the two new rows of Table 3, and the fractional
|
||||
readings of Lagouanelle's estimate on the canonical set (fresh). Adds verify_revision2() and its call.
|
||||
|
||||
python -u apply_verify_revision2.py
|
||||
"""
|
||||
PATH = "verify_article.py"
|
||||
FUNC = '''
|
||||
|
||||
def verify_revision2():
|
||||
"""Revision 2 (points 3, 4, 5, 7)."""
|
||||
import math
|
||||
print("\\nRevision 2:")
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
|
||||
def sign_p(w, l):
|
||||
k, n = min(w, l), w + l
|
||||
return min(1.0, 2.0 * sum(math.comb(n, i) for i in range(k + 1)) / 2.0 ** n)
|
||||
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
K = _load("sweep_estimated.json")
|
||||
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
|
||||
ap, ch = dict(seen["Aprime"]), dict(seen["chandrupatla"])
|
||||
ap.update(four["Aprime"])
|
||||
ch.update(four["chandrupatla"])
|
||||
K1 = _load("sweep_controls.json")["K1"]
|
||||
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
|
||||
|
||||
def group(r):
|
||||
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
rows = {"A'": ap, "K3A": K["k3_analogy"], "K3L": K["k3_lag"], "Ch(f)": ch}
|
||||
want = {"A'": (3656, 13032, 4042, 2259), "K3A": (3806, 15733, 2809, 3453),
|
||||
"K3L": (7526, 30991, 6041, 7215), "Ch(f)": (5717, 16481, 7011, 2595)}
|
||||
for k, r in rows.items():
|
||||
check(f"Table 12 {k}", (tot(r["D"]), sum(tot(r[s]) for s in sets), group(r), tot(r["APS"])), want[k])
|
||||
oracle = sum(tot(K1[s]["chandrupatla_g"], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]))
|
||||
for s in ("CHA", "NEW", "D"))
|
||||
check("Table 12 oracle row (Table 11 sum)", oracle, 1355)
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
check("A' vs Chandrupatla-on-g with the analogy order, corpus 4", (w, len(ps) - w - l, l), (126, 38, 76))
|
||||
check("its p (1 digit)", f"{sign_p(w, l):.1g}", "0.0005")
|
||||
shares = []
|
||||
for s in ("CHA", "NEW", "D"):
|
||||
keep = lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]) # noqa: E731
|
||||
a_, k_, o_ = tot(ap[s], keep), tot(K["k3_analogy"][s], keep), tot(K1[s]["chandrupatla_g"], keep)
|
||||
shares.append((k_, a_, round(100 * (a_ - k_) / (a_ - o_))))
|
||||
check("share of the A'-to-oracle gap closed by the analogy order", shares,
|
||||
[(322, 654, 59), (721, 1229, 58), (1766, 2159, 31)])
|
||||
check("K3 bound violations", sum(v[2] for k in K for s in sets for v in K[k][s].values()), 0)
|
||||
# Lagouanelle's fractional readings on the simple roots of the canonical set (fresh)
|
||||
from simroot.transformed import chandrupatla_transformed
|
||||
from sweep_full import load_problems
|
||||
frac = 0
|
||||
for s, pid, f, a, b, _r in load_problems():
|
||||
if s != "APS":
|
||||
continue
|
||||
st = {}
|
||||
chandrupatla_transformed(f, a, b, 1e-12, 200, estimator="lag", stats=st)
|
||||
m = st.get("m_hat", 1.0)
|
||||
frac += (0.0 < m <= 2.0 / 3.0)
|
||||
check("Lagouanelle holds a fractional order on simple APS roots", frac, 115)
|
||||
# point 4: exact-zero stops (fresh)
|
||||
import contextlib
|
||||
import io
|
||||
import diag_revision2
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
z = diag_revision2.point4()
|
||||
check("exact-zero stops on CHA: Brent(g), Chandrupatla(g), A'",
|
||||
(z["CHA"]["brent_g"][1], z["CHA"]["chandrupatla_g"][1], z["CHA"]["Aprime"][1]), (15, 4, 2))
|
||||
check("exact-zero stops of the transformed runs on corpus 1",
|
||||
(z["NEW"]["chandrupatla_g"][1], z["NEW"]["brent_g"][1]), (0, 0))
|
||||
check("corpus 1: transformation 3.4 times cheaper", round(1229 / 358, 1), 3.4)
|
||||
# point 3: the three unchanged rows of Table 2 (fresh)
|
||||
from corpus_roots_jl import solved
|
||||
from sweep_full import make_method
|
||||
f, a, b = next((f, a, b) for s, pid, f, a, b, _r in load_problems() if pid == "aps.13.00")
|
||||
got = []
|
||||
for name in ("dekker", "illinois", "regula_falsi"):
|
||||
x, n, conv = make_method(("base", name))(f, a, b, 1e-12, 200)
|
||||
got.append((name, int(n), bool(conv), bool(solved(f, float(x)))))
|
||||
check("aps.13.00: Dekker, Illinois, false position spend the budget unsolved",
|
||||
got, [("dekker", 200, False, False), ("illinois", 200, False, False),
|
||||
("regula_falsi", 200, False, False)])
|
||||
small = [abs(float(f(float(make_method(("base", nm))(f, a, b, 1e-12, 200)[0])))) < 1e-62
|
||||
for nm in ("dekker", "illinois")]
|
||||
check("Dekker and Illinois stall where |f| < 1e-62", small, [True, True])
|
||||
# point 7: Table 3's two added rows
|
||||
full = {r["label"]: r for r in _load("sweep_full.json")}
|
||||
for lb, want_ in (("pure.exp_abs.bracket.bracket", (1848, 45, 0)), ("pure.exp_abs.bracket.credit", (1952, 45, 0))):
|
||||
c = full[lb]["CHA"]
|
||||
check(f"Table 3 row {lb}", (c["total"], c["solved"], c["over"]), want_)
|
||||
'''
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
call_old = " verify_controls()\n\n print()"
|
||||
marker = '\n\nif __name__ == "__main__":\n main()\n'
|
||||
assert src.count(call_old) == 1 and src.count(marker) == 1
|
||||
src = src.replace(call_old, " verify_controls()\n verify_revision2()\n\n print()").replace(marker, FUNC + marker)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
print("added verify_revision2")
|
||||
@@ -0,0 +1,48 @@
|
||||
"""verify_article.py checks the round-3 additions: the post hoc row of Table 12
|
||||
(sweep_estimated_posthoc.json), A' against it on corpus 4, its fractional-free holds, and the
|
||||
statement that the transferred detector loses more on simple roots than it gains on multiple ones.
|
||||
|
||||
python -u apply_verify_revision3.py
|
||||
"""
|
||||
PATH = "verify_article.py"
|
||||
FUNC = '''
|
||||
|
||||
def verify_revision3():
|
||||
"""Revision 3 (point 5): the post hoc branch m >= 2 and the reading of Table 12."""
|
||||
print("\\nRevision 3:")
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
P = _load("sweep_estimated_posthoc.json")
|
||||
K = _load("sweep_estimated.json")["k3_analogy"]
|
||||
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
|
||||
ap = dict(seen["Aprime"])
|
||||
ap.update(four["Aprime"])
|
||||
K1 = _load("sweep_controls.json")["K1"]
|
||||
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
|
||||
|
||||
def group(r):
|
||||
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
check("Table 12 post hoc row", (tot(P["D"]), sum(tot(P[s]) for s in sets), group(P), tot(P["APS"])),
|
||||
(5568, 18372, 6540, 2960))
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(P["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(P["D"][p]) for p in ps)
|
||||
check("A' vs the post hoc variant on corpus 4", (w, len(ps) - w - l, l), (178, 34, 28))
|
||||
check("post hoc violations", sum(v[2] for s in sets for v in P[s].values()), 0)
|
||||
gain = group(ap) - group(K)
|
||||
loss = (sum(tot(K[s]) for s in sets) - group(K)) - (sum(tot(ap[s]) for s in sets) - group(ap))
|
||||
check("transferred detector: gain on multiple roots < loss elsewhere (vs A')", (gain, loss, gain < loss),
|
||||
(1233, 3934, True))
|
||||
'''
|
||||
src = open(PATH, encoding="utf8").read()
|
||||
call_old = " verify_revision2()\n\n print()"
|
||||
marker = '\n\nif __name__ == "__main__":\n main()\n'
|
||||
assert src.count(call_old) == 1 and src.count(marker) == 1
|
||||
src = src.replace(call_old, " verify_revision2()\n verify_revision3()\n\n print()").replace(marker, FUNC + marker)
|
||||
open(PATH, "w", encoding="utf8").write(src)
|
||||
print("added verify_revision3")
|
||||
+55
-32
@@ -4,7 +4,7 @@ V. Sitnikov
|
||||
|
||||
## Abstract
|
||||
|
||||
We replace bisection's midpoint rule by a similarity rule — the step grows with how dissimilar $f(x)$ is to the target 0, under a similarity $S$ with $S(0)=1$ — and derive its contraction factor in closed form. The derivation fixes a base rule before any benchmark is consulted: with the tent similarity and a three-point divided-difference scale it is a Newton step of Muller's order 1.839, clipped to the bracket and projected onto a budget of twice bisection whose multiplier is its one numerical constant. On the 154 problems of Alefeld, Potra and Shi it is level with TOMS 748 and 1.5% behind Chandrupatla's method; on wide brackets it is clearly behind. The gap is a decision, when to give the model up, and we take it by analogy: at a flat root the dimensionless configuration of the last three points recurs under zoom, at a simple root it tends to a line, and the analogous pair gives the order that says whether and where to split. This decision layer, about ten discrete rules selected on two development sets, gives the method A′. On 240 problems fixed before its code was frozen it needs 3656 evaluations against 5717 for Chandrupatla, 5535 for ModAB and 4488 with Lagouanelle's multiplicity estimate in place of the analogy; the lead lies in multiple and fractional roots, present in two of the six families. With the multiplicity known, the classical transformation $\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots.
|
||||
We replace bisection's midpoint rule by a similarity rule — the step grows with the dissimilarity of $f(x)$ to 0 under a similarity $S$ — and derive its contraction factor in closed form. It fixes, before any benchmark, a base rule: with the tent similarity and a three-point divided-difference scale it is a Newton step of Muller's order 1.839, clipped to the bracket and projected onto a budget of twice bisection whose multiplier is its one numerical constant. On the 154 problems of Alefeld, Potra and Shi it is level with TOMS 748 and 1.5% behind Chandrupatla's method; on wide brackets it is clearly behind. The gap is a decision, when to give the model up, and we take it by analogy: at a flat root the dimensionless configuration of the last three points recurs under zoom, at a simple root it tends to a line, and the analogous pair gives the order that says whether and where to split. This decision layer — about ten discrete rules selected on two development sets — gives A′. On 240 problems fixed before its code was frozen it needs 3656 evaluations against 5717 for Chandrupatla, 5535 for ModAB and 4488 with Lagouanelle's multiplicity estimate in place of the analogy; the lead lies in multiple and fractional roots, present in two of six families. With the multiplicity known, the transformation $\operatorname{sign}(f)|f|^{1/m}$ is 2.4 to 6.8 times cheaper on multiple roots; A′ adds an estimate of the order, within a guarantee of twice bisection.
|
||||
|
||||
---
|
||||
|
||||
@@ -21,7 +21,7 @@ The paper makes four claims, each measured.
|
||||
3. The base rule's gap on wide brackets is a decision — when to give the model up — and a similarity of the run to its own past takes it (§6). The resulting method, A′, is tested once on a corpus fixed before its code was frozen, against simpler detectors put in its place, and against the classical transformation with the multiplicity known in advance (§7).
|
||||
4. Every table uses one criterion, a sign change within $10^{-6}$ of the answer, because the benchmarks' published roots score six problems unsolved for every method (§4, §A.5).
|
||||
|
||||
The search that produced these results — readings of the similarity that did not pay, the decomposition of the wide-bracket gap, wall-clock time, and the rejected rules — is reported in Appendices A–C. The code, the corpora and the pre-registrations are released (Appendix D and the availability statement).
|
||||
The search that produced these results — readings of the similarity that did not pay, the decomposition of the wide-bracket gap, wall-clock time, and the rejected rules — is reported in Appendices A–C. The code, the corpora and the documents that recorded each test before its run are released (Appendix D and the availability statement).
|
||||
|
||||
---
|
||||
|
||||
@@ -116,8 +116,10 @@ while |B - A| > xtol:
|
||||
if sigma is 0 or not finite: xn <- midpoint(A,B)
|
||||
else:
|
||||
xn <- x + min(1, |f(x)|/sigma) * (far - x) # the step, eq (4)
|
||||
lo, hi <- min(A,B), max(A,B)
|
||||
xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)
|
||||
if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)
|
||||
(if the midpoint too was evaluated: return it)
|
||||
evaluate fn = f(xn); allow <- allow / 2
|
||||
xp2, xp, x <- xp, x, xn
|
||||
update the bracket: whichever of A,B keeps the sign change
|
||||
@@ -181,7 +183,7 @@ Three remarks apply to both forms.
|
||||
|
||||
**Problem sets.** The 154 problems of Alefeld, Potra and Shi [1] and the 45 of Chandrupatla [3], taken programmatically from SciPy's `scipy.optimize._tstutils` so that no bracket or root is transcribed by hand.
|
||||
|
||||
**Cost model.** Evaluations of $f$. A run counts as solved when it reports convergence and $f$ changes sign within $10^{-6}$ of the returned point, or vanishes there — the bracketing notion of a root, the same criterion on every corpus of this paper; $x$-tolerance $10^{-12}$; budget 200 evaluations. Scoring against the published root instead, as the benchmarks' harness does, charges every method the full budget on six problems where $f$ vanishes identically around the root in floating point (§A.5). Head-to-head counts (wins/ties/losses) are taken over every problem of a set with the same charging as the totals. *Failures are charged the full budget*, so no method can buy a low total by giving up early, and totals are reported over all problems rather than over the subset a method happened to solve. Rankings are by failures first, then by total.
|
||||
**Cost model.** Evaluations of $f$. A run counts as solved when it reports convergence and $f$ changes sign within $10^{-6}$ of the returned point, or vanishes there — the bracketing notion of a root, the same criterion on every corpus of this paper; $x$-tolerance $10^{-12}$; budget 200 evaluations. Every method, ours included, stops when its bracket is no wider than $\varepsilon_x$ or when it evaluates an exact zero of the function it works on; none stops on a small $|f|$. Scoring against the published root instead, as the benchmarks' harness does, charges every method the full budget on six problems where $f$ vanishes identically around the root in floating point (§A.5). Head-to-head counts (wins/ties/losses) are taken over every problem of a set with the same charging as the totals. *Failures are charged the full budget*, so no method can buy a low total by giving up early, and totals are reported over all problems rather than over the subset a method happened to solve. Rankings are by failures first, then by total.
|
||||
|
||||
**Competitors.** Where SciPy ships the method, the competitor is the library — Chandrupatla is `scipy.optimize.elementwise.find_root`, Brent `brentq`, TOMS 748 `toms748` — run with the stopping rule of every method (a bracket no wider than $\varepsilon_x$, the relative term at machine precision, no stopping on $|f|$) and counted by the same wrapper around $f$. ITP, which has no library implementation, is ours, run with $\epsilon=\varepsilon_x/2$ because it terminates on $b-a\le2\epsilon$, checked against its own theorem ($n_{1/2}+n_0$ iterations at most, on all 154 problems for $n_0\in\{0,1,2,5\}$), and reported both at the authors' constants and as a *per-problem oracle* over a $(\kappa_1,n_0)$ grid — not an achievable method, included so that it cannot be said to have been handicapped. Bisection and the false-position family are ours.
|
||||
|
||||
@@ -211,7 +213,7 @@ The grid is nine similarity functions × four scales × seven safeguards = 252 c
|
||||
| 237 | Illinois [7] | yes | 153/154 | 7045 | 0 |
|
||||
| 244 | false position | no | 127/154 | 10560 | — |
|
||||
|
||||
The base rule and the same rule without any safeguard tie at 2634: the projection never binds on this set. By total, Chandrupatla's method is first with 2595, 1.5% fewer; the base rule and TOMS 748 are level (2634 against 2636). Problem by problem the base rule wins against Chandrupatla 87/24/43 (wins/ties/losses; exact two-sided sign test $p=1.4\cdot10^{-4}$), against TOMS 748 86/16/52, Brent 102/11/41, ITP at its recommended constants 132/3/19, the per-problem ITP oracle 121/4/29, and bisection 152/1/1. It trails Chandrupatla in total because its losses are the larger ones; by function family, the unit in which these problems are independent (§7), the comparison is 6/1/8 of 15 families, a tie. The constant-free variant goes 79/3/72 against Chandrupatla ($p=0.63$), 78/9/67 against TOMS 748 and 79/5/70 against Brent.
|
||||
The base rule and the same rule without any safeguard tie at 2634: the projection never binds on this set. By total, Chandrupatla's method is first with 2595, 1.5% fewer; the base rule and TOMS 748 are level (2634 against 2636). Problem by problem the base rule wins against Chandrupatla 87/24/43 (wins/ties/losses; exact two-sided sign test $p=1.4\cdot10^{-4}$), against TOMS 748 86/16/52, Brent 102/11/41, ITP at its recommended constants 132/3/19, the per-problem ITP oracle 121/4/29, and bisection 152/1/1. It trails Chandrupatla in total because its losses are the larger ones; by function family, the unit in which these problems are independent (§7), the comparison is 6/1/8 of 15 families, a tie. The constant-free variant goes 79/3/72 against Chandrupatla ($p=0.63$), 78/9/67 against TOMS 748 and 79/5/70 against Brent. Dekker, Illinois and false position fail `aps.13.00` under either criterion and so keep their totals: they spend the whole budget without converging, Dekker and Illinois stalled on one side of the zero where $|f|<10^{-62}$ but $f$ does not change sign within $10^{-6}$.
|
||||
|
||||
**Table 3.** Chandrupatla, 45 problems, brackets up to $10^{12}$ wide, out of 264 configurations.
|
||||
|
||||
@@ -220,7 +222,9 @@ The base rule and the same rule without any safeguard tie at 2634: the projectio
|
||||
| 1 | Chandrupatla | no | 45/45 | 1505 | 0 |
|
||||
| 2 | ITP, per-problem oracle | yes | 45/45 | 1675 | 0 |
|
||||
| 3 | similarity, $e^{-\lvert z\rvert}$, bracket scale, both guards | no | 45/45 | 1778 | 0 |
|
||||
| 4 | similarity, $e^{-\lvert z\rvert}$, bracket scale, bracket guard | no | 45/45 | 1848 | 0 |
|
||||
| 5 | ITP, recommended constants | yes | 45/45 | 1946 | 0 |
|
||||
| 6 | similarity, $e^{-\lvert z\rvert}$, bracket scale, earned projection | no | 45/45 | 1952 | 0 |
|
||||
| 9 | constant-free variant: earned projection | no | 45/45 | 2073 | 0 |
|
||||
| 15 | bisection | no | 45/45 | 2136 | 0 |
|
||||
| **49** | **base rule: tent, 3-point, projection ($c=2$)** | **no** | 45/45 | **2357** | 0 |
|
||||
@@ -253,7 +257,7 @@ Ranked individually and best over scales, the similarities come out $1-|z|$ (542
|
||||
|
||||
## 6. The flat regime, recognised by analogy
|
||||
|
||||
The base rule's gap on wide brackets is a decision, *when to give the model up* (§A.6): on the pure powers `fun3`–`fun6` the right move is to halve, Chandrupatla's method halves on up to all of its steps, and no reading of a single state measured takes that decision correctly. This section takes it by a similarity of the run to *its own past* — an analogy in Pólya's sense [8], two situations agreeing in more than one relation. Every rule below was pre-registered with a stop rule (Appendix D); the rejected ones are in Appendix C.
|
||||
The base rule's gap on wide brackets is a decision, *when to give the model up* (§A.6): on the pure powers `fun3`–`fun6` the right move is to halve, Chandrupatla's method halves on up to all of its steps, and no reading of a single state measured takes that decision correctly. This section takes it by a similarity of the run to *its own past* — an analogy in Pólya's sense [8], two situations agreeing in more than one relation. Every rule below was recorded, with its criteria and stop rule, before its code and run (Appendix D); the rejected ones are in Appendix C.
|
||||
|
||||
### 6.1 The flag: a promise that was not kept
|
||||
|
||||
@@ -305,7 +309,7 @@ which is exact for a pure power and becomes the midpoint as $m\to\infty$. It is
|
||||
|
||||
The method this paper proposes, **A′**, is the base rule of §3 — tent similarity, three-point scale, projection with the declared multiplier $c=2$ — with the regime of §6.2–6.3 (the analogy remembered, its translation limit, the split (7), the exit) and the five readings of §6.4. Its constants are bisection's $\tfrac12$ and what follows from it: $\tfrac14=(1-\tfrac12)^2$ and the two branches $m\ge2$, $m\le\tfrac23$ of $|1-1/m|>\tfrac12$. Three choices are declared rather than derived: the multiplier $c$ of the projection (§3.1), the Euclidean geometry of the $(\xi,\varphi)$ plane, and the pattern test of the step lengthening (lags from 2 to half the history, threshold $\tfrac12$). The projection carries the guarantee, $2\lceil\log_2(w_0/\varepsilon_x)\rceil+3$ evaluations; it is verified with no violation on every corpus of this paper and under every safeguard of the grid.
|
||||
|
||||
Counting numerical constants does not measure the method's freedom, however. Beyond these numbers A′ is a decision layer of about ten discrete rules — the flag, the analogy and its memory, the entry, the exit, the overshoot branch, the split, the step pattern, the half, the contradiction, the tolerance step — chosen on the two development sets among the many candidates of Appendix C. That selection is why the method was tested once on a corpus fixed before its code was frozen, and against simpler rules put in its place (§7). Algorithm 2 is the complete method; `simroot/pure.py` and the compiled `simbracket` implement exactly this and agree bit for bit.
|
||||
Counting numerical constants does not measure the method's freedom, however. Beyond these numbers A′ is a decision layer of about ten discrete rules — the flag, the analogy and its memory, the entry, the exit, the overshoot branch, the split, the step pattern, the half, the contradiction, the tolerance step — chosen on the two development sets among the many candidates of Appendix C. That selection is why the method was tested once on a corpus fixed before its code was frozen, and against simpler rules put in its place (§7). Algorithm 2 is the complete method; `simroot/pure.py` and the compiled `simbracket` implement exactly this and agree bit for bit. The nearest-configuration search runs over the run's memory: $O(n)$ per step, $O(n^2)$ per run of $n$ evaluations ($n\le200$ here), arithmetic that matters only when $f$ is cheap (Appendix B).
|
||||
|
||||
**Algorithm 2 (A′).** Notation of Algorithm 1; $S(z)=\max(0,1-|z|)$.
|
||||
|
||||
@@ -327,9 +331,11 @@ while |B - A| > xtol:
|
||||
# unkept promise, and unkept promise with a crossing
|
||||
flag <- not in_regime and last_model and fx/fp >= 1/4
|
||||
flag_over <- not in_regime and last_model and fx/fp <= -1/4
|
||||
# order (6) of the analogous pair: the past configuration
|
||||
# nearest to c (Euclidean in (xi, phi)), if nearer than the
|
||||
# line phi = xi; inf if the pair shows L_f < 1 <= L_x; else none
|
||||
# order (6) of the analogous pair. q <- the configuration in
|
||||
# configs nearest to c (Euclidean in (xi, phi)); no m if c or
|
||||
# configs is empty or q is not nearer than the line phi = xi.
|
||||
# L_x <- |x-xp| / q.dx, L_f <- |fx-fp| / q.df
|
||||
# m <- inf if L_f < 1 <= L_x (translation), else ln L_f / ln L_x
|
||||
m <- order of the analogous pair
|
||||
if m >= 2: analogy_seen <- true; m_a <- m
|
||||
if 0 < m <= 2/3: shallow_seen <- true; m_s <- m
|
||||
@@ -343,18 +349,20 @@ while |B - A| > xtol:
|
||||
else:
|
||||
step <- (1 - S(z)) * (far - x) # eq. (4)
|
||||
append x - xp to moves
|
||||
# step pattern: the lag 2 .. half the history of highest
|
||||
# mean similarity of successive length ratios has mean > 1/2,
|
||||
# and step and x - xp point the same way
|
||||
if the pattern repeats:
|
||||
# step pattern: q_j <- |d_j|/|d_(j-1)| over the
|
||||
# successive nonzero moves d (k ratios);
|
||||
# rho(u,v) <- min(u,v)/max(u,v); repeats iff
|
||||
# max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2
|
||||
if repeats and step, x - xp point the same way:
|
||||
s <- min(|step|,|x-xp|) / max(|step|,|x-xp|)
|
||||
step <- step / (1 - s), at most |far - x| long
|
||||
if |step| < xtol/2 and last_model and |fx/fp| < 1/4:
|
||||
step <- sign(far - x) * xtol/2 # tolerance step
|
||||
xn <- x + step; model <- true
|
||||
lo, hi <- min(A,B), max(A,B)
|
||||
xn <- clamp(xn, hi - allow, lo + allow) # projection (3)
|
||||
if xn outside (A,B) or xn in {x, xp}:
|
||||
xn <- mid; if mid in {x, xp}: stop
|
||||
xn <- mid; if mid in {x, xp}: return mid
|
||||
last_model <- model and xn is the model's own point
|
||||
fn <- f(xn)
|
||||
if in_regime: # exit
|
||||
@@ -371,8 +379,8 @@ return midpoint(A,B)
|
||||
| | APS-154 | CHA-45 | both | A′ per problem, APS | A′ per problem, CHA |
|
||||
|---|---|---|---|---|---|
|
||||
| **A′ (proposed)** | **2259** | **1074** | **3333** | — | — |
|
||||
| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | | |
|
||||
| base rule (§3) | 2634 | 2357 | 4991 | | |
|
||||
| A′, earned budget (no free constant) | 3417 | 1852 | 5269 | — | — |
|
||||
| base rule (§3) | 2634 | 2357 | 4991 | — | — |
|
||||
| Chandrupatla | 2595 | 1505 | 4100 | 103/20/31, $p=3\cdot10^{-10}$ | 31/4/10, $p=0.001$ |
|
||||
| TOMS 748 | 2636 | 3088 | 5724 | 127/6/21 | 42/2/1 |
|
||||
| Brent | 2707 | 3238 | 5945 | 118/17/19 | 39/3/3 |
|
||||
@@ -394,7 +402,7 @@ A′ is 12.9% below Chandrupatla on the canonical set and 28.6% below on the wid
|
||||
| repeated step pattern | −22 | −6 | +123 | −30 | −10 | +34 | +89 |
|
||||
| sign contradiction | +11 | −12 | +29 | 0 | +1 | −1 | +28 |
|
||||
|
||||
Every component is positive in sum; the regime and the split carry the method. The step pattern (earns on two corpora of six) and the sign contradiction (+28 over 855 problems) are marginal — together under one per cent, 117 of 13032 evaluations — and are kept because the pre-registered rule removes only a component that earns nowhere.
|
||||
Every component is positive in sum; the regime and the split carry the method. The step pattern (earns on two corpora of six) and the sign contradiction (+28 over 855 problems) are marginal — together under one per cent, 117 of 13032 evaluations — and are kept because the rule recorded in advance removes only a component that earns nowhere.
|
||||
|
||||
**Table 7.** The similarity in the step of A′: the same method with each of the nine similarity functions of §5.2 in place of the tent, everything else unchanged. Totals on the two sets of §4 and over the six corpora of §7; the guarantee holds with every function.
|
||||
|
||||
@@ -427,13 +435,13 @@ Several mechanisms of A′ coincide with classical ones, reached from similarity
|
||||
| the tolerance step | Dekker [9], Brent [2] — borrowed and named as such |
|
||||
| the exit judgment of §6.2 (the value at a split against the line) | ModAB's linearity check at the midpoint [10, 20], $|y_m-y_3|<k\,(|y_3|+|y_m|)$ with $k$ from a symmetry factor; ours compares two predictions, the line and 0, without a factor |
|
||||
|
||||
What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 6: 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, 23]; Roots.jl's `Order1B` and `Order2B` [12]); inside a bracket, [22] needs the multiplicity given and recognises a multiple root only by the number of evaluations spent, against a third of bisection's; Chandrupatla takes the decision to halve by an empirical acceptance band [3]. §7.1 puts this claim against the detectors a reader would try first, and against the transformation with the multiplicity known in advance.
|
||||
What we found no counterpart for, in the literature we could reach, is the part that carries the gain in Table 6: 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, 23]; Roots.jl's `Order1B` and `Order2B` [12]); inside a bracket, [22] needs the multiplicity given and recognises a multiple root only by the number of evaluations spent, against a third of bisection's; Chandrupatla takes the decision to halve by an empirical acceptance band [3]. §7.1 tests this against the detectors a reader would try first and against the classical transformation with the multiplicity known or estimated, and the outcome is sharper than the claim: the order read by analogy transfers to the classical frame and works better there than in A′'s own split, while A′'s exit is what keeps simple roots cheap.
|
||||
|
||||
---
|
||||
|
||||
## 7. 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 — a decision layer of about ten discrete rules, chosen among the many candidates listed in Appendix C — 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.
|
||||
Every decision above was taken on the two sets of §4. Recording each decision in advance protects the decision but not the chain: the final configuration — a decision layer of about ten discrete rules, chosen among the many candidates listed in Appendix C — 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.
|
||||
|
||||
1. **New corpus 1** — 206 problems: SciPy's `original` set (6) and five generated classes of 40 (seed 20260921): smooth and transcendental simple roots, multiple roots $|x-r|^p$ with $p\sim U(2,20)$, exponential flanks, near-cancelling terms.
|
||||
2. **Roots.jl / ModAB** — the bracketing benchmark of Roots.jl [12] used by ModAB's authors [10]: 91 problems, 13 of which coincide with APS or Chandrupatla functions and are excluded, leaving 78.
|
||||
@@ -444,7 +452,7 @@ A root must carry a sign change to be bracketed, so the multiple roots in these
|
||||
|
||||
ModAB, the most recent bracketing method we know of, is run from its authors' package (`pymodab` 1.0.9) with the stopping rule and the counting of every other method. The criterion, tolerance, budget and charging are those of §4.
|
||||
|
||||
The variant carried to corpora 1–3 was A′ without the tolerance step and the overshoot branch. It transferred to corpus 1 by every pre-registered criterion (per problem 105/34/67 against Chandrupatla, $p=0.005$), did *not* transfer to Roots.jl (38/10/30, $p=0.4$) and lost on the applied corpus; the two readings that closed those gaps were developed on the seen corpora and tested once, on corpus 4.
|
||||
The variant carried to corpora 1–3 was A′ without the tolerance step and the overshoot branch. It transferred to corpus 1 by every criterion recorded in advance (per problem 105/34/67 against Chandrupatla, $p=0.005$), did *not* transfer to Roots.jl (38/10/30, $p=0.4$) and lost on the applied corpus; the two readings that closed those gaps were developed on the seen corpora and tested once, on corpus 4.
|
||||
|
||||
**Table 8.** A′ against the library rivals on all six corpora (uniform criterion): total evaluations; in brackets the runs that break the $2\times$-bisection bound.
|
||||
|
||||
@@ -488,7 +496,7 @@ Only the last line of corpora is evidence for A′ in the strict sense; the firs
|
||||
|
||||
### 7.1 Controls: simpler detectors, and the multiplicity known in advance
|
||||
|
||||
Two controls ask whether the gain of §6 comes from the recognition by analogy or only from the split (7) with any reasonable detector. Both were pre-registered, with what the paper would say under every outcome, before the run (`sweep_controls.py`).
|
||||
Two controls ask whether the gain of §6 comes from the recognition by analogy or only from the split (7) with any reasonable detector. Both were recorded, with what the paper would say under every outcome, before the run (`sweep_controls.py`).
|
||||
|
||||
**Other detectors in A′.** A′ is run with only its detector swapped; the memory, the split, the exit and the five readings of §6.4 are unchanged. (a) *Lagouanelle's estimate* $m_L=1/(1-\theta)$, $\theta=ff''/f'^2$ from the parabola through the last three points ($m_L=\infty$ for $\theta\ge1$), with the same memory — once seen, held until the exit, a hysteresis — entering at $m_L\ge2$ and at $0<m_L\le\tfrac23$ and splitting at $m_L$. (b) *Chandrupatla's acceptance band*, entering when the band rejects the current triple and splitting at the current $m_L$. (c) *No detector*: the regime is entered at every unkept promise.
|
||||
|
||||
@@ -501,7 +509,7 @@ Two controls ask whether the gain of §6 comes from the recognition by analogy o
|
||||
| Chandrupatla's band | 2682 | 2526 | 6236 | 20668 | 110/96/34 | $1.5\cdot10^{-10}$ |
|
||||
| none | 2693 | 2526 | 6165 | 20749 | 113/87/40 | $3\cdot10^{-9}$ |
|
||||
|
||||
On corpus 4, the one test, A′ beats all three in total and problem by problem, as the pre-registered criterion required. The competent alternative is Lagouanelle's estimate: it is slightly better on the canonical set (2235 against 2259), and on corpus 4 A′'s lead over it lies in the multiple-root and fractional-power families (1163 against 1739, 924 against 1207); it is behind on $\log(1+q^2)$ of a cubic (503 against 477) and level on the rest. The band and the regime without a detector are worse than no regime at all. The decision layer by analogy therefore earns its place against the detectors a reader would try first.
|
||||
On corpus 4, the one test, A′ beats all three in total and problem by problem, as the criterion recorded in advance required. The competent alternative is Lagouanelle's estimate: it is slightly better on the canonical set (2235 against 2259), and on corpus 4 A′'s lead over it lies in the multiple-root and fractional-power families (1163 against 1739, 924 against 1207); it is behind on $\log(1+q^2)$ of a cubic (503 against 477) and level on the rest. The band and the regime without a detector are worse than no regime at all. The decision layer by analogy therefore earns its place against the detectors a reader would try first.
|
||||
|
||||
**The multiplicity known in advance.** The second control asks how good the classical transformation is when its multiplicity is given. Library Chandrupatla and Brent are run on $g=\operatorname{sign}(f)\,|f|^{1/m^*}$, with $m^*$ the order read at the known root — the slope of $\ln|f|$ against $\ln|x-r|$ on both sides at $h=10^{-5}$, rounded to 0.01, and 1 where either side shows no zero (a jump). It is not an achievable method but an upper bound. On the multiple and fractional roots, $m^*\ge2$ or $m^*\le\tfrac23$ — the branches of §6.1 where a tangent step loses to a halving:
|
||||
|
||||
@@ -513,7 +521,22 @@ On corpus 4, the one test, A′ beats all three in total and problem by problem,
|
||||
| new corpus 1 | 40 | 1229 | 358 | 337 | 1792 |
|
||||
| corpus 4 | 88 | 2159 | 901 | 844 | 4151 |
|
||||
|
||||
With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. A′ is far ahead of Chandrupatla on $f$ itself, which does not know the multiplicity either. On the remaining problems the transformed and untransformed runs differ little and A′ is close to them: ahead on the canonical sets (2259 against 2640, 420 against 437 for Chandrupatla on $g$), behind on corpora 1 and 4 (2061 against 1924, 1497 against 1427). So on multiple roots the contribution of A′ is the estimate of the order without knowing it, and the gap to Table 11 is the price of that estimate — large, and the clearest direction for improving the method.
|
||||
With the multiplicity known the transformation is 2.4 to 6.8 times cheaper than A′. Every method, A′ included, stops on an exact zero of the function it evaluates, and on the pure powers of the Chandrupatla set $g$ is exactly linear, so the secant lands on the root: 15 of Brent's 20 runs and 4 of Chandrupatla's end that way there (A′: 2). On new corpus 1 no transformed run ends on a zero, and the transformation is still 3.4 times cheaper. A′ is far ahead of Chandrupatla on $f$ itself, which does not know the multiplicity either. On the remaining problems the transformed and untransformed runs differ little and A′ is close to them: ahead on the canonical sets (2259 against 2640, 420 against 437 for Chandrupatla on $g$), behind on corpora 1 and 4 (2061 against 1924, 1497 against 1427). So on multiple roots the contribution of A′ is the estimate of the order without knowing it, and the gap to Table 11 is the price of that estimate — large, and the clearest direction for improving the method.
|
||||
|
||||
**The multiplicity estimated during the run.** Between A′ and the oracle lies the natural classical method: Chandrupatla's interpolation on $g=\operatorname{sign}(f)|f|^{1/\hat m}$ with $\hat m$ estimated during the run. Our implementation of Chandrupatla's method (identical to the library on all 199 problems, and to itself when $\hat m\equiv1$) keeps the true $f$ at its three points and reads $G(v)=\operatorname{sign}(v)|v|^{1/\hat m}$ only in the acceptance band and the interpolation; $\hat m$ starts at 1 and takes an order read from the last three evaluations whenever that order lies on a branch of §6.1 ($m\ge2$ or $0<m\le\tfrac23$), without reset — the hysteresis of the controls above. The order is read either by Lagouanelle's estimate or by A′'s own analogy (recorded in advance, `sweep_estimated.py`):
|
||||
|
||||
**Table 12.** Chandrupatla on the transformed function: the multiplicity estimated during the run, against A′, the oracle of Table 11 and Chandrupatla on $f$. Totals, failures charged; the 148 multiple and fractional roots of Table 11, and the simple-root canonical set. The estimated forms have no exit: an order once taken is held to the end of the run. A′ leaves its regime by the exit of §6.2.
|
||||
|
||||
| method | corpus 4 | six corpora | multiple/fractional (148) | APS |
|
||||
|---|---|---|---|---|
|
||||
| **A′** | **3656** | **13032** | 4042 | **2259** |
|
||||
| Chandrupatla on $g$, $\hat m$ by analogy | 3806 | 15733 | 2809 | 3453 |
|
||||
| Chandrupatla on $g$, $\hat m$ by Lagouanelle | 7526 | 30991 | 6041 | 7215 |
|
||||
| the same, branch $m\ge2$ only (post hoc) | 5568 | 18372 | 6540 | 2960 |
|
||||
| Chandrupatla on $g$, $m^*$ known (Table 11) | — | — | **1355** | — |
|
||||
| Chandrupatla on $f$ | 5717 | 16481 | 7011 | 2595 |
|
||||
|
||||
A′ is ahead of both estimated forms on corpus 4, in total and problem by problem (against the analogy form 126/38/76, $p=5\cdot10^{-4}$), and over the six corpora. The two estimators behave differently in this frame. Lagouanelle's reads the parabola through Chandrupatla's points, which alternate sides of the root; there it reports a fractional order on 115 of the 154 simple roots of the canonical set, holds it, and turns the method into little more than bisection. Restricted after the fact to the branch $m\ge2$ (post hoc, `POSTHOC_lag_branch_2026-09-22.md`), it no longer breaks, but in this frame it hardly sees a multiple root either: 6540 on the 148 multiple and fractional roots against 7011 for Chandrupatla on $f$, and 5568 on corpus 4, with A′ ahead 178/34/28. The analogy's order is the better one here too, and on the multiple and fractional roots it does better inside Chandrupatla's interpolation than inside A′'s split: it closes 59%, 58% and 31% of the gap from A′ to the oracle on the Chandrupatla set, corpus 1 and corpus 4 (322 against 654, 721 against 1229, 1766 against 2159). It pays on simple roots, where it has no exit to take a false reading back (3453 against 2595 on the canonical set). Two conclusions follow. First, the order read by analogy transfers to the classical frame and works better there than in A′'s own split: on the multiple and fractional roots Chandrupatla's interpolation with that order beats A′ itself (2809 against 4042). Second, A′'s decision layer as a whole — the detector together with its exit — earns its place: without an exit the transferred detector loses more on simple roots than it gains on multiple ones, and A′ stays ahead on corpus 4 and over the six corpora.
|
||||
|
||||
---
|
||||
|
||||
@@ -523,11 +546,11 @@ A root finder can be derived from a similarity function alone, and the derivatio
|
||||
|
||||
The base rule is level with TOMS 748 and 1.5% behind Chandrupatla's method on the canonical set, and clearly behind Chandrupatla on wide brackets (1505 against 2357); the cause is not the order of the model but the decision to give it up.
|
||||
|
||||
That decision is a similarity too, of the run to its own past: a pure power repeats its configuration under zoom, an exponential under translation, a simple root tends to the line, and the analogous pair reads the order that decides between the model and a split. The method built on it, A′, is ahead of Chandrupatla on both canonical sets, and on a corpus fixed before its code was frozen it needs 36% fewer evaluations and wins 177 problems to 28. Its decision layer beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place; with the multiplicity known in advance the classical transformation is 2.4 to 6.8 times cheaper on multiple roots, which measures what estimating the order costs. The claim the measurements support is a lead over Brent, TOMS 748, ITP and ModAB everywhere, within a bound of twice bisection that Brent, TOMS 748 and ModAB do not promise and exceed, and over Chandrupatla a lead that is large where roots are multiple, fractional or nearly flat and small where they are simple — not superiority by the same margin everywhere. `fun9`, near-cancelling terms and smooth applied equations are where it is behind or level.
|
||||
That decision is a similarity too, of the run to its own past: a pure power repeats its configuration under zoom, an exponential under translation, a simple root tends to the line, and the analogous pair reads the order that decides between the model and a split. The method built on it, A′, is ahead of Chandrupatla on both canonical sets, and on a corpus fixed before its code was frozen it needs 36% fewer evaluations and wins 177 problems to 28. Its detector, the order read by analogy, beats Lagouanelle's estimate, Chandrupatla's band and no detector put in its place, and it transfers: inside Chandrupatla's interpolation on the transformed function it does better on multiple roots than A′'s own split, while only A′'s exit keeps simple roots cheap; with the multiplicity known in advance the classical transformation is 2.4 to 6.8 times cheaper on multiple roots, which measures what estimating the order costs. The claim the measurements support is a lead over Brent, TOMS 748, ITP and ModAB everywhere, within a bound of twice bisection that Brent, TOMS 748 and ModAB do not promise and exceed, and over Chandrupatla a lead that is large where roots are multiple, fractional or nearly flat and small where they are simple — not superiority by the same margin everywhere. `fun9`, near-cancelling terms and smooth applied equations are where it is behind or level.
|
||||
|
||||
### Future work
|
||||
|
||||
The first is the price of estimating the order. With the multiplicity given, the transformation of §6.3 is 2.4 to 6.8 times cheaper than A′ on multiple and fractional roots (Table 11): the order read from the analogous pair, or its use in the split, loses most of what the transformation could deliver.
|
||||
The first is the price of estimating the order. With the multiplicity given, the transformation of §6.3 is 2.4 to 6.8 times cheaper than A′ on multiple and fractional roots (Table 11): closing that gap is open.
|
||||
|
||||
The second is the steep flank. Where the loss remains — `fun9`, the near-cancelling class, 4 − tan x at its pole — the base step approaches along a flank far steeper than its model, and the half contradiction of §6.4 removes only part of the cost. The third is the one geometric choice of §6.2, the Euclidean metric of the $(\xi,\varphi)$ plane: a metric derived from the configuration's own sensitivity would remove it.
|
||||
|
||||
@@ -535,7 +558,7 @@ The second is the steep flank. Where the loss remains — `fun9`, the near-cance
|
||||
|
||||
## Code and data availability
|
||||
|
||||
Everything behind this paper is released with it: the reference implementation of the base rule and of A′ (`simroot/pure.py`); `simbracket`, a compiled library of A′ (Cython; wheels for Linux and Windows, Python 3.10 or later) whose results equal the reference bit for bit on all 868 problems of the six corpora; the corpora as code (`corpus_*.py`); every sweep script with its results file; the pre-registrations with the commits of Appendix D; and `verify_article.py`, which recomputes or re-reads every number stated in this paper and is part of the test suite. All numbers come from one Linux machine (§4). Repository: ⟨repository URL⟩.
|
||||
Everything behind this paper is released with it: the reference implementation of the base rule and of A′ (`simroot/pure.py`); `simbracket`, a compiled library of A′ (Cython; wheels for Linux and Windows, Python 3.10 or later) whose results equal the reference bit for bit on all 868 problems of the six corpora; the corpora as code (`corpus_*.py`); every sweep script with its results file; the advance records with the commits of Appendix D; and `verify_article.py`, which recomputes or re-reads every number stated in this paper and is part of the test suite. All of it is released under the Apache License 2.0. All numbers come from one Linux machine (§4). Archive (code, data and history): https://doi.org/10.5281/zenodo.22894337 (DOI 10.5281/zenodo.22894337).
|
||||
|
||||
---
|
||||
|
||||
@@ -687,19 +710,19 @@ Three caveats, all of them limitations of the measurement rather than of the met
|
||||
|
||||
14. **The model's own point cannot tell a flat root from a simple one.** Judging the evaluated point against the line through the bracket ends and against 0 — the exit judgment of §6.2 — also at *entry* gives 2820 and 1532 against 2935 and 1546 for the exit alone: the model aims at the root, so $f$ is small there by construction and looks flat at a simple root as readily as at a power. The same judgment works at a split, which the model did not choose.
|
||||
|
||||
15. **The decision reading "defect" does not transfer.** Combined with the regime it was the best configuration on the two development sets (§A.4's defect reading with the flat families of §6), and it passed every pre-registered criterion there. On new corpus 1 it did not: per problem 95/33/78 against Chandrupatla ($p=0.22$), losing the class of exponential flanks 9 to 26. It is therefore not part of A′.
|
||||
15. **The decision reading "defect" does not transfer.** Combined with the regime it was the best configuration on the two development sets (§A.4's defect reading with the flat families of §6), and it passed every criterion recorded for it there. On new corpus 1 it did not: per problem 95/33/78 against Chandrupatla ($p=0.22$), losing the class of exponential flanks 9 to 26. It is therefore not part of A′.
|
||||
|
||||
16. **A component rejected alone can pay in combination.** Remembering the analogy for the run was rejected by its own pre-registration, under the harness scoring of the time (canonical set 2814 against 2806 without the regime; under the sign-change criterion the two are level, 2633 against 2634), and with the split of §6.3 it is the better form (with the step pattern, wide brackets 1250 against 1388 for the analogy read in one state). Composition was measured, not assumed, throughout — which is also why §A.2's readings (2) and (3), each an improvement, are not combined.
|
||||
16. **A component rejected alone can pay in combination.** Remembering the analogy for the run was rejected by its own advance record, under the harness scoring of the time (canonical set 2814 against 2806 without the regime; under the sign-change criterion the two are level, 2633 against 2634), and with the split of §6.3 it is the better form (with the step pattern, wide brackets 1250 against 1388 for the analogy read in one state). Composition was measured, not assumed, throughout — which is also why §A.2's readings (2) and (3), each an improvement, are not combined.
|
||||
|
||||
---
|
||||
|
||||
## Appendix D. Pre-registrations and the frozen code
|
||||
## Appendix D. Advance records and the frozen code
|
||||
|
||||
Every rule of §6 and every test of §7 was written down, with its criteria and stop rule, before its code and its run. Table D1 gives, for each document, the commit that first added it and the commit that first added the results its run wrote, both read from git by `check_prereg_order.py`: 25 of the 30 were committed before their results; four were committed together with them, so git cannot order them; one was decided on its smoke run and has no results file. The code of A′ was committed (`8027d7f`) after corpus 4 was defined (`657df10`) and before its results (`6d2531e`); `simroot/pure.py` did not change in between.
|
||||
Every rule of §6 and every test of §7 was written down, with its criteria and stop rule, before its code and its run. Table D1 gives, for each document, the commit that first added it and the commit that first added the results its run wrote, both read from git by `check_prereg_order.py`: 25 of the 30 were committed before their results; four were committed together with them, so git cannot order them; one was decided on its smoke run and has no results file. We call these documents advance records, not pre-registrations: they live in the author's repository, and their order relative to the runs is attested only by the author's git history, whose timestamps the author sets; no external registry was used. A deposit with an external timestamp (Zenodo, OSF) before a run would remove that limitation for future tests. Before publication the history was rewritten to remove infrastructure details (a server address) and working notes not meant for publication (a few files deleted; file names, comments and a few words in three advance records made neutral, cited commit hashes mapped to the new commits; no rule, criterion or number of a record changed); the commits cited here are those of the published history, in which `check_prereg_order.py` recomputes Table D1. The code of A′ was committed (`8027d7f`) after corpus 4 was defined (`657df10`) and before its results (`6d2531e`); `simroot/pure.py` did not change in between.
|
||||
|
||||
**Table D1.** Pre-registrations, in the order they were written.
|
||||
**Table D1.** Advance records, in the order they were written.
|
||||
|
||||
| pre-registration | commit | results file | commit | order |
|
||||
| advance record | commit | results file | commit | order |
|
||||
|------------------------------|---------|--------------------------------------|---------|-------------|
|
||||
| `logarithmic_2026-09-20` | `f9b062e` | `sweep_log.json` | `84ff1c7` | before |
|
||||
| `prestep_gate_2026-09-21` | `0617243` | `sweep_gate.json` | `a6116cd` | before |
|
||||
|
||||
Binary file not shown.
+219
-94
@@ -88,27 +88,27 @@ a Data-Selected Decision Layer}
|
||||
\maketitle
|
||||
\begin{abstract}
|
||||
We replace bisection's midpoint rule by a similarity rule --- the step
|
||||
grows with how dissimilar \(f(x)\) is to the target 0, under a
|
||||
similarity \(S\) with \(S(0)=1\) --- and derive its contraction factor
|
||||
in closed form. The derivation fixes a base rule before any benchmark is
|
||||
consulted: with the tent similarity and a three-point divided-difference
|
||||
scale it is a Newton step of Muller's order 1.839, clipped to the
|
||||
bracket and projected onto a budget of twice bisection whose multiplier
|
||||
is its one numerical constant. On the 154 problems of Alefeld, Potra and
|
||||
Shi it is level with TOMS 748 and 1.5\% behind Chandrupatla's method; on
|
||||
wide brackets it is clearly behind. The gap is a decision, when to give
|
||||
the model up, and we take it by analogy: at a flat root the
|
||||
dimensionless configuration of the last three points recurs under zoom,
|
||||
at a simple root it tends to a line, and the analogous pair gives the
|
||||
order that says whether and where to split. This decision layer, about
|
||||
ten discrete rules selected on two development sets, gives the method
|
||||
A′. On 240 problems fixed before its code was frozen it needs 3656
|
||||
evaluations against 5717 for Chandrupatla, 5535 for ModAB and 4488 with
|
||||
Lagouanelle's multiplicity estimate in place of the analogy; the lead
|
||||
lies in multiple and fractional roots, present in two of the six
|
||||
families. With the multiplicity known, the classical transformation
|
||||
grows with the dissimilarity of \(f(x)\) to 0 under a similarity \(S\)
|
||||
--- and derive its contraction factor in closed form. It fixes, before
|
||||
any benchmark, a base rule: with the tent similarity and a three-point
|
||||
divided-difference scale it is a Newton step of Muller's order 1.839,
|
||||
clipped to the bracket and projected onto a budget of twice bisection
|
||||
whose multiplier is its one numerical constant. On the 154 problems of
|
||||
Alefeld, Potra and Shi it is level with TOMS 748 and 1.5\% behind
|
||||
Chandrupatla's method; on wide brackets it is clearly behind. The gap is
|
||||
a decision, when to give the model up, and we take it by analogy: at a
|
||||
flat root the dimensionless configuration of the last three points
|
||||
recurs under zoom, at a simple root it tends to a line, and the
|
||||
analogous pair gives the order that says whether and where to split.
|
||||
This decision layer --- about ten discrete rules selected on two
|
||||
development sets --- gives A′. On 240 problems fixed before its code was
|
||||
frozen it needs 3656 evaluations against 5717 for Chandrupatla, 5535 for
|
||||
ModAB and 4488 with Lagouanelle's multiplicity estimate in place of the
|
||||
analogy; the lead lies in multiple and fractional roots, present in two
|
||||
of six families. With the multiplicity known, the transformation
|
||||
\(\operatorname{sign}(f)|f|^{1/m}\) is 2.4 to 6.8 times cheaper on
|
||||
multiple roots.
|
||||
multiple roots; A′ adds an estimate of the order, within a guarantee of
|
||||
twice bisection.
|
||||
\end{abstract}
|
||||
|
||||
\hypertarget{introduction}{%
|
||||
@@ -162,8 +162,8 @@ The paper makes four claims, each measured.
|
||||
The search that produced these results --- readings of the similarity
|
||||
that did not pay, the decomposition of the wide-bracket gap, wall-clock
|
||||
time, and the rejected rules --- is reported in Appendices A--C. The
|
||||
code, the corpora and the pre-registrations are released (Appendix D and
|
||||
the availability statement).
|
||||
code, the corpora and the documents that recorded each test before its
|
||||
run are released (Appendix D and the availability statement).
|
||||
|
||||
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
|
||||
|
||||
@@ -400,8 +400,10 @@ while |B - A| > xtol:
|
||||
if sigma is 0 or not finite: xn <- midpoint(A,B)
|
||||
else:
|
||||
xn <- x + min(1, |f(x)|/sigma) * (far - x) # the step, eq (4)
|
||||
lo, hi <- min(A,B), max(A,B)
|
||||
xn <- clamp(xn, hi - allow, lo + allow) # projection, eq (3)
|
||||
if xn outside (A,B) or already evaluated: xn <- midpoint(A,B)
|
||||
(if the midpoint too was evaluated: return it)
|
||||
evaluate fn = f(xn); allow <- allow / 2
|
||||
xp2, xp, x <- xp, x, xn
|
||||
update the bracket: whichever of A,B keeps the sign change
|
||||
@@ -554,15 +556,17 @@ transcribed by hand.
|
||||
it reports convergence and \(f\) changes sign within \(10^{-6}\) of the
|
||||
returned point, or vanishes there --- the bracketing notion of a root,
|
||||
the same criterion on every corpus of this paper; \(x\)-tolerance
|
||||
\(10^{-12}\); budget 200 evaluations. Scoring against the published root
|
||||
instead, as the benchmarks' harness does, charges every method the full
|
||||
budget on six problems where \(f\) vanishes identically around the root
|
||||
in floating point (§A.5). Head-to-head counts (wins/ties/losses) are
|
||||
taken over every problem of a set with the same charging as the totals.
|
||||
\emph{Failures are charged the full budget}, so no method can buy a low
|
||||
total by giving up early, and totals are reported over all problems
|
||||
rather than over the subset a method happened to solve. Rankings are by
|
||||
failures first, then by total.
|
||||
\(10^{-12}\); budget 200 evaluations. Every method, ours included, stops
|
||||
when its bracket is no wider than \(\varepsilon_x\) or when it evaluates
|
||||
an exact zero of the function it works on; none stops on a small
|
||||
\(|f|\). Scoring against the published root instead, as the benchmarks'
|
||||
harness does, charges every method the full budget on six problems where
|
||||
\(f\) vanishes identically around the root in floating point (§A.5).
|
||||
Head-to-head counts (wins/ties/losses) are taken over every problem of a
|
||||
set with the same charging as the totals. \emph{Failures are charged the
|
||||
full budget}, so no method can buy a low total by giving up early, and
|
||||
totals are reported over all problems rather than over the subset a
|
||||
method happened to solve. Rankings are by failures first, then by total.
|
||||
|
||||
\textbf{Competitors.} Where SciPy ships the method, the competitor is
|
||||
the library --- Chandrupatla is
|
||||
@@ -655,7 +659,11 @@ its losses are the larger ones; by function family, the unit in which
|
||||
these problems are independent (§7), the comparison is 6/1/8 of 15
|
||||
families, a tie. The constant-free variant goes 79/3/72 against
|
||||
Chandrupatla (\(p=0.63\)), 78/9/67 against TOMS 748 and 79/5/70 against
|
||||
Brent.
|
||||
Brent. Dekker, Illinois and false position fail \texttt{aps.13.00} under
|
||||
either criterion and so keep their totals: they spend the whole budget
|
||||
without converging, Dekker and Illinois stalled on one side of the zero
|
||||
where \(|f|<10^{-62}\) but \(f\) does not change sign within
|
||||
\(10^{-6}\).
|
||||
|
||||
\textbf{Table 3.} Chandrupatla, 45 problems, brackets up to \(10^{12}\)
|
||||
wide, out of 264 configurations.
|
||||
@@ -689,7 +697,11 @@ total evals
|
||||
2 & ITP, per-problem oracle & yes & 45/45 & 1675 & 0 \\
|
||||
3 & similarity, \(e^{-\lvert z\rvert}\), bracket scale, both guards & no
|
||||
& 45/45 & 1778 & 0 \\
|
||||
4 & similarity, \(e^{-\lvert z\rvert}\), bracket scale, bracket guard &
|
||||
no & 45/45 & 1848 & 0 \\
|
||||
5 & ITP, recommended constants & yes & 45/45 & 1946 & 0 \\
|
||||
6 & similarity, \(e^{-\lvert z\rvert}\), bracket scale, earned
|
||||
projection & no & 45/45 & 1952 & 0 \\
|
||||
9 & constant-free variant: earned projection & no & 45/45 & 2073 & 0 \\
|
||||
15 & bisection & no & 45/45 & 2136 & 0 \\
|
||||
\textbf{49} & \textbf{base rule: tent, 3-point, projection (\(c=2\))} &
|
||||
@@ -774,8 +786,9 @@ the right move is to halve, Chandrupatla's method halves on up to all of
|
||||
its steps, and no reading of a single state measured takes that decision
|
||||
correctly. This section takes it by a similarity of the run to \emph{its
|
||||
own past} --- an analogy in Pólya's sense {[}8{]}, two situations
|
||||
agreeing in more than one relation. Every rule below was pre-registered
|
||||
with a stop rule (Appendix D); the rejected ones are in Appendix C.
|
||||
agreeing in more than one relation. Every rule below was recorded, with
|
||||
its criteria and stop rule, before its code and run (Appendix D); the
|
||||
rejected ones are in Appendix C.
|
||||
|
||||
\hypertarget{the-flag-a-promise-that-was-not-kept}{%
|
||||
\subsubsection{6.1 The flag: a promise that was not
|
||||
@@ -964,7 +977,10 @@ among the many candidates of Appendix C. That selection is why the
|
||||
method was tested once on a corpus fixed before its code was frozen, and
|
||||
against simpler rules put in its place (§7). Algorithm 2 is the complete
|
||||
method; \texttt{simroot/pure.py} and the compiled \texttt{simbracket}
|
||||
implement exactly this and agree bit for bit.
|
||||
implement exactly this and agree bit for bit. The nearest-configuration
|
||||
search runs over the run's memory: \(O(n)\) per step, \(O(n^2)\) per run
|
||||
of \(n\) evaluations (\(n\le200\) here), arithmetic that matters only
|
||||
when \(f\) is cheap (Appendix B).
|
||||
|
||||
\textbf{Algorithm 2 (A′).} Notation of Algorithm 1;
|
||||
\(S(z)=\max(0,1-|z|)\).
|
||||
@@ -987,9 +1003,11 @@ while |B - A| > xtol:
|
||||
# unkept promise, and unkept promise with a crossing
|
||||
flag <- not in_regime and last_model and fx/fp >= 1/4
|
||||
flag_over <- not in_regime and last_model and fx/fp <= -1/4
|
||||
# order (6) of the analogous pair: the past configuration
|
||||
# nearest to c (Euclidean in (xi, phi)), if nearer than the
|
||||
# line phi = xi; inf if the pair shows L_f < 1 <= L_x; else none
|
||||
# order (6) of the analogous pair. q <- the configuration in
|
||||
# configs nearest to c (Euclidean in (xi, phi)); no m if c or
|
||||
# configs is empty or q is not nearer than the line phi = xi.
|
||||
# L_x <- |x-xp| / q.dx, L_f <- |fx-fp| / q.df
|
||||
# m <- inf if L_f < 1 <= L_x (translation), else ln L_f / ln L_x
|
||||
m <- order of the analogous pair
|
||||
if m >= 2: analogy_seen <- true; m_a <- m
|
||||
if 0 < m <= 2/3: shallow_seen <- true; m_s <- m
|
||||
@@ -1003,18 +1021,20 @@ while |B - A| > xtol:
|
||||
else:
|
||||
step <- (1 - S(z)) * (far - x) # eq. (4)
|
||||
append x - xp to moves
|
||||
# step pattern: the lag 2 .. half the history of highest
|
||||
# mean similarity of successive length ratios has mean > 1/2,
|
||||
# and step and x - xp point the same way
|
||||
if the pattern repeats:
|
||||
# step pattern: q_j <- |d_j|/|d_(j-1)| over the
|
||||
# successive nonzero moves d (k ratios);
|
||||
# rho(u,v) <- min(u,v)/max(u,v); repeats iff
|
||||
# max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2
|
||||
if repeats and step, x - xp point the same way:
|
||||
s <- min(|step|,|x-xp|) / max(|step|,|x-xp|)
|
||||
step <- step / (1 - s), at most |far - x| long
|
||||
if |step| < xtol/2 and last_model and |fx/fp| < 1/4:
|
||||
step <- sign(far - x) * xtol/2 # tolerance step
|
||||
xn <- x + step; model <- true
|
||||
lo, hi <- min(A,B), max(A,B)
|
||||
xn <- clamp(xn, hi - allow, lo + allow) # projection (3)
|
||||
if xn outside (A,B) or xn in {x, xp}:
|
||||
xn <- mid; if mid in {x, xp}: stop
|
||||
xn <- mid; if mid in {x, xp}: return mid
|
||||
last_model <- model and xn is the model's own point
|
||||
fn <- f(xn)
|
||||
if in_regime: # exit
|
||||
@@ -1056,8 +1076,8 @@ A′ per problem, CHA
|
||||
\endlastfoot
|
||||
\textbf{A′ (proposed)} & \textbf{2259} & \textbf{1074} & \textbf{3333} &
|
||||
--- & --- \\
|
||||
A′, earned budget (no free constant) & 3417 & 1852 & 5269 & & \\
|
||||
base rule (§3) & 2634 & 2357 & 4991 & & \\
|
||||
A′, earned budget (no free constant) & 3417 & 1852 & 5269 & --- & --- \\
|
||||
base rule (§3) & 2634 & 2357 & 4991 & --- & --- \\
|
||||
Chandrupatla & 2595 & 1505 & 4100 & 103/20/31, \(p=3\cdot10^{-10}\) &
|
||||
31/4/10, \(p=0.001\) \\
|
||||
TOMS 748 & 2636 & 3088 & 5724 & 127/6/21 & 42/2/1 \\
|
||||
@@ -1126,8 +1146,8 @@ sign contradiction & +11 & −12 & +29 & 0 & +1 & −1 & +28 \\
|
||||
Every component is positive in sum; the regime and the split carry the
|
||||
method. The step pattern (earns on two corpora of six) and the sign
|
||||
contradiction (+28 over 855 problems) are marginal --- together under
|
||||
one per cent, 117 of 13032 evaluations --- and are kept because the
|
||||
pre-registered rule removes only a component that earns nowhere.
|
||||
one per cent, 117 of 13032 evaluations --- and are kept because the rule
|
||||
recorded in advance removes only a component that earns nowhere.
|
||||
|
||||
\textbf{Table 7.} The similarity in the step of A′: the same method with
|
||||
each of the nine similarity functions of §5.2 in place of the tent,
|
||||
@@ -1220,22 +1240,25 @@ Roots.jl's \texttt{Order1B} and \texttt{Order2B} {[}12{]}); inside a
|
||||
bracket, {[}22{]} needs the multiplicity given and recognises a multiple
|
||||
root only by the number of evaluations spent, against a third of
|
||||
bisection's; Chandrupatla takes the decision to halve by an empirical
|
||||
acceptance band {[}3{]}. §7.1 puts this claim against the detectors a
|
||||
reader would try first, and against the transformation with the
|
||||
multiplicity known in advance.
|
||||
acceptance band {[}3{]}. §7.1 tests this against the detectors a reader
|
||||
would try first and against the classical transformation with the
|
||||
multiplicity known or estimated, and the outcome is sharper than the
|
||||
claim: the order read by analogy transfers to the classical frame and
|
||||
works better there than in A′'s own split, while A′'s exit is what keeps
|
||||
simple roots cheap.
|
||||
|
||||
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
|
||||
|
||||
\hypertarget{out-of-sample-evidence}{%
|
||||
\subsection{7. Out-of-sample evidence}\label{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 --- a
|
||||
decision layer of about ten discrete rules, chosen among the many
|
||||
candidates listed in Appendix C --- 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.
|
||||
Every decision above was taken on the two sets of §4. Recording each
|
||||
decision in advance protects the decision but not the chain: the final
|
||||
configuration --- a decision layer of about ten discrete rules, chosen
|
||||
among the many candidates listed in Appendix C --- 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.
|
||||
|
||||
\begin{enumerate}
|
||||
\def\labelenumi{\arabic{enumi}.}
|
||||
@@ -1279,8 +1302,8 @@ counting of every other method. The criterion, tolerance, budget and
|
||||
charging are those of §4.
|
||||
|
||||
The variant carried to corpora 1--3 was A′ without the tolerance step
|
||||
and the overshoot branch. It transferred to corpus 1 by every
|
||||
pre-registered criterion (per problem 105/34/67 against Chandrupatla,
|
||||
and the overshoot branch. It transferred to corpus 1 by every criterion
|
||||
recorded in advance (per problem 105/34/67 against Chandrupatla,
|
||||
\(p=0.005\)), did \emph{not} transfer to Roots.jl (38/10/30, \(p=0.4\))
|
||||
and lost on the applied corpus; the two readings that closed those gaps
|
||||
were developed on the seen corpora and tested once, on corpus 4.
|
||||
@@ -1426,8 +1449,8 @@ advance}\label{controls-simpler-detectors-and-the-multiplicity-known-in-advance}
|
||||
|
||||
Two controls ask whether the gain of §6 comes from the recognition by
|
||||
analogy or only from the split (7) with any reasonable detector. Both
|
||||
were pre-registered, with what the paper would say under every outcome,
|
||||
before the run (\texttt{sweep\_controls.py}).
|
||||
were recorded, with what the paper would say under every outcome, before
|
||||
the run (\texttt{sweep\_controls.py}).
|
||||
|
||||
\textbf{Other detectors in A′.} A′ is run with only its detector
|
||||
swapped; the memory, the split, the exit and the five readings of §6.4
|
||||
@@ -1483,7 +1506,7 @@ none & 2693 & 2526 & 6165 & 20749 & 113/87/40 & \(3\cdot10^{-9}\) \\
|
||||
\end{longtable}
|
||||
|
||||
On corpus 4, the one test, A′ beats all three in total and problem by
|
||||
problem, as the pre-registered criterion required. The competent
|
||||
problem, as the criterion recorded in advance required. The competent
|
||||
alternative is Lagouanelle's estimate: it is slightly better on the
|
||||
canonical set (2235 against 2259), and on corpus 4 A′'s lead over it
|
||||
lies in the multiple-root and fractional-power families (1163 against
|
||||
@@ -1538,15 +1561,102 @@ corpus 4 & 88 & 2159 & 901 & 844 & 4151 \\
|
||||
\end{longtable}
|
||||
|
||||
With the multiplicity known the transformation is 2.4 to 6.8 times
|
||||
cheaper than A′. A′ is far ahead of Chandrupatla on \(f\) itself, which
|
||||
does not know the multiplicity either. On the remaining problems the
|
||||
transformed and untransformed runs differ little and A′ is close to
|
||||
them: ahead on the canonical sets (2259 against 2640, 420 against 437
|
||||
for Chandrupatla on \(g\)), behind on corpora 1 and 4 (2061 against
|
||||
1924, 1497 against 1427). So on multiple roots the contribution of A′ is
|
||||
the estimate of the order without knowing it, and the gap to Table 11 is
|
||||
the price of that estimate --- large, and the clearest direction for
|
||||
improving the method.
|
||||
cheaper than A′. Every method, A′ included, stops on an exact zero of
|
||||
the function it evaluates, and on the pure powers of the Chandrupatla
|
||||
set \(g\) is exactly linear, so the secant lands on the root: 15 of
|
||||
Brent's 20 runs and 4 of Chandrupatla's end that way there (A′: 2). On
|
||||
new corpus 1 no transformed run ends on a zero, and the transformation
|
||||
is still 3.4 times cheaper. A′ is far ahead of Chandrupatla on \(f\)
|
||||
itself, which does not know the multiplicity either. On the remaining
|
||||
problems the transformed and untransformed runs differ little and A′ is
|
||||
close to them: ahead on the canonical sets (2259 against 2640, 420
|
||||
against 437 for Chandrupatla on \(g\)), behind on corpora 1 and 4 (2061
|
||||
against 1924, 1497 against 1427). So on multiple roots the contribution
|
||||
of A′ is the estimate of the order without knowing it, and the gap to
|
||||
Table 11 is the price of that estimate --- large, and the clearest
|
||||
direction for improving the method.
|
||||
|
||||
\textbf{The multiplicity estimated during the run.} Between A′ and the
|
||||
oracle lies the natural classical method: Chandrupatla's interpolation
|
||||
on \(g=\operatorname{sign}(f)|f|^{1/\hat m}\) with \(\hat m\) estimated
|
||||
during the run. Our implementation of Chandrupatla's method (identical
|
||||
to the library on all 199 problems, and to itself when
|
||||
\(\hat m\equiv1\)) keeps the true \(f\) at its three points and reads
|
||||
\(G(v)=\operatorname{sign}(v)|v|^{1/\hat m}\) only in the acceptance
|
||||
band and the interpolation; \(\hat m\) starts at 1 and takes an order
|
||||
read from the last three evaluations whenever that order lies on a
|
||||
branch of §6.1 (\(m\ge2\) or \(0<m\le\tfrac23\)), without reset --- the
|
||||
hysteresis of the controls above. The order is read either by
|
||||
Lagouanelle's estimate or by A′'s own analogy (recorded in advance,
|
||||
\texttt{sweep\_estimated.py}):
|
||||
|
||||
\textbf{Table 12.} Chandrupatla on the transformed function: the
|
||||
multiplicity estimated during the run, against A′, the oracle of Table
|
||||
11 and Chandrupatla on \(f\). Totals, failures charged; the 148 multiple
|
||||
and fractional roots of Table 11, and the simple-root canonical set. The
|
||||
estimated forms have no exit: an order once taken is held to the end of
|
||||
the run. A′ leaves its regime by the exit of §6.2.
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.2000}}@{}}
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\raggedright
|
||||
method
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
corpus 4
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
six corpora
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
multiple/fractional (148)
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
APS
|
||||
\end{minipage} \\
|
||||
\midrule\noalign{}
|
||||
\endhead
|
||||
\bottomrule\noalign{}
|
||||
\endlastfoot
|
||||
\textbf{A′} & \textbf{3656} & \textbf{13032} & 4042 & \textbf{2259} \\
|
||||
Chandrupatla on \(g\), \(\hat m\) by analogy & 3806 & 15733 & 2809 &
|
||||
3453 \\
|
||||
Chandrupatla on \(g\), \(\hat m\) by Lagouanelle & 7526 & 30991 & 6041 &
|
||||
7215 \\
|
||||
the same, branch \(m\ge2\) only (post hoc) & 5568 & 18372 & 6540 &
|
||||
2960 \\
|
||||
Chandrupatla on \(g\), \(m^*\) known (Table 11) & --- & --- &
|
||||
\textbf{1355} & --- \\
|
||||
Chandrupatla on \(f\) & 5717 & 16481 & 7011 & 2595 \\
|
||||
\end{longtable}
|
||||
|
||||
A′ is ahead of both estimated forms on corpus 4, in total and problem by
|
||||
problem (against the analogy form 126/38/76, \(p=5\cdot10^{-4}\)), and
|
||||
over the six corpora. The two estimators behave differently in this
|
||||
frame. Lagouanelle's reads the parabola through Chandrupatla's points,
|
||||
which alternate sides of the root; there it reports a fractional order
|
||||
on 115 of the 154 simple roots of the canonical set, holds it, and turns
|
||||
the method into little more than bisection. Restricted after the fact to
|
||||
the branch \(m\ge2\) (post hoc,
|
||||
\texttt{POSTHOC\_lag\_branch\_2026-09-22.md}), it no longer breaks, but
|
||||
in this frame it hardly sees a multiple root either: 6540 on the 148
|
||||
multiple and fractional roots against 7011 for Chandrupatla on \(f\),
|
||||
and 5568 on corpus 4, with A′ ahead 178/34/28. The analogy's order is
|
||||
the better one here too, and on the multiple and fractional roots it
|
||||
does better inside Chandrupatla's interpolation than inside A′'s split:
|
||||
it closes 59\%, 58\% and 31\% of the gap from A′ to the oracle on the
|
||||
Chandrupatla set, corpus 1 and corpus 4 (322 against 654, 721 against
|
||||
1229, 1766 against 2159). It pays on simple roots, where it has no exit
|
||||
to take a false reading back (3453 against 2595 on the canonical set).
|
||||
Two conclusions follow. First, the order read by analogy transfers to
|
||||
the classical frame and works better there than in A′'s own split: on
|
||||
the multiple and fractional roots Chandrupatla's interpolation with that
|
||||
order beats A′ itself (2809 against 4042). Second, A′'s decision layer
|
||||
as a whole --- the detector together with its exit --- earns its place:
|
||||
without an exit the transferred detector loses more on simple roots than
|
||||
it gains on multiple ones, and A′ stays ahead on corpus 4 and over the
|
||||
six corpora.
|
||||
|
||||
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
|
||||
|
||||
@@ -1574,9 +1684,12 @@ translation, a simple root tends to the line, and the analogous pair
|
||||
reads the order that decides between the model and a split. The method
|
||||
built on it, A′, is ahead of Chandrupatla on both canonical sets, and on
|
||||
a corpus fixed before its code was frozen it needs 36\% fewer
|
||||
evaluations and wins 177 problems to 28. Its decision layer beats
|
||||
Lagouanelle's estimate, Chandrupatla's band and no detector put in its
|
||||
place; with the multiplicity known in advance the classical
|
||||
evaluations and wins 177 problems to 28. Its detector, the order read by
|
||||
analogy, beats Lagouanelle's estimate, Chandrupatla's band and no
|
||||
detector put in its place, and it transfers: inside Chandrupatla's
|
||||
interpolation on the transformed function it does better on multiple
|
||||
roots than A′'s own split, while only A′'s exit keeps simple roots
|
||||
cheap; with the multiplicity known in advance the classical
|
||||
transformation is 2.4 to 6.8 times cheaper on multiple roots, which
|
||||
measures what estimating the order costs. The claim the measurements
|
||||
support is a lead over Brent, TOMS 748, ITP and ModAB everywhere, within
|
||||
@@ -1592,9 +1705,7 @@ behind or level.
|
||||
|
||||
The first is the price of estimating the order. With the multiplicity
|
||||
given, the transformation of §6.3 is 2.4 to 6.8 times cheaper than A′ on
|
||||
multiple and fractional roots (Table 11): the order read from the
|
||||
analogous pair, or its use in the split, loses most of what the
|
||||
transformation could deliver.
|
||||
multiple and fractional roots (Table 11): closing that gap is open.
|
||||
|
||||
The second is the steep flank. Where the loss remains --- \texttt{fun9},
|
||||
the near-cancelling class, 4 − tan x at its pole --- the base step
|
||||
@@ -1616,10 +1727,12 @@ implementation of the base rule and of A′ (\texttt{simroot/pure.py});
|
||||
and Windows, Python 3.10 or later) whose results equal the reference bit
|
||||
for bit on all 868 problems of the six corpora; the corpora as code
|
||||
(\texttt{corpus\_*.py}); every sweep script with its results file; the
|
||||
pre-registrations with the commits of Appendix D; and
|
||||
advance records with the commits of Appendix D; and
|
||||
\texttt{verify\_article.py}, which recomputes or re-reads every number
|
||||
stated in this paper and is part of the test suite. All numbers come
|
||||
from one Linux machine (§4). Repository: ⟨repository URL⟩.
|
||||
stated in this paper and is part of the test suite. All of it is
|
||||
released under the Apache License 2.0. All numbers come from one Linux
|
||||
machine (§4). Archive (code, data and history):
|
||||
https://doi.org/10.5281/zenodo.22894337 (DOI 10.5281/zenodo.22894337).
|
||||
|
||||
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
|
||||
|
||||
@@ -2254,17 +2367,17 @@ results}\label{appendix-c.-negative-results}}
|
||||
\textbf{The decision reading ``defect'' does not transfer.} Combined
|
||||
with the regime it was the best configuration on the two development
|
||||
sets (§A.4's defect reading with the flat families of §6), and it
|
||||
passed every pre-registered criterion there. On new corpus 1 it did
|
||||
passed every criterion recorded for it there. On new corpus 1 it did
|
||||
not: per problem 95/33/78 against Chandrupatla (\(p=0.22\)), losing
|
||||
the class of exponential flanks 9 to 26. It is therefore not part of
|
||||
A′.
|
||||
\item
|
||||
\textbf{A component rejected alone can pay in combination.}
|
||||
Remembering the analogy for the run was rejected by its own
|
||||
pre-registration, under the harness scoring of the time (canonical set
|
||||
2814 against 2806 without the regime; under the sign-change criterion
|
||||
the two are level, 2633 against 2634), and with the split of §6.3 it
|
||||
is the better form (with the step pattern, wide brackets 1250 against
|
||||
Remembering the analogy for the run was rejected by its own advance
|
||||
record, under the harness scoring of the time (canonical set 2814
|
||||
against 2806 without the regime; under the sign-change criterion the
|
||||
two are level, 2633 against 2634), and with the split of §6.3 it is
|
||||
the better form (with the step pattern, wide brackets 1250 against
|
||||
1388 for the analogy read in one state). Composition was measured, not
|
||||
assumed, throughout --- which is also why §A.2's readings (2) and (3),
|
||||
each an improvement, are not combined.
|
||||
@@ -2272,9 +2385,9 @@ results}\label{appendix-c.-negative-results}}
|
||||
|
||||
\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}
|
||||
|
||||
\hypertarget{appendix-d.-pre-registrations-and-the-frozen-code}{%
|
||||
\subsection{Appendix D. Pre-registrations and the frozen
|
||||
code}\label{appendix-d.-pre-registrations-and-the-frozen-code}}
|
||||
\hypertarget{appendix-d.-advance-records-and-the-frozen-code}{%
|
||||
\subsection{Appendix D. Advance records and the frozen
|
||||
code}\label{appendix-d.-advance-records-and-the-frozen-code}}
|
||||
|
||||
Every rule of §6 and every test of §7 was written down, with its
|
||||
criteria and stop rule, before its code and its run. Table D1 gives, for
|
||||
@@ -2282,12 +2395,24 @@ each document, the commit that first added it and the commit that first
|
||||
added the results its run wrote, both read from git by
|
||||
\texttt{check\_prereg\_order.py}: 25 of the 30 were committed before
|
||||
their results; four were committed together with them, so git cannot
|
||||
order them; one was decided on its smoke run and has no results file.
|
||||
The code of A′ was committed (\texttt{8027d7f}) after corpus 4 was
|
||||
defined (\texttt{657df10}) and before its results (\texttt{6d2531e});
|
||||
order them; one was decided on its smoke run and has no results file. We
|
||||
call these documents advance records, not pre-registrations: they live
|
||||
in the author's repository, and their order relative to the runs is
|
||||
attested only by the author's git history, whose timestamps the author
|
||||
sets; no external registry was used. A deposit with an external
|
||||
timestamp (Zenodo, OSF) before a run would remove that limitation for
|
||||
future tests. Before publication the history was rewritten to remove
|
||||
infrastructure details (a server address) and working notes not meant
|
||||
for publication (a few files deleted; file names, comments and a few
|
||||
words in three advance records made neutral, cited commit hashes mapped
|
||||
to the new commits; no rule, criterion or number of a record changed);
|
||||
the commits cited here are those of the published history, in which
|
||||
\texttt{check\_prereg\_order.py} recomputes Table D1. The code of A′ was
|
||||
committed (\texttt{8027d7f}) after corpus 4 was defined
|
||||
(\texttt{657df10}) and before its results (\texttt{6d2531e});
|
||||
\texttt{simroot/pure.py} did not change in between.
|
||||
|
||||
\textbf{Table D1.} Pre-registrations, in the order they were written.
|
||||
\textbf{Table D1.} Advance records, in the order they were written.
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.3030}}
|
||||
@@ -2297,7 +2422,7 @@ defined (\texttt{657df10}) and before its results (\texttt{6d2531e});
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 8\tabcolsep) * \real{0.1313}}@{}}
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\raggedright
|
||||
pre-registration
|
||||
advance record
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
commit
|
||||
\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright
|
||||
|
||||
@@ -58,6 +58,8 @@ def ends_on_zero(method, f, g, a, b):
|
||||
|
||||
|
||||
def point4():
|
||||
"""Returns {corpus: {method: [problems, exact-zero stops, evaluations]}} and prints it."""
|
||||
out = {}
|
||||
for s in ("CHA", "NEW", "D"):
|
||||
tally = {"chandrupatla_g": [0, 0, 0], "brent_g": [0, 0, 0], "Aprime": [0, 0, 0]}
|
||||
for pid, f, a, b, r in k1_problems(s):
|
||||
@@ -78,6 +80,8 @@ def point4():
|
||||
t[2] += n
|
||||
print(f"{s}: problems {tally['Aprime'][0]}; runs ending on an exact zero / total evaluations: " +
|
||||
"; ".join(f"{k} {v[1]}/{v[2]}" for k, v in tally.items()))
|
||||
out[s] = tally
|
||||
return out
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -36,6 +36,7 @@ setup(
|
||||
name="simbracket",
|
||||
version="1.0.0",
|
||||
description="Bracketing root finding by similarity and analogy (compiled).",
|
||||
license="Apache-2.0",
|
||||
packages=["simbracket"],
|
||||
package_data={},
|
||||
include_package_data=False,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
10:04:29 up 20 days, 19:02, 5 users, load average: 0.19, 0.90, 0.86
|
||||
7 passed in 1.37s
|
||||
K3-L2 (post hoc): corpus 4 5568 six corpora 18372 multiple/fractional 6540 APS 2960
|
||||
A' on corpus 4 against it: 178/34/28 p=6.8e-28
|
||||
per corpus: APS 2960 CHA 1751 NEW 4698 RJL 1676 APP 1719 D 5568
|
||||
violations 0
|
||||
APS runs ending with m_hat != 1: 11 of 154
|
||||
posthoc done
|
||||
@@ -17,7 +17,8 @@ import math
|
||||
from .baselines import Counter, _Budget
|
||||
from .pure import _analogy_order, _config3, _lagouanelle_raw
|
||||
|
||||
ESTIMATORS = ("none", "lag", "analogy")
|
||||
# "lag2": POSTHOC_lag_branch_2026-09-22 - Lagouanelle on the branch m >= 2 only (post hoc)
|
||||
ESTIMATORS = ("none", "lag", "analogy", "lag2")
|
||||
|
||||
|
||||
def _G(v, inv):
|
||||
@@ -49,8 +50,10 @@ def chandrupatla_transformed(f, a, b, xtol, maxfev, estimator="none", stats=None
|
||||
if estimator == "none" or len(hist) < 3:
|
||||
return
|
||||
(xp2, fp2), (xp, fp), (xc, fc) = hist[-3], hist[-2], hist[-1]
|
||||
if estimator == "lag":
|
||||
if estimator in ("lag", "lag2"):
|
||||
m = _lagouanelle_raw(xc, fc, xp, fp, xp2, fp2)
|
||||
if estimator == "lag2" and m is not None and m < 2.0:
|
||||
m = None # the fractional branch is not used (post hoc variant)
|
||||
else:
|
||||
cur = _config3(xc, fc, xp, fp, xp2, fp2)
|
||||
m = _analogy_order(cur, configs, translation=True)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,84 @@
|
||||
"""POSTHOC_lag_branch_2026-09-22: Chandrupatla on sign(f)|f|^(1/m_hat) with Lagouanelle's estimate
|
||||
restricted to the branch m >= 2 (K3-L2), post hoc, with the harness of sweep_fourth.py. The
|
||||
registered K3 run (sweep_estimated.py / .json) is not touched.
|
||||
|
||||
python -u sweep_estimated_posthoc.py run -> sweep_estimated_posthoc.json, report
|
||||
python -u sweep_estimated_posthoc.py --report
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import json
|
||||
import sys
|
||||
from multiprocessing import Pool
|
||||
|
||||
import sweep_fourth
|
||||
import sweep_full
|
||||
from simroot.transformed import chandrupatla_transformed
|
||||
from sweep_controls import nonsimple
|
||||
from sweep_oos import sign_p
|
||||
|
||||
sweep_full.EXTRA_BASELINES["k3_lag2"] = functools.partial(chandrupatla_transformed, estimator="lag2")
|
||||
sweep_fourth.CONFIGS["k3_lag2"] = ("base", "k3_lag2")
|
||||
SETS = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
|
||||
|
||||
def job(which):
|
||||
return sweep_fourth.evaluate(("k3_lag2", which))[1]
|
||||
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
|
||||
|
||||
def held_on_simple_roots():
|
||||
"""How many APS runs end holding m_hat != 1 (fresh)."""
|
||||
n = 0
|
||||
for s, pid, f, a, b, _r in sweep_full.load_problems():
|
||||
if s != "APS":
|
||||
continue
|
||||
st = {}
|
||||
chandrupatla_transformed(f, a, b, 1e-12, 200, estimator="lag2", stats=st)
|
||||
n += st.get("m_hat", 1.0) != 1.0
|
||||
return n
|
||||
|
||||
|
||||
def report(R):
|
||||
seen = json.load(open("sweep_fourth_seen.json", encoding="utf8"))
|
||||
four = json.load(open("sweep_fourth_fourth.json", encoding="utf8"))
|
||||
ap = dict(seen["Aprime"])
|
||||
ap.update(four["Aprime"])
|
||||
K1 = json.load(open("sweep_controls.json", encoding="utf8"))["K1"]
|
||||
grp = sum(tot(R[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(R["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(R["D"][p]) for p in ps)
|
||||
print(f"K3-L2 (post hoc): corpus 4 {tot(R['D'])} six corpora {sum(tot(R[s]) for s in SETS)} "
|
||||
f"multiple/fractional {grp} APS {tot(R['APS'])}")
|
||||
print(f" A' on corpus 4 against it: {w}/{len(ps) - w - l}/{l} p={sign_p(w, l):.2g}")
|
||||
print(f" per corpus: " + " ".join(f"{s} {tot(R[s])}" for s in SETS))
|
||||
print(f" violations {sum(v[2] for s in SETS for v in R[s].values())}")
|
||||
print(f" APS runs ending with m_hat != 1: {held_on_simple_roots()} of 154")
|
||||
|
||||
|
||||
def main():
|
||||
if "--report" not in sys.argv:
|
||||
with Pool(2) as pool:
|
||||
parts = pool.map(job, ("seen", "fourth"))
|
||||
R = {}
|
||||
for p in parts:
|
||||
R.update(p)
|
||||
with open("sweep_estimated_posthoc.json", "w", encoding="utf8") as fh:
|
||||
json.dump(R, fh)
|
||||
with open("sweep_estimated_posthoc.json", encoding="utf8") as fh:
|
||||
R = json.load(fh)
|
||||
report(R)
|
||||
print("posthoc done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -23,6 +23,15 @@ def test_without_an_estimate_it_is_chandrupatla_bit_for_bit():
|
||||
assert not bad, bad[:5]
|
||||
|
||||
|
||||
def test_the_post_hoc_branch_never_holds_a_fractional_order():
|
||||
"""POSTHOC_lag_branch_2026-09-22: 'lag2' takes only readings m >= 2."""
|
||||
for s, pid, f, a, b, _r in PROBS:
|
||||
st = {}
|
||||
x, n, ok = chandrupatla_transformed(f, a, b, 1e-12, 200, estimator="lag2", stats=st)
|
||||
assert min(a, b) <= x <= max(a, b), pid
|
||||
assert st.get("m_hat", 1.0) == 1.0 or st["m_hat"] >= 2.0, (pid, st)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("estimator", ("lag", "analogy"))
|
||||
def test_with_an_estimate_it_still_brackets(estimator):
|
||||
for s, pid, f, a, b, _r in PROBS:
|
||||
|
||||
@@ -222,6 +222,8 @@ def main():
|
||||
verify_flat_regime_and_oos()
|
||||
verify_revision1()
|
||||
verify_controls()
|
||||
verify_revision2()
|
||||
verify_revision3()
|
||||
|
||||
print()
|
||||
if FAILS:
|
||||
@@ -1089,5 +1091,128 @@ def verify_controls():
|
||||
want)
|
||||
|
||||
|
||||
def verify_revision2():
|
||||
"""Revision 2 (points 3, 4, 5, 7)."""
|
||||
import math
|
||||
print("\nRevision 2:")
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
|
||||
def sign_p(w, l):
|
||||
k, n = min(w, l), w + l
|
||||
return min(1.0, 2.0 * sum(math.comb(n, i) for i in range(k + 1)) / 2.0 ** n)
|
||||
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
K = _load("sweep_estimated.json")
|
||||
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
|
||||
ap, ch = dict(seen["Aprime"]), dict(seen["chandrupatla"])
|
||||
ap.update(four["Aprime"])
|
||||
ch.update(four["chandrupatla"])
|
||||
K1 = _load("sweep_controls.json")["K1"]
|
||||
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
|
||||
|
||||
def group(r):
|
||||
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
rows = {"A'": ap, "K3A": K["k3_analogy"], "K3L": K["k3_lag"], "Ch(f)": ch}
|
||||
want = {"A'": (3656, 13032, 4042, 2259), "K3A": (3806, 15733, 2809, 3453),
|
||||
"K3L": (7526, 30991, 6041, 7215), "Ch(f)": (5717, 16481, 7011, 2595)}
|
||||
for k, r in rows.items():
|
||||
check(f"Table 12 {k}", (tot(r["D"]), sum(tot(r[s]) for s in sets), group(r), tot(r["APS"])), want[k])
|
||||
oracle = sum(tot(K1[s]["chandrupatla_g"], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]))
|
||||
for s in ("CHA", "NEW", "D"))
|
||||
check("Table 12 oracle row (Table 11 sum)", oracle, 1355)
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(K["k3_analogy"]["D"][p]) for p in ps)
|
||||
check("A' vs Chandrupatla-on-g with the analogy order, corpus 4", (w, len(ps) - w - l, l), (126, 38, 76))
|
||||
check("its p (1 digit)", f"{sign_p(w, l):.1g}", "0.0005")
|
||||
shares = []
|
||||
for s in ("CHA", "NEW", "D"):
|
||||
keep = lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p]) # noqa: E731
|
||||
a_, k_, o_ = tot(ap[s], keep), tot(K["k3_analogy"][s], keep), tot(K1[s]["chandrupatla_g"], keep)
|
||||
shares.append((k_, a_, round(100 * (a_ - k_) / (a_ - o_))))
|
||||
check("share of the A'-to-oracle gap closed by the analogy order", shares,
|
||||
[(322, 654, 59), (721, 1229, 58), (1766, 2159, 31)])
|
||||
check("K3 bound violations", sum(v[2] for k in K for s in sets for v in K[k][s].values()), 0)
|
||||
# Lagouanelle's fractional readings on the simple roots of the canonical set (fresh)
|
||||
from simroot.transformed import chandrupatla_transformed
|
||||
from sweep_full import load_problems
|
||||
frac = 0
|
||||
for s, pid, f, a, b, _r in load_problems():
|
||||
if s != "APS":
|
||||
continue
|
||||
st = {}
|
||||
chandrupatla_transformed(f, a, b, 1e-12, 200, estimator="lag", stats=st)
|
||||
m = st.get("m_hat", 1.0)
|
||||
frac += (0.0 < m <= 2.0 / 3.0)
|
||||
check("Lagouanelle holds a fractional order on simple APS roots", frac, 115)
|
||||
# point 4: exact-zero stops (fresh)
|
||||
import contextlib
|
||||
import io
|
||||
import diag_revision2
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
z = diag_revision2.point4()
|
||||
check("exact-zero stops on CHA: Brent(g), Chandrupatla(g), A'",
|
||||
(z["CHA"]["brent_g"][1], z["CHA"]["chandrupatla_g"][1], z["CHA"]["Aprime"][1]), (15, 4, 2))
|
||||
check("exact-zero stops of the transformed runs on corpus 1",
|
||||
(z["NEW"]["chandrupatla_g"][1], z["NEW"]["brent_g"][1]), (0, 0))
|
||||
check("corpus 1: transformation 3.4 times cheaper", round(1229 / 358, 1), 3.4)
|
||||
# point 3: the three unchanged rows of Table 2 (fresh)
|
||||
from corpus_roots_jl import solved
|
||||
from sweep_full import make_method
|
||||
f, a, b = next((f, a, b) for s, pid, f, a, b, _r in load_problems() if pid == "aps.13.00")
|
||||
got = []
|
||||
for name in ("dekker", "illinois", "regula_falsi"):
|
||||
x, n, conv = make_method(("base", name))(f, a, b, 1e-12, 200)
|
||||
got.append((name, int(n), bool(conv), bool(solved(f, float(x)))))
|
||||
check("aps.13.00: Dekker, Illinois, false position spend the budget unsolved",
|
||||
got, [("dekker", 200, False, False), ("illinois", 200, False, False),
|
||||
("regula_falsi", 200, False, False)])
|
||||
small = [abs(float(f(float(make_method(("base", nm))(f, a, b, 1e-12, 200)[0])))) < 1e-62
|
||||
for nm in ("dekker", "illinois")]
|
||||
check("Dekker and Illinois stall where |f| < 1e-62", small, [True, True])
|
||||
# point 7: Table 3's two added rows
|
||||
full = {r["label"]: r for r in _load("sweep_full.json")}
|
||||
for lb, want_ in (("pure.exp_abs.bracket.bracket", (1848, 45, 0)), ("pure.exp_abs.bracket.credit", (1952, 45, 0))):
|
||||
c = full[lb]["CHA"]
|
||||
check(f"Table 3 row {lb}", (c["total"], c["solved"], c["over"]), want_)
|
||||
|
||||
|
||||
def verify_revision3():
|
||||
"""Revision 3 (point 5): the post hoc branch m >= 2 and the reading of Table 12."""
|
||||
print("\nRevision 3:")
|
||||
|
||||
def cost(v):
|
||||
return v[0] if v[1] else 200
|
||||
|
||||
def tot(r, keep=None):
|
||||
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
|
||||
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
|
||||
P = _load("sweep_estimated_posthoc.json")
|
||||
K = _load("sweep_estimated.json")["k3_analogy"]
|
||||
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
|
||||
ap = dict(seen["Aprime"])
|
||||
ap.update(four["Aprime"])
|
||||
K1 = _load("sweep_controls.json")["K1"]
|
||||
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
|
||||
|
||||
def group(r):
|
||||
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
|
||||
check("Table 12 post hoc row", (tot(P["D"]), sum(tot(P[s]) for s in sets), group(P), tot(P["APS"])),
|
||||
(5568, 18372, 6540, 2960))
|
||||
ps = list(ap["D"])
|
||||
w = sum(cost(ap["D"][p]) < cost(P["D"][p]) for p in ps)
|
||||
l = sum(cost(ap["D"][p]) > cost(P["D"][p]) for p in ps)
|
||||
check("A' vs the post hoc variant on corpus 4", (w, len(ps) - w - l, l), (178, 34, 28))
|
||||
check("post hoc violations", sum(v[2] for s in sets for v in P[s].values()), 0)
|
||||
gain = group(ap) - group(K)
|
||||
loss = (sum(tot(K[s]) for s in sets) - group(K)) - (sum(tot(ap[s]) for s in sets) - group(ap))
|
||||
check("transferred detector: gain on multiple roots < loss elsewhere (vs A')", (gain, loss, gain < loss),
|
||||
(1233, 3934, True))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# Root Finding by Similarity and Analogy — code, data and history
|
||||
|
||||
Code, data and full development history for the paper *Root Finding by Similarity and Analogy: A
|
||||
Bracketing Method with a Data-Selected Decision Layer* (V. Sitnikov, 2026; manuscript, included in
|
||||
`source/article/`). Everything behind the paper is here, under the Apache License 2.0: the method's
|
||||
reference implementation, a compiled library of the proposed method A′, the benchmark harness, the
|
||||
problem corpora, every results file, the records written before each run, the manuscript itself, and
|
||||
the full development history.
|
||||
|
||||
## Contents
|
||||
|
||||
| path | what |
|
||||
|---|---|
|
||||
| `source/` | the repository at the commit the paper was built from: `simroot/` (the reference implementation of the base rule, A′ and every variant the paper measures), `lib/` (the source of the compiled library `simbracket`), the sweep scripts, corpora (`corpus_*.py`), diagnoses, the verifier `verify_article.py`, the tests, every results file (`sweep_*.json`, `results_*.txt`), the records written before the runs (`PREREG_*.md`, `POSTHOC_*.md`), the findings (`FINDINGS_*.md`) and the paper (`article/`) |
|
||||
| `sim-numerics.bundle` | the full git history of that branch (`git clone sim-numerics.bundle`); the commits cited in the paper's Appendix D are in it |
|
||||
| `wheels/` | `simbracket`, A′ as a compiled library (Python ≥ 3.10; Linux and Windows builds) |
|
||||
| `requirements.txt`, `reproduce.sh` | the Python packages used, and the one-command reproduction |
|
||||
| `SHA256SUMS` | checksums of every file in the archive |
|
||||
|
||||
## Requirements
|
||||
|
||||
**Linux x86_64 for reproducing the numbers.** The paper's numbers come from one Linux machine (Ubuntu
|
||||
24.04, glibc 2.39, Python 3.12.3). The test functions call the platform's `libm`, whose last digit
|
||||
differs between platforms; on Windows, TOMS 748 needs 2635 evaluations on the Alefeld–Potra–Shi set
|
||||
instead of 2636, and two of the paper's fresh recomputations move by a few evaluations. Using the
|
||||
method needs no particular platform.
|
||||
|
||||
## Reproduce
|
||||
|
||||
```bash
|
||||
./reproduce.sh
|
||||
```
|
||||
|
||||
creates a virtual environment, installs `requirements.txt` and the `simbracket` wheel, and in `source/`
|
||||
runs
|
||||
|
||||
1. `python -u verify_article.py` — recomputes or re-reads every number stated in the paper (548) and
|
||||
compares it with the value printed there; it ends with *every number stated in the paper matches the
|
||||
sweep data*;
|
||||
2. `python -m pytest tests/test_simbracket_equivalence.py` — the compiled library equals the reference
|
||||
implementation bit for bit, point and evaluation count, on all 868 problems of the six corpora.
|
||||
|
||||
Any table can be recomputed from scratch with its sweep script; each script's docstring names the table
|
||||
it produces (for example `python -u rescore_uniform.py` for the protocol tables, `python -u
|
||||
sweep_fourth.py --fourth` for corpus 4, `python -u sweep_controls.py` and `python -u sweep_estimated.py`
|
||||
for the controls). The full test suite is `python -m pytest tests`.
|
||||
|
||||
## Use A′ on your own problem
|
||||
|
||||
```python
|
||||
from simbracket import find_root, evaluation_bound
|
||||
|
||||
x, nfev, converged = find_root(f, a, b, xtol=1e-12, maxfev=200)
|
||||
# f(a) and f(b) of opposite signs; stops when the bracket is no wider than xtol or f(x) == 0;
|
||||
# never more than evaluation_bound(a, b, xtol) = 2*ceil(log2(|b-a|/xtol)) + 3 evaluations
|
||||
```
|
||||
|
||||
or, from source, `simroot.pure.pure_root` with the configuration named `APRIME` in `sweep_full.py`.
|
||||
|
||||
## The records and their order
|
||||
|
||||
`PREREG_*.md` were written, and committed, before the runs they describe; `POSTHOC_*.md` after, as
|
||||
marked. Appendix D of the paper lists each record with its commit and the commit of its results;
|
||||
`check_prereg_order.py` recomputes that table from the history in `sim-numerics.bundle`. The order is
|
||||
attested by the author's git history, not by an external registry. Before publication the history was
|
||||
rewritten to remove infrastructure details (a server address) and working notes not meant for
|
||||
publication (a few files deleted; file names, comments and a few words in three advance records made
|
||||
neutral, cited commit hashes mapped to the new commits; no rule, criterion or number of a record
|
||||
changed); the commit hashes cited in the paper are those of the rewritten history in this archive.
|
||||
|
||||
## Citing
|
||||
|
||||
The archive: https://doi.org/10.5281/zenodo.22894337 (DOI 10.5281/zenodo.22894337). Cite this archive by its DOI.
|
||||
|
||||
## Licence
|
||||
|
||||
Apache License 2.0 (`LICENSE`); copyright Valeri Sitnikov (`NOTICE`).
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Clean-room check of the Zenodo archive on Linux: unzip into an empty directory, install only the
|
||||
# simbracket wheel from the archive (dependencies from the existing environment, nothing downloaded),
|
||||
# run the verifier and the equivalence test from source/, and recompute Appendix D from the bundled
|
||||
# history. Usage: cleanroom_check.sh <zip>
|
||||
set -e
|
||||
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
|
||||
PY=~/torchenv/bin/python
|
||||
Z=$(readlink -f "$1")
|
||||
R=~/zenodo_cleanroom
|
||||
rm -rf $R && mkdir -p $R && cd $R
|
||||
$PY -c "import zipfile,sys; zipfile.ZipFile(sys.argv[1]).extractall('.')" "$Z"
|
||||
D=$(ls -d sim-numerics-*/)
|
||||
cd $R/$D
|
||||
echo "== checksums"; sha256sum -c --quiet SHA256SUMS && echo "all match"
|
||||
$PY -m pip install --quiet --no-deps --target $R/site wheels/simbracket-*-linux_x86_64.whl
|
||||
cd source
|
||||
export PYTHONPATH=$R/site:.
|
||||
$PY -c "import simbracket, simroot.pure; print('simbracket', simbracket.__file__); print('reference', simroot.pure.__file__)"
|
||||
echo "== verify_article.py"
|
||||
$PY -u verify_article.py > $R/verify.log 2>&1 || true
|
||||
echo "OK $(grep -c '^ OK' $R/verify.log) BAD $(grep -c '^ BAD' $R/verify.log)"
|
||||
grep '^ BAD' $R/verify.log || true
|
||||
grep -A6 '^Traceback' $R/verify.log || true
|
||||
tail -1 $R/verify.log
|
||||
echo "== equivalence test"
|
||||
$PY -m pytest tests/test_simbracket_equivalence.py -q -p no:cacheprovider 2>&1 | tail -1
|
||||
echo "== Appendix D from the bundled history"
|
||||
cd $R && git clone --quiet $R/$D/sim-numerics.bundle hist && cd hist
|
||||
$PY -u check_prereg_order.py | grep '^| `' > $R/appD_from_history.txt
|
||||
grep '^| `' $R/$D/source/results_prereg_order.txt > $R/appD_in_archive.txt
|
||||
if diff -q $R/appD_from_history.txt $R/appD_in_archive.txt; then echo "Appendix D reproduced from the history: identical"; else echo "Appendix D DIFFERS"; fi
|
||||
grep -c '^| `' $R/appD_from_history.txt
|
||||
echo "=== CLEANROOM DONE ==="
|
||||
@@ -0,0 +1,97 @@
|
||||
"""Build the Zenodo archive (open release, Apache-2.0): the repository at HEAD of release
|
||||
(`git archive`), its full history (`git bundle`), the simbracket wheels, README, requirements, the
|
||||
reproduction script, LICENSE, NOTICE and SHA256SUMS - zipped as sim-numerics-<version>.zip.
|
||||
|
||||
Refuses to build if the tree or the bundled history contains the server address or the
|
||||
specifics of the next method, if HEAD is not release, or if a text file of the archive has
|
||||
Windows line ends.
|
||||
|
||||
python -u zenodo/make_open_package.py 1.0.0
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
VERSION = sys.argv[1] if len(sys.argv) > 1 else "1.0.0"
|
||||
NAME = f"sim-numerics-{VERSION}"
|
||||
OUT = os.path.join(ROOT, "zenodo_build")
|
||||
PKG = os.path.join(OUT, NAME)
|
||||
# The strings that must appear in no commit are read from a file OUTSIDE the repository (named by
|
||||
# $ZENODO_FORBIDDEN): listing them here would put them into the history this check protects.
|
||||
FORBIDDEN_FILE = os.environ.get("ZENODO_FORBIDDEN", "")
|
||||
WHEELS = ["lib/dist/simbracket-1.0.0-cp310-abi3-linux_x86_64.whl",
|
||||
"lib/dist/simbracket-1.0.0-cp310-abi3-win_amd64.whl"]
|
||||
CRLF = bytes([13, 10])
|
||||
|
||||
|
||||
def git(*args, **kw):
|
||||
return subprocess.run(["git", "-C", ROOT, *args], check=True, capture_output=True, **kw)
|
||||
|
||||
|
||||
def main():
|
||||
branch = git("branch", "--show-current", text=True).stdout.strip()
|
||||
assert branch == "release", branch
|
||||
assert not git("status", "--porcelain", "--untracked-files=no", text=True).stdout.strip(), \
|
||||
"commit everything first: the archive is HEAD"
|
||||
assert FORBIDDEN_FILE and os.path.isfile(FORBIDDEN_FILE), "set ZENODO_FORBIDDEN to the private list"
|
||||
assert not os.path.abspath(FORBIDDEN_FILE).startswith(ROOT), "the list must live outside the repository"
|
||||
forbidden = [ln.strip() for ln in open(FORBIDDEN_FILE, encoding="utf8") if ln.strip()]
|
||||
for s in forbidden: # every commit of the branch
|
||||
hits = subprocess.run(["git", "-C", ROOT, "log", "release", "-p", "-S", s, "--format=%h"],
|
||||
capture_output=True, text=True, encoding="utf8").stdout.split()
|
||||
assert not hits, (s, hits[:3])
|
||||
if os.path.isdir(OUT):
|
||||
shutil.rmtree(OUT)
|
||||
os.makedirs(os.path.join(PKG, "wheels"))
|
||||
tar = os.path.join(OUT, "source.tar")
|
||||
# core.autocrlf=false: the archive carries the repository's LF line ends, not Windows' CRLF
|
||||
git("-c", "core.autocrlf=false", "archive", "--format=tar", "--prefix=source/", "-o", tar, "HEAD")
|
||||
shutil.unpack_archive(tar, PKG)
|
||||
os.remove(tar)
|
||||
# HEAD too, so that `git clone sim-numerics.bundle` checks the branch out
|
||||
git("bundle", "create", os.path.join(PKG, "sim-numerics.bundle"), "HEAD", "release")
|
||||
for w in WHEELS:
|
||||
shutil.copy(os.path.join(ROOT, w), os.path.join(PKG, "wheels"))
|
||||
src = os.path.join(PKG, "source") # from the archive: LF, exactly as committed
|
||||
for f in ("README.md", "requirements.txt", "reproduce.sh"):
|
||||
shutil.copy(os.path.join(src, "zenodo", f), os.path.join(PKG, f))
|
||||
for f in ("LICENSE", "NOTICE"):
|
||||
shutil.copy(os.path.join(src, f), os.path.join(PKG, f))
|
||||
bad = []
|
||||
for d, _, files in os.walk(PKG):
|
||||
for f in files:
|
||||
if f.endswith((".py", ".sh", ".md", ".txt")) or f in ("LICENSE", "NOTICE"):
|
||||
if CRLF in open(os.path.join(d, f), "rb").read():
|
||||
bad.append(os.path.relpath(os.path.join(d, f), PKG))
|
||||
assert not bad, ("Windows line ends", bad[:5])
|
||||
sums = []
|
||||
for d, _, files in os.walk(PKG):
|
||||
for f in sorted(files):
|
||||
p = os.path.join(d, f)
|
||||
rel = os.path.relpath(p, PKG).replace("\\", "/")
|
||||
sums.append(f"{hashlib.sha256(open(p, 'rb').read()).hexdigest()} {rel}")
|
||||
with open(os.path.join(PKG, "SHA256SUMS"), "w", encoding="ascii", newline="\n") as fh:
|
||||
fh.write("\n".join(sorted(sums, key=lambda s: s[66:])) + "\n")
|
||||
zp = os.path.join(OUT, NAME + ".zip")
|
||||
with zipfile.ZipFile(zp, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
for d, _, files in os.walk(PKG):
|
||||
for f in files:
|
||||
p = os.path.join(d, f)
|
||||
info = zipfile.ZipInfo.from_file(p, os.path.relpath(p, OUT).replace("\\", "/"))
|
||||
if f.endswith(".sh"):
|
||||
info.external_attr = 0o755 << 16
|
||||
with open(p, "rb") as src_fh:
|
||||
z.writestr(info, src_fh.read(), zipfile.ZIP_DEFLATED)
|
||||
head = git("rev-parse", "--short", "HEAD", text=True).stdout.strip()
|
||||
print(f"{zp}: {os.path.getsize(zp) / 1e6:.1f} MB, {len(sums)} files, source at {head}")
|
||||
print("zenodo package done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Reproduce the paper's numbers (Linux x86_64, Python 3.12). See README.md.
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
python3.12 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
python -m pip install --quiet -r requirements.txt
|
||||
python -m pip install --quiet --no-deps wheels/simbracket-*-linux_x86_64.whl
|
||||
export OMP_NUM_THREADS=1
|
||||
cd source
|
||||
echo "== verify_article.py (every number stated in the paper) =="
|
||||
python -u verify_article.py > ../verify.log 2>&1 || true
|
||||
echo "OK $(grep -c '^ OK' ../verify.log) BAD $(grep -c '^ BAD' ../verify.log)"
|
||||
tail -1 ../verify.log
|
||||
echo "== simbracket against the reference implementation, bit for bit =="
|
||||
python -m pytest tests/test_simbracket_equivalence.py -q -p no:cacheprovider | tail -1
|
||||
@@ -0,0 +1,5 @@
|
||||
numpy==2.4.3
|
||||
scipy==1.17.1
|
||||
mpmath==1.3.0
|
||||
pymodab==1.0.9
|
||||
pytest==9.1.1
|
||||
Reference in New Issue
Block a user