if step % record_every == 0:
rho_final = np.sum(np.abs(Psi_v5)**2, axis=0)
g_00 = 1.0 - 2.0 * kappa_val * np.abs(Psi_v5[0])**2
A_theta = np.imag(np.conj(Psi_v5[3]) * np.gradient(Psi_v5[3], d_theta)
np.conj(Psi_v5[4]) * np.gradient(Psi_v5[4], d_theta))
f_eff_local = f * pure_sigma(alpha_local)
alpha_EM_inv = 1.0 / (C_norm * f_eff_local 1e-12)
history.append({
't': step * dt,
'rho_total': rho_final.copy(),
'sector0': np.abs(Psi_v5[0])**2,
'remnant': np.sum(np.abs(Psi_v5[1:])**2, axis=0),
'components': Psi_v5.copy(), # full complex for Re/Im
'alpha_local': alpha_local.copy(),
'alpha_EM_inv': alpha_EM_inv.copy(),
'g00': g_00.copy(),
'A_theta': A_theta.copy()
})
print(f"Recorded {len(history)} frames for animation.")
# ====================== ANIMATION ======================
fig, axs = plt.subplots(2, 2, figsize=(14, 10))
fig.suptitle("OUF-Hopf V5-MTT: LHC-calibrated evolution V5 components", fontsize=16)
def animate(frame):
data = history[frame]
t = data['t']
rho = data['rho_total']
alpha_EM = np.mean(data['alpha_EM_inv'])
brake_frac = np.mean(rho > rho_c)
# Top-left: density
axs[0,0].clear()
axs[0,0].plot(theta, rho, 'b-', lw=2.5)
axs[0,0].axhline(rho_c, color='r', ls='--')
axs[0,0].fill_between(theta, rho, rho_c, where=(rho > rho_c), color='red', alpha=0.15)
axs[0,0].set_title(f"Total Density Ļ(Īø) t={t:.3f}")
axs[0,0].set_ylabel("Density")
axs[0,0].grid(True, alpha=0.3)
# Top-right: sectors
axs[0,1].clear()
axs[0,1].plot(theta, data['sector0'], 'r-', label='Root 1 (spacetime)')
axs[0,1].plot(theta, data['remnant'], 'g--', label='Remnant (gauge)')
axs[0,1].set_title("V5 Sector Decomposition")
axs[0,1].legend()
axs[0,1].grid(True, alpha=0.3)
# Bottom-left: V5 components Re/Im
axs[1,0].clear()
for i in range(5):
re = np.real(data['components'][i])
im = np.imag(data['components'][i])
axs[1,0].plot(theta, re, label=f'ĪØ{i} Re', lw=1)
axs[1,0].plot(theta, im, label=f'ĪØ{i} Im', lw=1, ls='--')
axs[1,0].set_title("V5 Bundle Components (Re & Im)")
axs[1,0].set_xlabel(r"Īø ā S¹")
axs[1,0].grid(True, alpha=0.3)
if frame == 0:
axs[1,0].legend(fontsize=8, ncol=5, loc='upper right')
# Bottom-right: observables
axs[1,1].clear()
axs[1,1].plot(theta, data['alpha_EM_inv'], 'm-', label=r'1/α_EM')
axs[1,1].plot(theta, data['g00'], 'k-', label=r'gāā')
axs[1,1].plot(theta, data['A_theta'], 'c-', label=r'A_Īø')
axs[1,1].set_title(f"Emergent Observables α_EMā{alpha_EM:.2f} Brake={brake_frac:.2f}")
axs[1,1].legend()
axs[1,1].grid(True, alpha=0.3)
fig.suptitle(f"OUF-Hopf V5 Animation t = {t:.3f} meanĻ = {np.mean(rho):.3f} α = {np.mean(data['alpha_local']):.3f}")
return axs.flatten()
ani = FuncAnimation(fig, animate, frames=len(history), interval=80, repeat=True)
# Save animation (uncomment one)
#
ani.save('OUF_Hopf_V5_LHC_animation.gif', writer='pillow', fps=12) # GIF
#
ani.save('OUF_Hopf_V5_LHC_animation.mp4', writer='ffmpeg', fps=15) # MP4
plt.show()
# ====================== STATIC V5 ROOTS REFERENCE ======================
fig2, ax = plt.subplots(figsize=(6,4))
ax.scatter([r_real.real], [0], color='red', s=80, label='Real root (spacetime)')
for r in sorted_c:
ax.scatter([r.real], [r.imag], color='blue', s=60)
ax.scatter([r.real], [-r.imag], color='blue', s=60)
ax.set_xlabel("Real part")
ax.set_ylabel("Imag part")
ax.set_title("Fixed V5 Roots (irreducible representation)")
ax.grid(True)
ax.legend()
plt.show()