FREE THE CAT NOTEBOOK - CORRECTED FROZEN CORE ENGINE

""" FINITE RESPONSE COUPLED MONAD DYNAMICS — CORRECTED FROZEN CORE ENGINE ===================================================================== This script evaluates the frozen core's 4-component tensor field on a periodic lattice. It produces observations, not verdicts. The engine does not interpret ontology. The record is written to disk as text. The verdict depends on runtime output only. Reference document: ##FINITE RESPONSE COUPLED MONAD DYNAM.txt Corrections applied from the 2026-09-26 audit: 1. I2 = Frobenius (was determinant) 2. KO sign: dissipative (was anti-diffusive) 3. Periodic grid: endpoint=False 4. Per-component operators (not uniform) 5. term3 uses I_k^2, not I_1^2 6. I3, I4 match the frozen core's definitions Separation: RECORD : text, written to disk, not interpreted ENGINE : code, computes numbers, does not read the record OUTPUT : observations, not verdicts """ import os import shutil import numpy as np from datetime import datetime # ============================================================================= # ENVIRONMENT # ============================================================================= try: from google.colab import drive, files IN_COLAB = True drive.mount('/content/drive') except ImportError: IN_COLAB = False print("Not in Colab. Drive and download steps will be simulated.") PROJECT_NAME = "FRCMD_FROZEN_CORE_CORRECTED" timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") output_dir = f"output_{timestamp}" os.makedirs(output_dir, exist_ok=True) print(f"Workspace: {output_dir}/") # ============================================================================= # FROZEN CORE CONSTANTS # ============================================================================= PHI = 1.618033988749895 PI_MAX = 5.9259 KO_SIGMA = 0.045 # frozen core coefficients (2026-07-26) ALPHA_HYB = 1.0 BETA_HYB = 0.1 GAMMA_HYB = 0.1 I_G = 1.0 MU = 1.0 LAM = 1.0 KAPPA_B = 0.1 LAM_REG = 0.01 ALPHA_0 = 0.4 DELTA_0 = 0.15 # ============================================================================= # PER-COMPONENT OPERATORS # ============================================================================= def dPhi_hyb_dP_yx(P_yx, I1): g = I1**2 / (I1**2 + I_G**2) abs_p = np.abs(P_yx) sign_p = np.sign(P_yx) num = 2.0 * P_yx * (1.0 + GAMMA_HYB * abs_p) - GAMMA_HYB * sign_p * P_yx**2 den = (1.0 + GAMMA_HYB * abs_p) ** 2 return ALPHA_HYB + g * BETA_HYB * num / den def frozen_core_operator(P_xx, P_xy, P_yx, P_yy, dx): """ Returns (dPxx_dt, dPxy_dt, dPyx_dt, dPyy_dt) for the frozen core. All four components are differentiated correctly. No shared operator. """ # --- Invariants (FIX 1 and FIX 6) --- I1 = P_xx + P_yy I2 = P_xx**2 + P_xy**2 + P_yx**2 + P_yy**2 # Frobenius I4 = P_xx**4 + P_yy**4 # frozen core I4 I3 = P_xx * P_yy - P_xy * P_yx # frozen core I3 (abandoned) # I1^{-1/2} guard I1_safe = np.clip(I1, 1e-12, None) # --- Finite-response difference (per component, periodic) --- def D(f): return (np.roll(f, -1) - np.roll(f, 1)) / (2.0 * dx) # --- Nonlinear interaction operator C(Π) per component (FIX 4) --- def C_term(P_comp, D_P): I_k = P_comp * D_P term1 = 0.2 * (D_P * I1) term2 = 0.2 * (I2 - I1) * (I1 + I2) term3 = 0.1 * (I_k ** 2) # FIX 5: I_k^2, not I_1^2 term4 = ((1.0 / PI_MAX) * (I1_safe**(-0.5) - 1.0) * np.exp(-0.5 * (I2**2 + I3**3 + I4**4)) * P_comp) return term1 + term2 + term3 + term4 dPxx = C_term(P_xx, D(P_xx)) dPxy = C_term(P_xy, D(P_xy)) dPyx = C_term(P_yx, D(P_yx)) dPyy = C_term(P_yy, D(P_yy)) # --- Antisymmetric stress contribution to dPyx (FIX 4, explicit) --- dPyx = dPyx + dPhi_hyb_dP_yx(P_yx, I1) # --- Kreiss-Oliger dissipation (FIX 2: dissipative sign) --- def KO(f): stencil = (np.roll(f, -2) - 4.0*np.roll(f, -1) + 6.0*f - 4.0*np.roll(f, 1) + np.roll(f, 2)) return KO_SIGMA * stencil / (dx**4) dPxx = dPxx - KO(P_xx) dPxy = dPxy - KO(P_xy) dPyx = dPyx - KO(P_yx) dPyy = dPyy - KO(P_yy) return dPxx, dPxy, dPyx, dPyy # ============================================================================= # INTEGRATION # ============================================================================= def run_frozen_core(N=256, L=20.0, steps=5000): # FIX 3: periodic grid — endpoint=False x = np.linspace(-L/2, L/2, N, endpoint=False) dx = L / N # CFL-justified time step dt = 0.005 * (dx ** 2) # Initial 4-component state, PHI baseline P_xx = PHI + np.exp(-(x + 3.0)**2) P_yy = PHI + np.exp(-(x - 3.0)**2) P_xy = np.zeros(N) P_yx = np.zeros(N) history = {} diagnostics = [] unstable = False print(f"Frozen core: N={N}, dx={dx:.6f}, dt={dt:.6e}, steps={steps}") for step in range(steps + 1): dPxx, dPxy, dPyx, dPyy = frozen_core_operator(P_xx, P_xy, P_yx, P_yy, dx) P_xx = P_xx + dt * dPxx P_xy = P_xy + dt * dPxy P_yx = P_yx + dt * dPyx P_yy = P_yy + dt * dPyy if step % 500 == 0: m_xx = float(np.max(np.abs(P_xx))) m_yx = float(np.max(np.abs(P_yx))) r_xx = float(np.max(np.abs(dPxx))) line = (f"Step {step:04d} | max|Pxx|={m_xx:.6e} | " f"max|Pyx|={m_yx:.6e} | max|dPxx/dt|={r_xx:.6e}") diagnostics.append(line) print(line) history[step] = P_xx.copy() if not (np.isfinite(P_xx).all() and np.isfinite(P_yy).all() and np.isfinite(P_xy).all() and np.isfinite(P_yx).all()): line = f"CRITICAL: non-finite value at step {step}. Aborting." diagnostics.append(line) print(line) unstable = True break return x, history, diagnostics, unstable # ============================================================================= # RUN # ============================================================================= x_grid, evolution, diags, unstable = run_frozen_core() # ============================================================================= # OBSERVATION RECORD (no verdicts) # ============================================================================= obs_path = os.path.join(output_dir, "observation.json") with open(obs_path, "w") as f: import json json.dump({ "engine": "frozen_core_corrected", "N": int(len(x_grid)), "steps_run": len(diags), "unstable": bool(unstable), "diagnostics": diags, "status": "OBSERVATION_ONLY", }, f, indent=2) report_path = os.path.join(output_dir, "diagnostics.txt") with open(report_path, "w") as f: f.write("FRCMD FROZEN CORE — OBSERVATION LOG\n") f.write("===================================\n\n") for line in diags: f.write(line + "\n") f.write("\n") if unstable: f.write("STATUS: non-finite value encountered. Run aborted.\n") else: f.write("STATUS: all scheduled steps completed. No non-finite values.\n") f.write("This is an observation. Not a verdict on the axiom.\n") # ============================================================================= # PRESERVATION # ============================================================================= zip_base = f"{PROJECT_NAME}_{timestamp}" zip_path = shutil.make_archive(zip_base, 'zip', output_dir) drive_ok = False if IN_COLAB: try: drive_dir = f"/content/drive/MyDrive/{PROJECT_NAME}/{output_dir}" os.makedirs(drive_dir, exist_ok=True) for item in os.listdir(output_dir): shutil.copy2(os.path.join(output_dir, item), os.path.join(drive_dir, item)) shutil.copy2(zip_path, f"/content/drive/MyDrive/{PROJECT_NAME}/{zip_base}.zip") drive_ok = True except Exception as e: print(f"Drive backup failed: {e}") download_ok = False if IN_COLAB: try: files.download(zip_path) download_ok = True except Exception as e: print(f"Download failed: {e}") # ============================================================================= # BENCH READOUT # ============================================================================= print() print("=" * 70) print(" FRCMD FROZEN CORE — BENCH READOUT") print("=" * 70) print(f" Output directory : {os.path.abspath(output_dir)}") print(f" ZIP archive : {os.path.abspath(zip_path)}") print(f" Drive backup : {drive_ok}") print(f" Download : {download_ok}") print(f" Steps completed : {len(diags)}") print(f" Unstable : {unstable}") print(f" Files in output : {len(os.listdir(output_dir))}") print(f" Archive size : {os.path.getsize(zip_path)} bytes") print("=" * 70)

Popular posts from this blog

THE GOLDEN BALLROOM/BUNKER

Conceptual Summary #2: (∂t2​S−c2∇2S+βS3)=σ(x,t)⋅FR​(C[Ψ])

ICE PROUDLY ANNOUNCES NEW “ELITE” TASK FORCE COMMANDER JEREMY DEWITTE