Skip to content

Instantly share code, notes, and snippets.

@BrianMartell
Created December 14, 2025 03:59
Show Gist options
  • Select an option

  • Save BrianMartell/f7a079379afee417d1bd998ab20556f2 to your computer and use it in GitHub Desktop.

Select an option

Save BrianMartell/f7a079379afee417d1bd998ab20556f2 to your computer and use it in GitHub Desktop.
PUH-BrianMartell puh_dirac_equation_1d_simulation.py- Updated Py code
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# PUH v11: Toy 1D Dirac Sim — Chiral Propagation in Fold
hbar = 1 # Normalized
m = 0.5 # Knot mass
x = np.linspace(-10, 10, 1000)
# Dirac in 1D: i ∂_t ψ = -i ∂_x σ_z ψ + m σ_x ψ (toy 2-comp spinor)
def dirac_eq(psi, x):
dpsi_dx = 1j * np.array([[-psi[1]], [psi[0]]]) + m * np.array([[psi[1]], [psi[0]]]) # σ_z ∂_x + m σ_x
return dpsi_dx.flatten()
# Initial chiral left ψ_L = [1, 0] e^{ikx}
k = 1
psi0 = np.array([np.exp(1j * k * x[0]), 0])
# Integrate (toy odeint for spatial)
psi = odeint(dirac_eq, psi0, x).T # Transpose for components
plt.figure(figsize=(10,6))
plt.plot(x, np.abs(psi[0])**2, label='Left Chiral |ψ_L|^2', color='cyan', lw=2)
plt.plot(x, np.abs(psi[1])**2, label='Right Chiral |ψ_R|^2', color='gold', lw=2)
plt.xlabel('Position x'); plt.ylabel('Probability Density')
plt.title('PUH v11: Toy Dirac Propagation — Chiral Fold Projection')
plt.legend(); plt.grid(alpha=0.3)
plt.tight_layout()
plt.savefig('puh_dirac_equation_1d_simulation.png', dpi=300)
plt.show()
print("Chiral propagation: Left excess from T rotation — PUH asymmetry.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment