#!/usr/bin/env python3
"""
quarks_in_spinning_nucleus.py

The nucleus as a spinning ball with quarks confined inside.
NOT planetary motion - quarks are trapped in the rotating volume.
"""

import numpy as np
import scipy.constants as const

def analyze_rotating_nucleus():
    """Analyze quarks inside a spinning nuclear ball"""
    
    print("QUARKS IN ROTATING NUCLEUS MODEL")
    print("="*60)
    print("Nucleus = spinning ball, quarks = confined inside")
    print()
    
    # Constants
    hbar = const.hbar
    c = const.c
    e = const.e
    mev_to_kg = e * 1e6 / c**2
    
    # Nuclear parameters
    r_proton = 0.875e-15  # m
    m_proton = const.m_p
    
    # Quark parameters
    m_quark = 336 * mev_to_kg  # constituent quark mass
    
    # If the proton spins with angular momentum ℏ/2 (spin-1/2)
    L_proton = hbar / 2
    I_proton = (2/5) * m_proton * r_proton**2  # solid sphere
    omega_nuclear = L_proton / I_proton
    
    print(f"Spinning proton:")
    print(f"  Radius: {r_proton*1e15:.3f} fm")
    print(f"  Angular velocity: ω = {omega_nuclear:.3e} rad/s")
    print(f"  Surface velocity: v = {omega_nuclear * r_proton / c:.3f}c")
    
    # Now, quarks INSIDE this spinning ball
    # They experience fictitious forces in the rotating frame!
    
    print(f"\nFor quarks inside the rotating nucleus:")
    
    # Centrifugal force on quark at radius r_q
    r_quark = 0.5 * r_proton  # quark somewhere inside
    F_centrifugal = m_quark * omega_nuclear**2 * r_quark
    
    # Coriolis force (depends on quark velocity in rotating frame)
    # Maximum when quark moves perpendicular to rotation
    v_quark_internal = 0.3 * c  # typical quark speed
    F_coriolis_max = 2 * m_quark * omega_nuclear * v_quark_internal
    
    print(f"  Quark at r = {r_quark*1e15:.3f} fm")
    print(f"  Centrifugal force: {F_centrifugal:.3e} N")
    print(f"  Max Coriolis force: {F_coriolis_max:.3e} N")
    
    # The key insight: confinement might emerge from rotation!
    # As quark tries to escape, it must overcome:
    # 1. Centrifugal barrier (increases with r)
    # 2. Coriolis deflection (curves trajectories)
    
    # Effective potential in rotating frame
    print(f"\nEffective confinement from rotation:")
    for r_test in [0.2, 0.5, 0.8]:
        r = r_test * r_proton
        V_centrifugal = -0.5 * m_quark * omega_nuclear**2 * r**2
        print(f"  At r = {r*1e15:.3f} fm: V = {V_centrifugal/e/1e6:.3f} MeV")
    
    # Compare to QCD string tension
    sigma = 0.18 * (e * 1e9 / 1e-15)  # GeV/fm to N
    F_qcd = sigma * r_proton
    
    print(f"\nComparison:")
    print(f"  Centrifugal force: {F_centrifugal:.3e} N")
    print(f"  QCD string force: {F_qcd:.3e} N")
    print(f"  Ratio: {F_centrifugal/F_qcd:.1%}")

def analyze_quark_trajectories():
    """What happens to quarks in rotating frame?"""
    
    print("\n\nQUARK BEHAVIOR IN ROTATING NUCLEUS")
    print("="*60)
    
    # In rotating reference frame, quarks experience:
    # F_total = F_real - m*Ω×(Ω×r) - 2m*Ω×v
    #         = F_real + F_centrifugal + F_coriolis
    
    print("In the rotating nuclear reference frame:")
    print("1. Centrifugal force pushes quarks outward")
    print("2. Coriolis force curves their trajectories")
    print("3. Together they create effective confinement!")
    print()
    print("Key insight: Rotation creates a 'potential well'")
    print("Quarks are trapped not by a force field,")
    print("but by the geometry of rotating spacetime!")

def main():
    analyze_rotating_nucleus()
    analyze_quark_trajectories()
    
    print("\n" + "="*70)
    print("REVOLUTIONARY IMPLICATION:")
    print("QCD confinement might be a ROTATING FRAME EFFECT!")
    print("The 'strong force' could be fictitious forces in spinning nuclei")
    print("This explains why free quarks don't exist - ")
    print("they only make sense in rotating reference frames!")

if __name__ == "__main__":
    main()
