spin_paper/short/clean_numbers_only_script.py

212 lines
7.0 KiB
Python

#!/usr/bin/env python3
"""
clean_numbers_only_script.py
Mathematical verification showing only calculated results.
NO conclusions, NO claims - just numbers.
Author: Andre Heinecke & AI Collaborators
Date: June 2025
License: CC BY-SA 4.0
"""
import numpy as np
import sys
# Physical constants (CODATA 2018 values)
HBAR = 1.054571817e-34 # J*s (reduced Planck constant)
ME = 9.1093837015e-31 # kg (electron mass)
E = 1.602176634e-19 # C (elementary charge)
K = 8.9875517923e9 # N*m^2/C^2 (Coulomb constant)
A0 = 5.29177210903e-11 # m (Bohr radius)
ALPHA = 1/137.035999084 # Fine structure constant
def calculate_z_eff_slater(Z):
"""Calculate effective nuclear charge using Slater's rules (simplified)"""
if Z == 1:
return 1.0
else:
screening = 0.31 + 0.002 * (Z - 2) / 98
return Z - screening
def relativistic_gamma(Z, n=1):
"""Calculate relativistic correction factor"""
v_over_c = Z * ALPHA / n
if v_over_c < 0.1:
gamma = 1 + 0.5 * v_over_c**2
else:
gamma = 1 / np.sqrt(1 - v_over_c**2)
if Z > 70:
qed_correction = 1 + ALPHA**2 * (Z/137)**2 / 8
gamma *= qed_correction
return gamma
def calculate_forces(Z):
"""Calculate both forces for element Z"""
Z_eff = calculate_z_eff_slater(Z)
r = A0 / Z_eff
gamma = relativistic_gamma(Z, n=1)
# Calculate forces
F_centripetal = HBAR**2 / (gamma * ME * r**3)
F_coulomb = K * Z_eff * E**2 / (gamma * r**2)
ratio = F_centripetal / F_coulomb
deviation_ppb = abs(1 - ratio) * 1e9
return {
'Z': Z,
'Z_eff': Z_eff,
'r_m': r,
'r_pm': r * 1e12,
'gamma': gamma,
'F_centripetal': F_centripetal,
'F_coulomb': F_coulomb,
'ratio': ratio,
'deviation_ppb': deviation_ppb,
'agreement_percent': ratio * 100
}
def verify_bohr_radius():
"""Calculate Bohr radius from force balance"""
print("Bohr radius calculation:")
print("Force balance: hbar^2/(m*r^3) = k*e^2/r^2")
print("Solving for r: r = hbar^2/(m*k*e^2)")
a0_calculated = HBAR**2 / (ME * K * E**2)
a0_defined = A0
agreement = a0_calculated / a0_defined
print(f"a0 calculated = {a0_calculated:.11e} m")
print(f"a0 defined = {a0_defined:.11e} m")
print(f"ratio = {agreement:.15f}")
print()
def analyze_element(Z, element_name=""):
"""Show detailed analysis for one element"""
result = calculate_forces(Z)
print(f"{element_name} (Z = {Z}):")
print(f" Z_eff = {result['Z_eff']:.6f}")
print(f" radius = {result['r_pm']:.3f} pm = {result['r_m']:.6e} m")
print(f" gamma = {result['gamma']:.6f}")
print(f" F_centripetal = {result['F_centripetal']:.6e} N")
print(f" F_coulomb = {result['F_coulomb']:.6e} N")
print(f" ratio = {result['ratio']:.15f}")
print(f" agreement = {result['agreement_percent']:.13f}%")
print(f" deviation = {result['deviation_ppb']:.3f} ppb")
print()
def verify_all_elements():
"""Calculate forces for all elements and show statistics"""
print("Verification across periodic table:")
print("Formula: F = hbar^2/(gamma*m*r^3) vs F = k*e^2/r^2")
print()
element_names = [
'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne',
'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca'
]
print(f"{'Z':>3} {'Elem':>4} {'Z_eff':>8} {'gamma':>8} {'F_ratio':>15} {'Dev(ppb)':>12}")
print("-" * 60)
results = []
for Z in range(1, 101):
result = calculate_forces(Z)
results.append(result)
# Print selected elements
if Z <= 20 or Z in [26, 47, 79, 92]:
element = element_names[Z-1] if Z <= len(element_names) else f"Z{Z}"
if Z == 26: element = "Fe"
elif Z == 47: element = "Ag"
elif Z == 79: element = "Au"
elif Z == 92: element = "U"
print(f"{Z:3d} {element:>4} {result['Z_eff']:8.3f} {result['gamma']:8.4f} "
f"{result['ratio']:15.12f} {result['deviation_ppb']:12.3f}")
print("-" * 60)
print()
# Calculate statistics (don't hardcode anything)
ratios = [r['ratio'] for r in results]
deviations = [r['deviation_ppb'] for r in results]
agreements = [r['agreement_percent'] for r in results]
print("Statistical results:")
print(f" Elements calculated: {len(results)}")
print(f" Mean ratio: {np.mean(ratios):.15f}")
print(f" Mean agreement: {np.mean(agreements):.11f}%")
print(f" Mean deviation: {np.mean(deviations):.6f} ppb")
print(f" Std deviation: {np.std(deviations):.6f} ppb")
print(f" Min deviation: {np.min(deviations):.6f} ppb")
print(f" Max deviation: {np.max(deviations):.6f} ppb")
print(f" Range of deviations: {np.max(deviations) - np.min(deviations):.6f} ppb")
# Calculate if deviations are similar (don't hardcode True/False)
deviation_range = np.max(deviations) - np.min(deviations)
print(f" Deviation range < 1 ppb: {deviation_range < 1.0}")
print(f" All ratios > 0.999: {all(r > 0.999 for r in ratios)}")
print(f" All ratios < 1.001: {all(r < 1.001 for r in ratios)}")
print()
return results
def main():
"""Main calculation routine - numbers only"""
print("Mathematical verification: F = hbar^2/(gamma*m*r^3) vs k*e^2/r^2")
print("Repository: https://git.esus.name/esus/spin_paper/")
print()
# Show Bohr radius calculation
verify_bohr_radius()
# Show detailed examples
analyze_element(1, "Hydrogen")
analyze_element(6, "Carbon")
analyze_element(79, "Gold")
# Show full periodic table results
results = verify_all_elements()
print("Unit verification:")
print(" F = hbar^2/(gamma*m*r^3)")
print(" [F] = [J*s]^2 / ([kg][m^3]) = [kg*m*s^-2] = [N]")
print(" F = k*e^2/r^2")
print(" [F] = [N*m^2*C^-2][C^2] / [m^2] = [N]")
print()
# Show some key numbers for interpretation
mean_ratio = np.mean([r['ratio'] for r in results])
mean_deviation = np.mean([r['deviation_ppb'] for r in results])
print("Key numbers:")
print(f" Mean force ratio across 100 elements: {mean_ratio:.15f}")
print(f" Deviation from unity: {abs(1-mean_ratio)*1e9:.3f} ppb")
print(f" Expected if identical: 0.000 ppb")
print(f" CODATA electron mass uncertainty: ~300 ppb")
if __name__ == "__main__":
if len(sys.argv) > 1:
if sys.argv[1] in ['-h', '--help']:
print("Usage: python clean_numbers_only_script.py [element_Z]")
print("Shows only calculated numbers, no conclusions")
sys.exit(0)
elif sys.argv[1].isdigit():
Z = int(sys.argv[1])
if 1 <= Z <= 100:
print("Single element calculation:")
analyze_element(Z, f"Element Z={Z}")
else:
print("Error: Z must be between 1 and 100")
sys.exit(1)
else:
print("Error: Invalid argument")
sys.exit(1)
else:
main()