Download research/create_examples.py from PureOne/AEQORIA-Sharp-Holonomy-Observation: direct link, hf CLI and curl.
- Browser
- Download file 2.4 kB
-
https://huggingface.co/datasets/PureOne/AEQORIA-Sharp-Holonomy-Observation/resolve/main/research/create_examples.py
- Command line
-
hf download hf://datasets/PureOne/AEQORIA-Sharp-Holonomy-Observation/research/create_examples.py
-
curl -L -o create_examples.py https://huggingface.co/datasets/PureOne/AEQORIA-Sharp-Holonomy-Observation/resolve/main/research/create_examples.py
2.4 kB
| """Regenerate illustrative tables using 80-digit arithmetic. | |
| These evaluate the explicit circle design. They are not interval-certified | |
| finite-length global optima. No randomness, downloads, or external services. | |
| """ | |
| from pathlib import Path | |
| import csv | |
| import json | |
| import mpmath as mp | |
| def main() -> None: | |
| mp.mp.dps = 80 | |
| output = Path(__file__).resolve().parent / "results" | |
| output.mkdir(exist_ok=True) | |
| sigma = mp.mpf("0.0001") | |
| alpha = mp.mpf("0.05") | |
| quantile = mp.sqrt(2) * mp.erfinv(1 - 2 * alpha) | |
| rows = [] | |
| for parameter, length in [("0.5", "0.5"), ("0.1", "0.5"), | |
| ("0.01", "0.5"), ("0.5", "0.2"), | |
| ("0.5", "0.1"), ("0.001", "0.5")]: | |
| lam, ell = mp.mpf(parameter), mp.mpf(length) | |
| kappa = lam * (1-lam) | |
| z = kappa*ell**2/(4*mp.pi**2) | |
| beta = 2*mp.pi*z/(1+mp.sqrt(1-z)) | |
| deficit = 2*mp.sin(beta/2)**2 | |
| gram_min = mp.mpf(3)/2*mp.sin(beta)**2 | |
| condition = 2/mp.tan(beta)**2 | |
| real_samples = 4*sigma**2*quantile**2/deficit**2 | |
| rows.append({"lambda": parameter, "L": length, | |
| "kappa": mp.nstr(kappa, 30), | |
| "writer_angle": mp.nstr(beta, 35), | |
| "writer_deficit": mp.nstr(deficit, 35), | |
| "gram_min_d3": mp.nstr(gram_min, 35), | |
| "gram_condition_d3": mp.nstr(condition, 35), | |
| "real_sample_threshold": mp.nstr(real_samples, 35), | |
| "illustrative_ceiling": str(int(mp.ceil(real_samples)))}) | |
| with (output/"circle_examples.csv").open("w", newline="", encoding="utf-8") as f: | |
| writer = csv.DictWriter(f, fieldnames=list(rows[0])) | |
| writer.writeheader(); writer.writerows(rows) | |
| report = {"digits": 80, "sigma": str(sigma), "equal_prior_risk": str(alpha), | |
| "scope": "Explicit circle design; not certified finite-L global optima.", | |
| "rows": rows} | |
| (output/"circle_examples.json").write_text(json.dumps(report, indent=2), encoding="utf-8") | |
| for row in rows: | |
| print(row["lambda"], row["L"], | |
| "gap="+mp.nstr(mp.mpf(row["writer_deficit"]),7), | |
| "Gram="+mp.nstr(mp.mpf(row["gram_min_d3"]),7), | |
| "cond="+mp.nstr(mp.mpf(row["gram_condition_d3"]),7), | |
| "n="+row["illustrative_ceiling"]) | |
| if __name__ == "__main__": | |
| main() | |