#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ J3 Atomic v7.3 High-Res — Fourier T = 6 for 10 tables + ternary reporting in the {1, ω, ω²} basis Protocol: 1) For each window, three signals are computed separately: HIGH = B_HighRes / B_CALC from the PDF table LOW = public Low-Res Eq.(11) DELTA = HIGH - LOW 2) For the global 24-point windows: k_T6 = 24 / 6 = 4 The slow drift k = 1,2,3 and the fast parity component T=2, i.e. k=12, are removed. The remaining dominant bin must be k=4. 3) Z=1 exception: It is checked strictly on a local window of 6 consecutive nuclei, chosen to connect 3 AME2020 + 3 PREDICT points: Z=1, N=4..9, A=5..10 For 6 points: k_T6 = 6 / 6 = 1 Only the fast parity component T=2, i.e. k=3, is removed. 4) A303 / DELTA exception: For A303 / DELTA, a Hann window is applied to control spectral leakage. The rectangular audit remains reported, but the verdict uses Hann. HIGH and LOW for A303 remain rectangular, as in the standard protocol. 5) Ternary phases: For each signal HIGH / LOW / DELTA, the script reports: - the raw DFT phase φ_raw for the T = 6 bin - the ternary geometric phase φ_ternaryy in the {1,ω,ω²} basis The geometric verdict is based on φ_ternaryy, not on the absolute φ_raw. Ternary phase convention: Isobars -> 1 -> 0° Isodiapheres -> 1 -> 0° Isotopes -> ω -> +120° Isotones -> ω² -> -120° Extended Z axes -> ω -> +120° A303, A55 -> 1 -> 0° Local Z=1 -> local phases are computed from (N-Z) mod 3 """ import math from pathlib import Path # ============================================================ # Public Low-Res Eq.(11) — no external dependencies # ============================================================ av = 14.162583387860 as_param = 13.158674670391 apn = 0.053121502770 ac = 0.490593901884 gamma = -0.093053189811 alpha = -6.130686183439 beta = -0.006625198897 epsilon = 0.330014273949 TWO_PI = 2.0 * math.pi def j3_engine_mev_per_nucleon(Z: int, N: int) -> float: """Low-Res Eq.(11). Returns MeV/n.""" A = Z + N if A <= 1: return 0.0 Tv = av Ts = -as_param * (A ** (-1.0 / 3.0)) Tpn = apn * (Z * (A - Z)) / A Tc = -ac * (Z ** 2) / (A ** (4.0 / 3.0 + gamma)) Tasym = alpha * abs(A - 2 * Z) / A Tphase = beta * math.cos(TWO_PI * (N - Z) / 6.0) Teps = -epsilon * (A / 120.0) ** 2 return Tv + Ts + Tpn + Tc + Tasym + Tphase + Teps def j3_engine_keV_per_nucleon(Z: int, N: int) -> float: """Low-Res Eq.(11). Returns keV/n.""" return 1000.0 * j3_engine_mev_per_nucleon(Z, N) # ============================================================ # High-Res data: Z, N, A, SYMBOL, B_HIGH keV/n # ============================================================ DATASETS = { "Z1_LOCAL6": { "axis_type": "Local isotopes", "domain": "Z = 1, local N = 4 ... 9, A = 5 ... 10; 3 AME2020 + 3 PREDICT", "ternary_operator": "local Δ mod 3", "ternary_phase_deg": None, "expected_k": 1, "period_points": 6, "removed_bins": {3}, "verdict_window": "RECT", "data": """ 1 4 5 H 1336.359344 1 5 6 H 961.639480 1 6 7 H 940.213852 1 7 8 H -1236.561064 1 8 9 H -1352.744924 1 9 10 H -1897.964081 """, }, "Z94": { "axis_type": "Isotopes", "domain": "Z = 94, N = 136 ... 159", "ternary_operator": "ω", "ternary_phase_deg": +120.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 94 136 230 Pu 7591.001591 94 137 231 Pu 7587.122413 94 138 232 Pu 7588.983869 94 139 233 Pu 7583.796802 94 140 234 Pu 7584.606078 94 141 235 Pu 7578.879913 94 142 236 Pu 7577.919220 94 143 237 Pu 7570.759915 94 144 238 Pu 7568.361060 94 145 239 Pu 7560.318741 94 146 240 Pu 7556.043324 94 147 241 Pu 7546.439500 94 148 242 Pu 7541.328416 94 149 243 Pu 7531.008681 94 150 244 Pu 7524.815440 94 151 245 Pu 7513.282181 94 152 246 Pu 7506.540050 94 153 247 Pu 7493.380286 94 154 248 Pu 7645.258881 94 155 249 Pu 7616.549349 94 156 250 Pu 7611.625135 94 157 251 Pu 7585.265954 94 158 252 Pu 7580.216120 94 159 253 Pu 7558.684998 """, }, "Z118_OG283_306": { "axis_type": "Isotopes", "domain": "Z = 118, Og-283 ... Og-306", "ternary_operator": "ω", "ternary_phase_deg": +120.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 118 165 283 Og 7010.698613 118 166 284 Og 7015.498599 118 167 285 Og 6975.801448 118 168 286 Og 6980.238727 118 169 287 Og 6946.541133 118 170 288 Og 6950.839109 118 171 289 Og 6927.692406 118 172 290 Og 6931.998318 118 173 291 Og 6922.599679 118 174 292 Og 6926.975052 118 175 293 Og 7077.737131 118 176 294 Og 7079.355057 118 177 295 Og 7075.774066 118 178 296 Og 6962.129664 118 179 297 Og 6995.104261 118 180 298 Og 6999.294680 118 181 299 Og 7070.042525 118 182 300 Og 7103.718459 118 183 301 Og 7175.990846 118 184 302 Og 7191.232780 118 185 303 Og 7225.682898 118 186 304 Og 7203.142390 118 187 305 Og 7208.256476 118 188 306 Og 7176.604191 """, }, "N82": { "axis_type": "Isotones", "domain": "N = 82, Z = 50 ... 73", "ternary_operator": "ω²", "ternary_phase_deg": -120.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 50 82 132 Sn 8354.872637 51 82 133 Sb 8364.730209 52 82 134 Te 8383.644246 53 82 135 I 8384.760943 54 82 136 Xe 8396.188884 55 82 137 Cs 8388.958116 56 82 138 Ba 8393.422216 57 82 139 La 8377.998650 58 82 140 Ce 8376.304494 59 82 141 Pr 8353.985160 60 82 142 Nd 8346.030990 61 82 143 Pm 8317.734124 62 82 144 Sm 8303.679952 63 82 145 Eu 8269.274358 64 82 146 Gd 8249.507205 65 82 147 Tb 8206.624988 66 82 148 Dy 8180.943029 67 82 149 Ho 8133.255005 68 82 150 Er 8102.196241 69 82 151 Tm 8050.057603 70 82 152 Yb 8015.437118 71 82 153 Lu 7959.088164 72 82 154 Hf 7918.077308 73 82 155 Ta 7857.618092 """, }, "A55": { "axis_type": "Isobars", "domain": "A = 55, Z = 16 ... 39", "ternary_operator": "1", "ternary_phase_deg": 0.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 16 39 55 S 6930.256434 17 38 55 Cl 7278.870792 18 37 55 Ar 7586.012059 19 36 55 K 7792.499921 20 35 55 Ca 8125.925966 21 34 55 Sc 8333.369347 22 33 55 Ti 8518.969597 23 32 55 V 8637.339058 24 31 55 Cr 8731.936162 25 30 55 Mn 8765.024747 26 29 55 Fe 8746.598066 27 28 55 Co 8669.620375 28 27 55 Ni 8497.322521 29 26 55 Cu 8233.996963 30 25 55 Zn 7904.029844 31 24 55 Ga 7507.850853 32 23 55 Ge 7197.173422 33 22 55 As 6863.652117 34 21 55 Se 6483.463715 35 20 55 Br 6050.456521 36 19 55 Kr 5560.590437 37 18 55 Rb 5014.744545 38 17 55 Sr 4417.501282 39 16 55 Y 3775.149680 """, }, "D14": { "axis_type": "Isodiapheres", "domain": "Δ = N-Z = 14, Z,N = 20,34 ... 43,57", "ternary_operator": "1", "ternary_phase_deg": 0.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 20 34 54 Ca 8247.496710 21 35 56 Sc 8233.578090 22 36 58 Ti 8307.629003 23 37 60 V 8322.875071 24 38 62 Cr 8427.387145 25 39 64 Mn 8437.417521 26 40 66 Fe 8521.724500 27 41 68 Co 8520.130147 28 42 70 Ni 8604.291675 29 43 72 Cu 8586.525606 30 44 74 Zn 8642.754693 31 45 76 Ga 8624.527157 32 46 78 Ge 8671.663628 33 47 80 As 8651.282445 34 48 82 Se 8693.197297 35 49 84 Br 8671.329369 36 50 86 Kr 8712.029499 37 51 88 Rb 8681.115398 38 52 90 Sr 8696.004268 39 53 92 Y 8661.589385 40 54 94 Zr 8666.801593 41 55 96 Nb 8628.886846 42 56 98 Mo 8635.169143 43 57 100 Tc 8595.118362 """, }, "A54_100": { "axis_type": "Extended sequence / Isodiapheres", "domain": "A = 54 ... 100, Δ = 14", "ternary_operator": "1", "ternary_phase_deg": 0.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 20 34 54 Ca 8247.496710 21 35 56 Sc 8233.578090 22 36 58 Ti 8307.629003 23 37 60 V 8322.875071 24 38 62 Cr 8427.387145 25 39 64 Mn 8437.417521 26 40 66 Fe 8521.724500 27 41 68 Co 8520.130147 28 42 70 Ni 8604.291675 29 43 72 Cu 8586.525606 30 44 74 Zn 8642.754693 31 45 76 Ga 8624.527157 32 46 78 Ge 8671.663628 33 47 80 As 8651.282445 34 48 82 Se 8693.197297 35 49 84 Br 8671.329369 36 50 86 Kr 8712.029499 37 51 88 Rb 8681.115398 38 52 90 Sr 8696.004268 39 53 92 Y 8661.589385 40 54 94 Zr 8666.801593 41 55 96 Nb 8628.886846 42 56 98 Mo 8635.169143 43 57 100 Tc 8595.118362 """, }, "A303": { "axis_type": "Super-heavy isobars", "domain": "A = 303, Z,N = 107,196 ... 130,173", "ternary_operator": "1", "ternary_phase_deg": 0.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT_EXCEPT_DELTA_HANN", "data": """ 107 196 303 Bh 7208.286591 108 195 303 Hs 7220.633941 109 194 303 Mt 7238.226881 110 193 303 Ds 7258.985178 111 192 303 Rg 7283.421374 112 191 303 Cn 7304.436941 113 190 303 Nh 7312.129734 114 189 303 Fl 7293.667138 115 188 303 Mc 7241.324586 116 187 303 Lv 7188.629650 117 186 303 Ts 7188.452904 118 185 303 Og 7225.682898 119 184 303 ? 7240.186431 120 183 303 ? 7215.561298 121 182 303 ? 7169.450215 122 181 303 ? 7111.913170 123 180 303 ? 7085.814197 124 179 303 ? 7091.911540 125 178 303 ? 7089.564693 126 177 303 ? 7071.638731 127 176 303 ? 7025.817693 128 175 303 ? 6963.290800 129 174 303 ? 6890.594525 130 173 303 ? 6814.874147 """, }, "Z137": { "axis_type": "Heavy predictive isotopes", "domain": "Z = 137, N = 210 ... 233", "ternary_operator": "ω", "ternary_phase_deg": +120.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 137 210 347 ? 6752.732188 137 211 348 ? 6749.483224 137 212 349 ? 6745.953761 137 213 350 ? 6738.248622 137 214 351 ? 6730.699344 137 215 352 ? 6719.553630 137 216 353 ? 6709.199442 137 217 354 ? 6695.990741 137 218 355 ? 6684.331530 137 219 356 ? 6670.637135 137 220 357 ? 6659.281479 137 221 358 ? 6646.693368 137 222 359 ? 6637.170304 137 223 360 ? 6627.109273 137 224 361 ? 6620.690286 137 225 362 ? 6614.241045 137 226 363 ? 6611.793112 137 227 364 ? 6609.579553 137 228 365 ? 6611.466257 137 229 366 ? 6613.581265 137 230 367 ? 6619.623274 137 231 368 ? 6625.620950 137 232 369 ? 6635.120129 137 233 370 ? 6644.070969 """, }, "Z451": { "axis_type": "Isotopes / asymptotic frontier", "domain": "Z = 451, N = 803 ... 826", "ternary_operator": "ω", "ternary_phase_deg": +120.0, "expected_k": 4, "period_points": 24, "removed_bins": {1, 2, 3, 12}, "verdict_window": "RECT", "data": """ 451 803 1254 ? 10.741521 451 804 1255 ? 10.138149 451 805 1256 ? 9.213288 451 806 1257 ? 8.565618 451 807 1258 ? 7.597313 451 808 1259 ? 6.905624 451 809 1260 ? 5.894151 451 810 1261 ? 5.158722 451 811 1262 ? 4.104355 451 812 1263 ? 3.325461 451 813 1264 ? 2.228470 451 814 1265 ? 1.406384 451 815 1266 ? 0.267040 451 816 1267 ? -0.597968 451 817 1268 ? -1.779400 451 818 1269 ? -2.687060 451 819 1270 ? -3.910315 451 820 1271 ? -4.860363 451 821 1272 ? -6.125178 451 822 1273 ? -7.117350 451 823 1274 ? -8.423466 451 824 1275 ? -9.457500 451 825 1276 ? -10.804659 451 826 1277 ? -11.880296 """, }, } SIGNALS = ("HIGH", "LOW", "DELTA") # ============================================================ # Helpers — no numpy # ============================================================ def wrap_deg(x: float) -> float: y = (x + 180.0) % 360.0 - 180.0 if y <= -180.0: y += 360.0 return y def phase_for_delta_mod3(delta: int) -> float: r = delta % 3 if r == 0: return 0.0 if r == 1: return +120.0 return -120.0 def ternary_complex(phase_deg: float) -> complex: a = math.radians(phase_deg) return complex(math.cos(a), math.sin(a)) def parse_dataset(data_string: str): rows = [] for line in data_string.strip().splitlines(): parts = line.split() if len(parts) != 5: raise ValueError(f"Invalid line: {line!r}") Z = int(parts[0]) N = int(parts[1]) A = int(parts[2]) symbol = parts[3] b_high = float(parts[4]) if A != Z + N: raise ValueError(f"A != Z+N for line: {line!r}") rows.append((Z, N, A, symbol, b_high)) return rows def build_signals(rows): high = [] low = [] delta = [] table = [] for idx, (Z, N, A, symbol, b_high) in enumerate(rows): b_low = j3_engine_keV_per_nucleon(Z, N) d = b_high - b_low high.append(b_high) low.append(b_low) delta.append(d) table.append({ "idx": idx, "Z": Z, "N": N, "A": A, "symbol": symbol, "HIGH": b_high, "LOW": b_low, "DELTA": d, "delta_NZ": N - Z, "phase_local_deg": phase_for_delta_mod3(N - Z), }) return {"HIGH": high, "LOW": low, "DELTA": delta}, table def hann_window(n: int): if n <= 1: return [1.0] * n return [0.5 - 0.5 * math.cos(TWO_PI * i / (n - 1)) for i in range(n)] def apply_window(values, mode: str): if mode == "HANN": w = hann_window(len(values)) return [v * wi for v, wi in zip(values, w)] return list(values) def dft_k(values, k: int) -> complex: n_points = len(values) re = 0.0 im = 0.0 for n, value in enumerate(values): angle = TWO_PI * k * n / n_points re += value * math.cos(angle) im += -value * math.sin(angle) return complex(re, im) def dft_all(values): n_points = len(values) return {k: dft_k(values, k) for k in range(0, n_points)} def allowed_bins(n_points: int, removed_bins: set): max_k = n_points // 2 return [k for k in range(1, max_k + 1) if k not in removed_bins] def signal_window_mode(dataset_name: str, signal_name: str, cfg) -> str: if dataset_name == "A303" and signal_name == "DELTA": return "HANN" return "RECT" def analyze_signal(values, expected_k: int, removed_bins: set, window_mode: str): v = apply_window(values, window_mode) n_points = len(v) X = dft_all(v) max_k = n_points // 2 amps = {k: abs(X[k]) for k in range(1, max_k + 1)} candidates = allowed_bins(n_points, removed_bins) dominant_k = max(candidates, key=lambda k: amps[k]) X_expected = X[expected_k] phase_raw_deg = wrap_deg(math.degrees(math.atan2(X_expected.imag, X_expected.real))) return { "window_mode": window_mode, "n_points": n_points, "expected_k": expected_k, "removed_bins": removed_bins, "dominant_k": dominant_k, "period": n_points / dominant_k, "pass": dominant_k == expected_k, "X_expected": X_expected, "amp_expected": amps[expected_k], "phase_raw_deg": phase_raw_deg, "amps": amps, } def analyze_dataset(name: str, cfg): rows = parse_dataset(cfg["data"]) expected_len = cfg["period_points"] if len(rows) != expected_len: raise ValueError(f"{name}: expected {expected_len} points, got {len(rows)}") signals, table = build_signals(rows) sig_results = {} for sig in SIGNALS: mode = signal_window_mode(name, sig, cfg) sig_results[sig] = analyze_signal( signals[sig], expected_k=cfg["expected_k"], removed_bins=cfg["removed_bins"], window_mode=mode, ) # Rectangular audit for A303 / DELTA, so the raw leakage remains visible. if name == "A303" and sig == "DELTA": sig_results[sig]["rect_audit"] = analyze_signal( signals[sig], expected_k=cfg["expected_k"], removed_bins=cfg["removed_bins"], window_mode="RECT", ) return { "name": name, "cfg": cfg, "rows": rows, "table": table, "signals": signals, "signal_results": sig_results, } def fmt_complex(z: complex) -> str: re = 0.0 if abs(z.real) < 1e-12 else z.real im = 0.0 if abs(z.imag) < 1e-12 else z.imag return f"{re:+.12f} {im:+.12f}i" def print_local_phases_for_z1(r): print("Local Z=1 phases, computed through Δ=N-Z mod 3:") print(" n Z N A Δ=N-Z Δmod3 φ_local") for row in r["table"]: print( f" {row['idx']:1d} {row['Z']:1d} {row['N']:1d} {row['A']:2d}" f" {row['delta_NZ']:5d} {row['delta_NZ'] % 3:5d} {row['phase_local_deg']:+8.2f}°" ) print() def print_report(results): print("=" * 96) print("J3 ATOMIC v7.3 High-Res — Fourier T = 6 over 10 tables J3 HR + ternary phases") print("=" * 96) print("Scanned axes : fixed Z, fixed N, fixed A, and fixed Δ=N−Z") print("Signals analyzed separately : HIGH, LOW Eq.(11), DELTA = HIGH - LOW Eq.(11)") print("Z=1 : local 6-point check, N = 4 ... 9, 3 AME2020 + 3 PREDICT") print("A303/DELTA : Hann verdict for leakage control; rectangular audit shown separately") print("FFT cleaning : for W=24, remove the slow drift k=1,2,3 and parity k=12") print(" for W=6, remove only parity k=3") print("Phase : the geometric verdict of the axis is fixed in the ternary basis {1,ω,ω²}") print(" φ_raw DFT is only a local numerical audit of each window") print(" and is projected separately onto the 0°, +120°, -120° classes") print("=" * 96) print() all_pass = True for r in results: cfg = r["cfg"] print("-" * 96) print(f"{r['name']} — {cfg['axis_type']} — {cfg['domain']}") print("-" * 96) print(f" N_points = {cfg['period_points']} | k_T6 = {cfg['expected_k']} | removed = {sorted(cfg['removed_bins'])}") print() if r["name"] == "Z1_LOCAL6": print_local_phases_for_z1(r) if cfg["ternary_phase_deg"] is None: print("Global ternary geometric phase: local, computed point-by-point through Δ mod 3.") else: z = ternary_complex(cfg["ternary_phase_deg"]) print("Global ternary geometric phase:") print(f" operator = {cfg['ternary_operator']} | φ_ternary = {cfg['ternary_phase_deg']:+.2f}° | vector = {fmt_complex(z)}") print() print("Signal results:") for sig in SIGNALS: sr = r["signal_results"][sig] all_pass = all_pass and sr["pass"] print(f" [{sig}] mode={sr['window_mode']} | X_T6={fmt_complex(sr['X_expected'])}") print(f" |X_T6|={sr['amp_expected']:.12f} | φ_raw(T6)={sr['phase_raw_deg']:+.12f}°") print(f" dominant={sr['dominant_k']} | T={sr['period']:.6f} | {'PASS' if sr['pass'] else 'FAIL'}") if "rect_audit" in sr: ra = sr["rect_audit"] print(" RECT audit for A303/DELTA:") print(f" dominant_RECT={ra['dominant_k']} | T_RECT={ra['period']:.6f} | {'PASS' if ra['pass'] else 'FAIL'}") print(f" |X4_RECT|={ra['amps'].get(4, 0.0):.12f} | |X5_RECT|={ra['amps'].get(5, 0.0):.12f}") print(" kept amplitudes:") for k in sorted(sr["amps"]): flag = "REMOVED" if k in sr["removed_bins"] else "KEEP" mark = " <-- DOMINANT" if k == sr["dominant_k"] else "" t = sr["n_points"] / k print(f" k={k:2d} | T={t:8.4f} | |Xk|={sr['amps'][k]:14.6f} | {flag}{mark}") print() print("=" * 96) print("FINAL SUMMARY") print("=" * 96) print(f" Global verdict HIGH / LOW / DELTA = HIGH - LOW Eq.(11) : {'PASS' if all_pass else 'FAIL'}") print() print(" Summary table:") for r in results: line = f" {r['name']:<18s}" for sig in SIGNALS: sr = r["signal_results"][sig] line += f" | {sig}:{'PASS' if sr['pass'] else 'FAIL'}(k={sr['dominant_k']})" print(line) def main(): order = [ "Z1_LOCAL6", "Z94", "Z118_OG283_306", "N82", "A55", "D14", "A54_100", "A303", "Z137", "Z451", ] results = [analyze_dataset(name, DATASETS[name]) for name in order] print_report(results) if __name__ == "__main__": main()