The 1st plot is, itself, only a slice of the greater script.
1st Plot:
2nd Plot:
The following was the wrong thread, but it is the thread that was provided with the video, so here it is again: ChatGPT - Golden Field Summary
THE CORRECT THREAD TO DESCRIBE WHAT’S GOING ON “UNDER THE HOOD” IS LOCATED HERE.
# tooeasy10000-truncated.py
import sympy as sp
import numpy as np
from sympy import sqrt, zeta, exp, I, pi, simplify, conjugate, Rational
from scipy.interpolate import interp1d
from scipy.optimize import root_scalar
# Constants
phi = float(sp.GoldenRatio)
sqrt5 = sqrt(5)
Ω = sp.Symbol("Ω")    # Field tension symbol
k = sp.Integer(-1)    # Radial exponent
r = 1                 # Radial unit
# Raw prime list (first 100 primes or more, truncated for brevity)
primes_raw = """
      2      3      5      7     11     13     17     19     23     29 
     31     37     41     43     47     53     59     61     67     71 
     73     79     83     89     97    101    103    107    109    113 
(TRUNCATED, BUT 10,000 PRIMES WERE INJECTED)
"""
primes = [int(p) for p in primes_raw.split()]
def prepare_prime_interpolation(primes_list=primes):
    indices = np.arange(1, len(primes_list) + 1)
    recursive_index_phi = np.log(indices + 1) / np.log(phi)
    return interp1d(recursive_index_phi, primes_list, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def solve_n_beta_for_prime(p_target, prime_interp, bracket=(0.1, 20)):
    def objective(n_beta): return P_nb(n_beta, prime_interp) - p_target
    result = root_scalar(objective, bracket=bracket, method='brentq')
    if result.converged:
        return result.root
    else:
        raise ValueError(f"Could not solve for n_beta corresponding to prime {p_target}")
def F_bin(x_val):
    return (phi**x_val - (-1/phi)**x_val) / sqrt5
def Pi_x(x_val, s):
    s = sp.sympify(s)
    return exp(I * pi * x_val) * zeta(s, Rational(1, 2))
def D_x(x_val, s, prime_interp):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    zeta_val = zeta(s)
    product = phi * F * 2**x_val * P * zeta_val * Ω
    return sqrt(product) * s**k
def F_x(x_val, s, prime_interp):
    return simplify(D_x(x_val, s, prime_interp) * Pi_x(x_val, s))
class GoldenClassField:
    def __init__(self, s_list, x_list, prime_interp):
        self.s_list = [sp.sympify(s) for s in s_list]
        self.x_list = x_list
        self.prime_interp = prime_interp
        self.field_generators = []
        self.field_names = []
        self.construct_class_field()
    def construct_class_field(self):
        for s in self.s_list:
            for x in self.x_list:
                f = F_x(x, s, self.prime_interp)
                self.field_generators.append(simplify(f))
                self.field_names.append(f"F_{x:.4f}_s_{s}")
    def as_dict(self):
        return dict(zip(self.field_names, self.field_generators))
    def display(self):
        for name, val in self.as_dict().items():
            print(f"{name} = {val}")
    def reciprocity_check(self):
        print("\nReciprocity Tests: F_x(s) * F_x(1-s)")
        for s in self.s_list:
            for x in self.x_list:
                try:
                    s_conj = 1 - s
                    prod = simplify(F_x(x, s, self.prime_interp) * F_x(x, s_conj, self.prime_interp))
                    print(f"x={x:.4f}, s={s}, F_x(s)·F_x(1-s) = {prod}")
                except Exception as e:
                    print(f"Failed for x={x}, s={s}: {e}")
def field_automorphisms(F_val, x_val, s, prime_interp):
    s = sp.sympify(s)
    return {
        "F_x(s)": simplify(F_x(x_val, s, prime_interp)),
        "F_x(1-s)": simplify(F_x(x_val, 1 - s, prime_interp)),
        "F_-x(s)": simplify(F_x(-x_val, s, prime_interp)),
        "conjugate(F)": simplify(conjugate(F_x(x_val, s, prime_interp))),
    }
def field_tension(F_val, C_val, m_val, s_val):
    # Example symbolic tension extraction formula
    return simplify((F_val * m_val * s_val) / (C_val**2))
if __name__ == "__main__":
    print("Preparing prime interpolation...")
    prime_interp = prepare_prime_interpolation()
    # Example Riemann zeta zeros (first two nontrivial zeros on critical line)
    zeros = [sp.sympify("0.5 + 14.134725*I"), sp.sympify("0.5 + 21.022040*I")]
    # Solve n_beta for a prime near 541 (to demonstrate root solving)
    try:
        x_541 = solve_n_beta_for_prime(541, prime_interp)
        print(f"Solved n+β for prime 541: {x_541:.6f}")
    except Exception as e:
        print(str(e))
        x_541 = None
    x_vals = [5, 10]
    if x_541:
        x_vals.append(x_541)
    # Construct Golden Class Field
    GCF = GoldenClassField(zeros, x_vals, prime_interp)
    GCF.display()
    # Reciprocity tests
    GCF.reciprocity_check()
    # Automorphisms on one example
    test_s = zeros[0]
    test_x = x_vals[1]
    auto = field_automorphisms(F_x(test_x, test_s, prime_interp), test_x, test_s, prime_interp)
    print("\nSymbolic Automorphisms:")
    for key, val in auto.items():
        print(f"{key}: {val}")
    # Example field tension calculation (symbolic)
    print("\nField Tension (Ω):")
    C = sp.Symbol('C')
    m = sp.Symbol('m')
    s_ = sp.Symbol('s')
    F_val = sp.Abs(F_x(test_x, test_s, prime_interp))
    tension = field_tension(F_val, C, m, s_)
    print(tension)
YIELDS:
py tooeasy10000full.py
Preparing prime interpolation...
Solved n+β for prime 541: 9.590622
F_5.0000_s_0.5 + 14.134725*I = 1.0*sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*(-0.217537177381404 + 6.14965635912474*I)*zeta(0.5 + 14.134725*I, 1/2)
F_10.0000_s_0.5 + 14.134725*I = 39.1462815355537*sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*(0.5 - 14.134725*I)*zeta(0.5 + 14.134725*I, 1/2)
F_9.5906_s_0.5 + 14.134725*I = 1.0*sqrt(Ω*(1.78610995454154e-6 - 1.12125725404408e-5*I))*(1.37320228847257 - 38.819673433861*I)*exp(9.5906215859709*I*pi)*zeta(0.5 + 14.134725*I, 1/2)
F_5.0000_s_0.5 + 21.02204*I = 1.0*sqrt(Ω*(8.98483605435458e-8 + 4.00709084764903e-7*I))*(-0.0984137961388264 + 4.13771751796451*I)*zeta(0.5 + 21.02204*I, 1/2)
F_10.0000_s_0.5 + 21.02204*I = 17.7097736442471*sqrt(Ω*(8.98483605435458e-8 + 4.00709084764903e-7*I))*(0.5 - 21.02204*I)*zeta(0.5 + 21.02204*I, 1/2)
F_9.5906_s_0.5 + 21.02204*I = 1.0*sqrt(Ω*(9.07062684366856e-6 + 4.04713570287637e-5*I))*(0.621236570695075 - 26.1193200772294*I)*exp(9.5906215859709*I*pi)*zeta(0.5 + 21.02204*I, 1/2)
Reciprocity Tests: F_x(s) * F_x(1-s)
x=5.0000, s=0.5 + 14.134725*I, F_x(s)·F_x(1-s) = 37.8655957588664*sqrt(Ω*(1.7674298413849e-8 + 1.11020289309231e-7*I))*sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*zeta(0.5 - 14.134725*I, 1/2)*zeta(0.5 + 14.134725*I, 1/2)
x=10.0000, s=0.5 + 14.134725*I, F_x(s)·F_x(1-s) = 306548.259725814*sqrt(Ω*(1.7674298413849e-8 + 1.11020289309231e-7*I))*sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*zeta(0.5 - 14.134725*I, 1/2)*zeta(0.5 + 14.134725*I, 1/2)
x=9.5906, s=0.5 + 14.134725*I, F_x(s)·F_x(1-s) = 1508.85273003668*sqrt(Ω*(1.78400002592542e-6 + 1.12129084385746e-5*I))*sqrt(Ω*(1.78610995454154e-6 - 1.12125725404408e-5*I))*exp(19.1812431719418*I*pi)*zeta(0.5 - 14.134725*I, 1/2)*zeta(0.5 + 14.134725*I, 1/2)
x=5.0000, s=0.5 + 21.02204*I, F_x(s)·F_x(1-s) = 17.1303915337408*sqrt(Ω*(8.98483605435458e-8 - 4.00709084764903e-7*I))*sqrt(Ω*(8.98483605435458e-8 + 4.00709084764903e-7*I))*zeta(0.5 - 21.02204*I, 1/2)*zeta(0.5 + 21.02204*I, 1/2)
x=10.0000, s=0.5 + 21.02204*I, F_x(s)·F_x(1-s) = 138682.400417811*sqrt(Ω*(8.98483605435458e-8 - 4.00709084764903e-7*I))*sqrt(Ω*(8.98483605435458e-8 + 4.00709084764903e-7*I))*zeta(0.5 - 21.02204*I, 1/2)*zeta(0.5 + 21.02204*I, 1/2)
x=9.5906, s=0.5 + 21.02204*I, F_x(s)·F_x(1-s) = 682.604816173527*sqrt(Ω*(9.07062684366856e-6 + 4.04713570287637e-5*I))*sqrt(Ω*(9.07824227657678e-6 - 4.04696494703687e-5*I))*exp(19.1812431719418*I*pi)*zeta(0.5 - 21.02204*I, 1/2)*zeta(0.5 + 21.02204*I, 1/2)
Symbolic Automorphisms:
F_x(s): 39.1462815355537*sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*(0.5 - 14.134725*I)*zeta(0.5 + 14.134725*I, 1/2)
F_x(1-s): 39.1462815355537*sqrt(Ω*(1.7674298413849e-8 + 1.11020289309231e-7*I))*(0.5 + 14.134725*I)*zeta(0.5 - 14.134725*I, 1/2)
F_-x(s): 1.0*sqrt(Ω*(-1.7674298413849e-8 + 1.11020289309231e-7*I))*(0.045424303171084 - 1.2841200672798*I)*zeta(0.5 + 14.134725*I, 1/2)
conjugate(F): 39.1462815355537*(0.5 + 14.134725*I)*conjugate(sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I)))*conjugate(zeta(0.5 + 14.134725*I, 1/2))
Field Tension (Ω):
553.668004968514*m*s*Abs(sqrt(Ω*(1.7674298413849e-8 - 1.11020289309231e-7*I))*zeta(0.5 + 14.134725*I, 1/2))/C**2
From this, we created these:
demo7.py
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from sympy import sqrt, zeta, exp, I, Rational
from scipy.interpolate import interp1d
# Constants
phi = float(sp.GoldenRatio)
sqrt5 = np.sqrt(5)
k = -1
def prepare_prime_interpolation(res=10000):
    indices = np.arange(1, res + 1)
    primes = [sp.prime(i) for i in indices]
    recursive_index_phi = np.log(indices + 1) / np.log(phi)
    return interp1d(recursive_index_phi, primes, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def F_bin(x_val):
    try:
        return (phi**x_val - (-1/phi)**x_val) / sqrt5
    except:
        return np.nan
def Pi_x(x_val, s):
    return sp.exp(sp.I * sp.pi * x_val) * zeta(s, Rational(1, 2))
def D_x(x_val, s, prime_interp, Ω=1):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    z_val = zeta(s)
    s_k = s**k
    product = phi * F * 2**x_val * P * z_val * Ω
    return sqrt(product) * s_k
def F_x(x_val, s, prime_interp, Ω=1):
    return D_x(x_val, s, prime_interp, Ω) * Pi_x(x_val, s)
# Parameters for grid
x_min, x_max = 1.0, 20.0
t_min, t_max = 0.1, 40.0
x_steps = 60
t_steps = 200
# Generate coordinate grids
x_vals = np.linspace(x_min, x_max, x_steps)
t_vals = np.linspace(t_min, t_max, t_steps)
X, T = np.meshgrid(x_vals, t_vals)
# Prepare prime interpolation
prime_interp = prepare_prime_interpolation(10000)
# Evaluate |F_x(0.5 + i t)| on the grid (numeric only for speed)
abs_F = np.zeros_like(X)
for i in range(t_steps):
    for j in range(x_steps):
        x = X[i, j]
        t = T[i, j]
        s = 0.5 + t * 1j
        try:
            val = F_x(x, s, prime_interp)
            mag = abs(complex(val.evalf()))
            abs_F[i, j] = mag if not np.isnan(mag) else 0
        except Exception:
            abs_F[i, j] = 0
# Transform x-axis to golden-logarithmic scale:
# safe +1 to avoid log(0)
X_phi_log = np.log(x_vals + 1) / np.log(phi)
# Plot 3D surface
fig = plt.figure(figsize=(12, 7))
ax = fig.add_subplot(projection='3d')
T_plot, X_phi_plot = np.meshgrid(t_vals, X_phi_log)
# Because X and T mesh are transposed, transpose abs_F to align:
abs_F_T = abs_F.T
surf = ax.plot_surface(X_phi_plot, T_plot, abs_F_T, cmap=cm.viridis, linewidth=0, antialiased=True)
ax.set_xlabel(r"Recursive coordinate $\log_{\phi}(x + 1)$")
ax.set_ylabel(r"Imaginary part of $s = 0.5 + it$")
ax.set_zlabel(r"$|F_x(s)|$ magnitude")
ax.set_title("Golden Recursive Algebra Field Magnitude Surface")
fig.colorbar(surf, shrink=0.5, aspect=10, label=r"$|F_x(s)|$")
plt.show()
WHICH YIELDS:
AND
animate4.py
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
from sympy import sqrt, zeta, exp, I, Rational
from scipy.interpolate import interp1d
import matplotlib.animation as animation
# Constants
phi = float(sp.GoldenRatio)
k = -1
def prepare_prime_interpolation(res=10000):
    indices = np.arange(1, res + 1)
    primes = [sp.prime(i) for i in indices]
    recursive_index_phi = np.log(indices + 1) / np.log(phi)
    return interp1d(recursive_index_phi, primes, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def F_bin(x_val):
    try:
        return (phi**x_val - (-1/phi)**x_val) / np.sqrt(5)
    except:
        return np.nan
def Pi_x(x_val, s):
    return sp.exp(sp.I * sp.pi * x_val) * zeta(s, Rational(1, 2))
def D_x(x_val, s, prime_interp, Ω=1):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    z_val = zeta(s)
    s_k = s**k
    product = phi * F * 2**x_val * P * z_val * Ω
    return sqrt(product) * s_k
def F_x(x_val, s, prime_interp, Ω=1):
    return D_x(x_val, s, prime_interp, Ω) * Pi_x(x_val, s)
# Parameters
x_min, x_max = 1.0, 20.0
t_min, t_max = 0.1, 40.0
t_steps = 300
x_frames = 60  # animation frames
# Prepare data
t_vals = np.linspace(t_min, t_max, t_steps)
prime_interp = prepare_prime_interpolation(10000)
# Precompute golden-log x for display axis
def golden_log(x):
    return np.log(x + 1) / np.log(phi)
# Setup plot
fig, ax = plt.subplots(figsize=(10,5))
line, = ax.plot([], [], lw=2)
ax.set_xlim(t_min, t_max)
ax.set_ylim(0, 1)
ax.set_xlabel("Imaginary part of s (t)")
ax.set_ylabel(r"$|F_x(0.5 + it)|$")
title = ax.set_title("")
# Initialization
def init():
    line.set_data([], [])
    return line,
# Animation update function
def animate(i):
    x = x_min + (x_max - x_min) * (i / (x_frames - 1))
    magnitudes = []
    for t in t_vals:
        s = 0.5 + t * I
        try:
            val = F_x(x, s, prime_interp)
            mag = abs(complex(val.evalf()))
            if np.isnan(mag) or np.isinf(mag):
                mag = 0
            magnitudes.append(mag)
        except Exception:
            magnitudes.append(0)
    magnitudes = np.array(magnitudes)
    line.set_data(t_vals, magnitudes)
    ymax = np.max(magnitudes)
    ax.set_ylim(0, ymax*1.1 if ymax > 0 else 1)
    ax.set_title(f"Golden Coord $\\log_{{\\phi}}(x+1)$ = {golden_log(x):.4f}   —   x = {x:.4f}")
    return line,
ani = animation.FuncAnimation(fig, animate, frames=x_frames, init_func=init,
                              blit=True, interval=100, repeat=True)
plt.tight_layout()
plt.show()
WHICH YIELDS:
AND
grok5.py
import sympy as sp
import numpy as np
from sympy import sqrt, zeta, exp, I, pi, simplify
from scipy.interpolate import interp1d
from scipy.optimize import root_scalar
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
import shutil
# Constants
phi = sp.GoldenRatio
sqrt5 = sp.sqrt(5)
Ω = 1.0  # Set Ω to a constant for numerical evaluation
k = -1   # Radial exponent
r = 1    # Radial unit
# Truncated prime list (using the provided primes)
primes_raw = """      2      3      5      7     11     13     17     19     23     29 
     31     37     41     43     47     53     59     61     67     71 
     73     79     83     89     97    101    103    107    109    113 
    127    131    137    139    149    151    157    163    167    173 
    179    181    191    193    197    199    211    223    227    229 
    233    239    241    251    257    263    269    271    277    281 
    283    293    307    311    313    317    331    337    347    349 
    353    359    367    373    379    383    389    397    401    409 
    419    421    431    433    439    443    449    457    461    463 
    467    479    487    491    499    503    509    521    523    541 
    547    557    563    569    571    577    587    593    599    601 
    607    613    617    619    631    641    643    647    653    659 
"""
primes = [int(p) for p in primes_raw.split()]
def prepare_prime_interpolation(primes_list=primes):
    indices = np.arange(1, len(primes_list) + 1)
    recursive_index_phi = np.log(indices + 1) / np.log(float(phi))
    return interp1d(recursive_index_phi, primes_list, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def F_bin(x_val):
    # Use sympy for numerical stability, return complex result
    phi_x = phi**x_val
    neg_phi_inv_x = (-1/phi)**x_val
    result = (phi_x - neg_phi_inv_x) / sqrt5
    return complex(result.evalf())  # Convert to complex number
def Pi_x(x_val, s):
    s = sp.sympify(s)
    return exp(I * pi * x_val) * zeta(s, sp.Rational(1, 2))
def D_x(x_val, s, prime_interp):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    zeta_val = zeta(s)
    product = float(phi) * F * 2**x_val * P * zeta_val * Ω
    return sqrt(product) * s**k
def F_x(x_val, s, prime_interp):
    return simplify(D_x(x_val, s, prime_interp) * Pi_x(x_val, s))
# Prepare interpolation
prime_interp = prepare_prime_interpolation()
# Parameters for the plot
s_val = sp.sympify("0.5 + 14.134725*I")  # First nontrivial zeta zero
x_vals = np.linspace(2, 5, 50)  # Reduced range to avoid numerical issues
t_vals = np.linspace(0, 2*np.pi, 20)  # Reduced frames for clarity
# Compute field values
def compute_field_values(x_vals, s_val, t):
    real_vals = []
    imag_vals = []
    for x in x_vals:
        try:
            f_val = F_x(x, s_val, prime_interp) * np.exp(1j * t)  # Add phase shift
            f_val = complex(f_val.evalf())  # Numerical evaluation
            real_vals.append(f_val.real)
            imag_vals.append(f_val.imag)
        except (ValueError, OverflowError, TypeError):
            real_vals.append(np.nan)  # Handle numerical errors gracefully
            imag_vals.append(np.nan)
    return np.array(real_vals), np.array(imag_vals)
# Store all spirals
spiral_data = []
for t in t_vals:
    real_vals, imag_vals = compute_field_values(x_vals, s_val, t)
    spiral_data.append((real_vals, imag_vals, x_vals))
# Set up the 3D plot
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
# Set labels and limits
ax.set_xlabel('Real(F_x)')
ax.set_ylabel('Imag(F_x)')
ax.set_zlabel('x')
ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
# Determine axis limits based on all spirals
all_real = np.concatenate([data[0] for data in spiral_data])
all_imag = np.concatenate([data[1] for data in spiral_data])
all_real = all_real[~np.isnan(all_real)]
all_imag = all_imag[~np.isnan(all_imag)]
if len(all_real) > 0 and len(all_imag) > 0:
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
else:
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
ax.set_zlim(min(x_vals), max(x_vals))
# Animation functions
def init():
    ax.clear()
    ax.set_xlabel('Real(F_x)')
    ax.set_ylabel('Imag(F_x)')
    ax.set_zlabel('x')
    ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
    ax.set_zlim(min(x_vals), max(x_vals))
    return []
def update(frame, x_vals, spiral_data):
    ax.clear()
    ax.set_xlabel('Real(F_x)')
    ax.set_ylabel('Imag(F_x)')
    ax.set_zlabel('x')
    ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
    ax.set_zlim(min(x_vals), max(x_vals))
    
    # Plot all spirals up to the current frame
    for i, (real_vals, imag_vals, x_vals) in enumerate(spiral_data[:frame + 1]):
        alpha = 0.2 + 0.8 * (i + 1) / len(t_vals)  # Increase opacity for newer spirals
        ax.plot(real_vals, imag_vals, x_vals, 'b-', lw=1, alpha=alpha)
    return []
# Create animation
ani = FuncAnimation(fig, update, frames=len(t_vals), init_func=init, fargs=(x_vals, spiral_data), blit=False, interval=300)
# Check for ffmpeg and save animation if available
if shutil.which('ffmpeg'):
    ani.save('gcf_animation_retained.mp4', writer='ffmpeg', dpi=100)
    print("Animation saved as 'gcf_animation_retained.mp4'")
else:
    print("ffmpeg not found. Saving static plot with all spirals instead.")
    for real_vals, imag_vals, x_vals in spiral_data:
        ax.plot(real_vals, imag_vals, x_vals, 'b-', lw=1, alpha=0.5)
    plt.savefig('gcf_static_plot_retained.png', dpi=100)
    print("Static plot saved as 'gcf_static_plot_retained.png'")
plt.show()
WHICH YIELDS:
For fun, I set OHM = -1 and radius = -1, I then added more steps (42 in place of 20):
import sympy as sp
import numpy as np
from sympy import sqrt, zeta, exp, I, pi, simplify
from scipy.interpolate import interp1d
from scipy.optimize import root_scalar
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
import shutil
# Constants
phi = sp.GoldenRatio
sqrt5 = sp.sqrt(5)
Ω = -1.0  # Set Ω to a constant for numerical evaluation
k = -1   # Radial exponent
r = phi    # Radial unit
# Truncated prime list (using the provided primes)
primes_raw = """      2      3      5      7     11     13     17     19     23     29 
     31     37     41     43     47     53     59     61     67     71 
     73     79     83     89     97    101    103    107    109    113 
    127    131    137    139    149    151    157    163    167    173 
    179    181    191    193    197    199    211    223    227    229 
    233    239    241    251    257    263    269    271    277    281 
    283    293    307    311    313    317    331    337    347    349 
    353    359    367    373    379    383    389    397    401    409 
    419    421    431    433    439    443    449    457    461    463 
    467    479    487    491    499    503    509    521    523    541 
    547    557    563    569    571    577    587    593    599    601 
    607    613    617    619    631    641    643    647    653    659 
"""
primes = [int(p) for p in primes_raw.split()]
def prepare_prime_interpolation(primes_list=primes):
    indices = np.arange(1, len(primes_list) + 1)
    recursive_index_phi = np.log(indices + 1) / np.log(float(phi))
    return interp1d(recursive_index_phi, primes_list, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def F_bin(x_val):
    # Use sympy for numerical stability, return complex result
    phi_x = phi**x_val
    neg_phi_inv_x = (-1/phi)**x_val
    result = (phi_x - neg_phi_inv_x) / sqrt5
    return complex(result.evalf())  # Convert to complex number
def Pi_x(x_val, s):
    s = sp.sympify(s)
    return exp(I * pi * x_val) * zeta(s, sp.Rational(1, 2))
def D_x(x_val, s, prime_interp):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    zeta_val = zeta(s)
    product = float(phi) * F * 2**x_val * P * zeta_val * Ω
    return sqrt(product) * s**k
def F_x(x_val, s, prime_interp):
    return simplify(D_x(x_val, s, prime_interp) * Pi_x(x_val, s))
# Prepare interpolation
prime_interp = prepare_prime_interpolation()
# Parameters for the plot
s_val = sp.sympify("0.5 + 14.134725*I")  # First nontrivial zeta zero
x_vals = np.linspace(2, 5, 50)  # Reduced range to avoid numerical issues
t_vals = np.linspace(0, 2*np.pi, 42)  # Reduced frames for clarity
# Compute field values
def compute_field_values(x_vals, s_val, t):
    real_vals = []
    imag_vals = []
    for x in x_vals:
        try:
            f_val = F_x(x, s_val, prime_interp) * np.exp(1j * t)  # Add phase shift
            f_val = complex(f_val.evalf())  # Numerical evaluation
            real_vals.append(f_val.real)
            imag_vals.append(f_val.imag)
        except (ValueError, OverflowError, TypeError):
            real_vals.append(np.nan)  # Handle numerical errors gracefully
            imag_vals.append(np.nan)
    return np.array(real_vals), np.array(imag_vals)
# Store all spirals
spiral_data = []
for t in t_vals:
    real_vals, imag_vals = compute_field_values(x_vals, s_val, t)
    spiral_data.append((real_vals, imag_vals, x_vals))
# Set up the 3D plot
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')
# Set labels and limits
ax.set_xlabel('Real(F_x)')
ax.set_ylabel('Imag(F_x)')
ax.set_zlabel('x')
ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
# Determine axis limits based on all spirals
all_real = np.concatenate([data[0] for data in spiral_data])
all_imag = np.concatenate([data[1] for data in spiral_data])
all_real = all_real[~np.isnan(all_real)]
all_imag = all_imag[~np.isnan(all_imag)]
if len(all_real) > 0 and len(all_imag) > 0:
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
else:
    ax.set_xlim(-1, 1)
    ax.set_ylim(-1, 1)
ax.set_zlim(min(x_vals), max(x_vals))
# Animation functions
def init():
    ax.clear()
    ax.set_xlabel('Real(F_x)')
    ax.set_ylabel('Imag(F_x)')
    ax.set_zlabel('x')
    ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
    ax.set_zlim(min(x_vals), max(x_vals))
    return []
def update(frame, x_vals, spiral_data):
    ax.clear()
    ax.set_xlabel('Real(F_x)')
    ax.set_ylabel('Imag(F_x)')
    ax.set_zlabel('x')
    ax.set_title(f'3D Animation of Golden Class Field (s = {s_val}) with Retained Spirals')
    ax.set_xlim(min(all_real) * 1.1, max(all_real) * 1.1)
    ax.set_ylim(min(all_imag) * 1.1, max(all_imag) * 1.1)
    ax.set_zlim(min(x_vals), max(x_vals))
    
    # Plot all spirals up to the current frame
    for i, (real_vals, imag_vals, x_vals) in enumerate(spiral_data[:frame + 1]):
        alpha = 0.2 + 0.8 * (i + 1) / len(t_vals)  # Increase opacity for newer spirals
        ax.plot(real_vals, imag_vals, x_vals, 'b-', lw=1, alpha=alpha)
    return []
# Create animation
ani = FuncAnimation(fig, update, frames=len(t_vals), init_func=init, fargs=(x_vals, spiral_data), blit=False, interval=300)
# Check for ffmpeg and save animation if available
if shutil.which('ffmpeg'):
    ani.save('gcf_animation_retained.mp4', writer='ffmpeg', dpi=100)
    print("Animation saved as 'gcf_animation_retained.mp4'")
else:
    print("ffmpeg not found. Saving static plot with all spirals instead.")
    for real_vals, imag_vals, x_vals in spiral_data:
        ax.plot(real_vals, imag_vals, x_vals, 'b-', lw=1, alpha=0.5)
    plt.savefig('gcf_static_plot_retained.png', dpi=100)
    print("Static plot saved as 'gcf_static_plot_retained.png'")
plt.show()
WHICH YIELDS:
And finally, when attempting to demonstrate our changing axes, we produce a crude version of the desired result:
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
from scipy.interpolate import interp1d
import shutil
# Constants
phi = float(sp.GoldenRatio)
sqrt5 = np.sqrt(5)
k = -1
Ω = -1.0
# Prime interpolation
def prepare_prime_interpolation(res=10000):
    indices = np.arange(1, res + 1)
    primes = [sp.prime(i) for i in indices]
    recursive_index_phi = np.log(indices + 1) / np.log(phi)
    return interp1d(recursive_index_phi, primes, kind='cubic', fill_value='extrapolate')
def P_nb(n_beta, prime_interp):
    return float(prime_interp(n_beta))
def F_bin(x_val):
    try:
        phi_x = sp.N(phi**x_val)  # SymPy numerical evaluation for stability
        neg_phi_inv_x = sp.N((-1/phi)**x_val)
        result = (phi_x - neg_phi_inv_x) / sqrt5
        return complex(result)
    except (ValueError, OverflowError, TypeError):
        return np.nan
def Pi_x(x_val, s):
    s = sp.sympify(s)
    return sp.exp(sp.I * sp.pi * x_val) * sp.zeta(s, sp.Rational(1, 2))
def D_x(x_val, s, prime_interp):
    s = sp.sympify(s)
    P = P_nb(x_val, prime_interp)
    F = F_bin(x_val)
    z_val = sp.zeta(s)
    s_k = s**k
    product = phi * F * 2**x_val * P * z_val * Ω
    return sp.sqrt(product) * s_k
def F_x(x_val, s, prime_interp):
    return D_x(x_val, s, prime_interp) * Pi_x(x_val, s)
# Prepare interpolation
prime_interp = prepare_prime_interpolation(10000)
# Parameters
s_val = sp.sympify("0.5 + 14.134725*I")  # First nontrivial zeta zero
x_vals = np.linspace(2, 5, 50)  # Reduced range for stability
t_vals = np.linspace(0.1, 40, 100)  # Reduced t-range for surface
morph_steps = 100  # Frames for morphing
morph_vals = np.sin(np.linspace(0, np.pi, morph_steps))**2  # Smooth oscillation
# Compute surface data (first script: |F_x(s)| at fixed s, varying t)
X_phi_log = np.log(x_vals + 1) / np.log(phi)  # Golden-logarithmic x
abs_F_surface = np.zeros((len(t_vals), len(x_vals)))
for i, t in enumerate(t_vals):
    for j, x in enumerate(x_vals):
        s = 0.5 + t * 1j
        try:
            val = F_x(x, s, prime_interp)
            mag = abs(complex(val.evalf()))
            abs_F_surface[i, j] = mag if not np.isnan(mag) else 0
        except Exception:
            abs_F_surface[i, j] = 0
# Compute spiral data (second script: Real(F_x), Imag(F_x) at fixed s, t=0)
real_F_spiral, imag_F_spiral = [], []
t_fixed = 0  # Fix t for spiral reference
for x in x_vals:
    try:
        f_val = F_x(x, s_val, prime_interp) * np.exp(1j * t_fixed)
        f_val = complex(f_val.evalf())
        real_F_spiral.append(f_val.real if not np.isnan(f_val.real) else 0)
        imag_F_spiral.append(f_val.imag if not np.isnan(f_val.imag) else 0)
    except Exception:
        real_F_spiral.append(0)
        imag_F_spiral.append(0)
real_F_spiral, imag_F_spiral = np.array(real_F_spiral), np.array(imag_F_spiral)
# Set up plot
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(111, projection='3d')
# Determine axis limits
x1_min, x1_max = min(X_phi_log), max(X_phi_log)
x2_min, x2_max = min(real_F_spiral) * 1.1, max(real_F_spiral) * 1.1
y1_min, y1_max = min(t_vals), max(t_vals)
y2_min, y2_max = min(imag_F_spiral) * 1.1, max(imag_F_spiral) * 1.1
z1_min, z1_max = min(abs_F_surface.flatten()) * 1.1, max(abs_F_surface.flatten()) * 1.1
z2_min, z2_max = min(x_vals), max(x_vals)
# Animation function
def update(frame):
    ax.clear()
    alpha = morph_vals[frame]
    
    # Select a single t-slice from surface data for morphing
    t_idx = frame % len(t_vals)  # Cycle through t for dynamic effect
    abs_F_slice = abs_F_surface[t_idx, :]
    
    # Interpolate axes
    x_coords = (1 - alpha) * X_phi_log + alpha * real_F_spiral
    y_coords = (1 - alpha) * np.full_like(x_vals, t_vals[t_idx]) + alpha * imag_F_spiral
    z_coords = (1 - alpha) * abs_F_slice + alpha * x_vals
    
    # Plot curve
    ax.plot(x_coords, y_coords, z_coords, 'b-', lw=2)
    
    # Update axis labels
    ax.set_xlabel(f'Morph: {"Log_φ(x+1)" if alpha < 0.5 else "Real(F_x)"}')
    ax.set_ylabel(f'Morph: {"t (Im(s))" if alpha < 0.5 else "Imag(F_x)"}')
    ax.set_zlabel(f'Morph: {"|F_x(s)|" if alpha < 0.5 else "x"}')
    
    # Update axis limits
    ax.set_xlim((1 - alpha) * x1_min + alpha * x2_min, (1 - alpha) * x1_max + alpha * x2_max)
    ax.set_ylim((1 - alpha) * y1_min + alpha * y2_min, (1 - alpha) * y1_max + alpha * y2_max)
    ax.set_zlim((1 - alpha) * z1_min + alpha * z2_min, (1 - alpha) * z1_max + alpha * z2_max)
    
    ax.set_title(f'Morphing Golden Class Field (α = {alpha:.2f}, t = {t_vals[t_idx]:.2f})')
    return []
# Create animation
ani = FuncAnimation(fig, update, frames=morph_steps, interval=50, blit=False)
# Save or display
if shutil.which('ffmpeg'):
    ani.save('morphing_waveforms.mp4', writer='ffmpeg', dpi=100)
    print("Animation saved as 'morphing_waveforms.mp4'")
else:
    print("ffmpeg not found. Displaying interactively.")
    plt.show()
WHICH YIELDS:
2025-07-04 17-16-37.mkv (7.3 MB)
          
  






































