Simulations - justindbilyeu/REAL GitHub Wiki

Microtubule Dynamics

import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint plt.style.use('dark_background') # For GitHub's dark theme

======================

PHYSICAL PARAMETERS

======================

gamma = 0.1 # Dissipation coefficient (ps⁻¹) omega_MT = 40 # Microtubule resonant frequency (Hz) kappa = 0.3 # Nonlinear coupling strength (eV/nm⁴) E_ext = 0.05 # PEMF field strength (V/nm)

======================

SIMULATION SETUP

======================

def microtubule_model(y, t): """Differential equations for microtubule dynamics under PEMF""" q, p = y # Displacement (nm), Momentum (nm/ps) dqdt = p dpdt = (-gamma * p # Dissipative term - omega_MT2 * q # Harmonic potential + kappa * q3 # Nonlinear coupling + E_ext * np.sin(omega_MT * t)) # 40Hz PEMF driving return [dqdt, dpdt]

Time grid (0-100 picoseconds)

t = np.linspace(0, 100, 5000) # Increased resolution

======================

RUN SIMULATION

======================

solution = odeint(microtubule_model, [0.1, 0], t) # Initial conditions displacement = solution[:, 0]

======================

ENHANCED VISUALIZATION

======================

fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(12, 8), gridspec_kw={'height_ratios': [3, 1]})

Main plot

ax1.plot(t, displacement, color='#00FFFF', linewidth=2, label=f'ω_MT = {omega_MT}Hz, κ = {kappa} eV/nm⁴') ax1.set_title("Microtubule Coherence under 40Hz PEMF", fontsize=14, pad=20) ax1.set_ylabel("Displacement (nm)", fontsize=12) ax1.legend(loc='upper right') ax1.grid(alpha=0.3)

Spectral analysis inset

psd = np.abs(np.fft.fft(displacement))**2 freqs = np.fft.fftfreq(len(t), d=t[1]-t[0]) ax2.semilogy(freqs[freqs>0], psd[freqs>0], color='magenta') ax2.set_xlim(0, 100) ax2.set_xlabel("Frequency (Hz)", fontsize=12) ax2.set_ylabel("Power Spectrum", fontsize=10) ax2.axvline(40, color='yellow', linestyle='--', label='40Hz PEMF Driving') ax2.legend() ax2.grid(alpha=0.2)

plt.tight_layout()

======================

SAVE FOR WIKI

======================

plt.savefig("microtubule_coherence.png", dpi=300, transparent=True, bbox_inches='tight') plt.close()

print("Simulation complete! Image saved as microtubule_coherence.png")