Whittaker's History (1910), reviewed › The review's files › sim/whittaker/partA/

whittaker_partA.py

In the investigation at sim/whittaker/partA/whittaker_partA.py · last changed in commit 282b16e, 22 November 2026 · 25,947 bytes


#!/usr/bin/env python3
"""Whittaker (1910) review, Part A (chapters I to III): the numbers behind the "Against measurement" entries.

Run:  OMP_NUM_THREADS=1 ~/aspden-review-venv/bin/python3 sim/whittaker/partA/whittaker_partA.py > sim/whittaker/partA/whittaker_partA_out.txt
Needs numpy and scipy only. Every input is labelled: [S] standard physics or an exact SI/IAU value, [I] a measured input,
[M] a modelling choice of this review, [D] derived here, "source" = read in the original under sources/whittaker_originals_A/,
"memory" = a value quoted from memory and not read at source in this session (to be checked before any stronger claim rests on it).
Each test T.. is cited by number in papers/whittaker_review/Part_A_chapters_I-III.md.
"""
import subprocess, math
import numpy as np
from scipy.special import ellipk, ellipe
from scipy.optimize import brentq
from scipy.integrate import quad

try:
    HEAD = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True, text=True, cwd='/home/doug/aetherscience.org').stdout.strip()
except Exception:
    HEAD = 'n/a'
print('commit at run:', HEAD)

# ---------------- constants ----------------
c = 299792458.0              # m/s  [S] exact
h = 6.62607015e-34           # J s  [S] exact
hbar = h / (2 * math.pi)
e = 1.602176634e-19          # C    [S] exact
alpha = 1 / 137.035999177    # [S] CODATA 2022, the value in sim/constants_sets.py
mu0 = 2 * alpha * h / (e**2 * c)      # [D] from alpha, h, e, c (SI 2019)
eps0 = 1 / (mu0 * c**2)
G = 6.67430e-11              # [S] CODATA 2018/2022 (memory)
m_e = 9.1093837e-31          # kg [S] CODATA (memory)
m_p = 1.67262192e-27         # kg [S] CODATA (memory)
m_e_eV = 510998.95           # eV [S]
r_e = alpha * hbar / (m_e * c)        # classical electron radius [D]
au = 149597870700.0          # m [S] IAU 2012 exact
R_earth = 6371.0e3           # m, mean radius [S]
D_earth = 2 * R_earth
toise = 1.949                # m, toise du Chatelet [S] (memory)
foot = 0.3048; inch = 0.0254; mile = 1609.344   # [S]

def section(t):
    print('\n' + '=' * 100 + '\n' + t + '\n' + '=' * 100)

# ---------------- T01 Galileo's lanterns ----------------
section("T01  Galileo's lantern test (Whittaker p. 21). What his method could have bounded")
d = 1 * mile                              # [M] one mile between the lanterns (Galileo proposed two or three; the Accademia del Cimento used about a mile, memory)
t_react = 0.2                             # s  [M] a human reaction time (memory)
print(f"round-trip light time over {d/1e3:.3f} km: {2*d/c*1e6:.2f} microseconds; a reaction time of {t_react} s hides anything slower than"
      f" c > {2*d/t_react/1e3:.0f} km/s, i.e. {2*d/t_react/c:.1e} of the true c.  The null result was certain, and told nothing about the value.")

# ---------------- T02 Roemer and the light-equation ----------------
section("T02  Roemer's light-equation (Whittaker p. 22 and footnote) against the IAU light time for 1 au")
t_au = au / c
print(f"light time for 1 au = au/c = {t_au:.6f} s  [S]")
vals = [("Roemer 1676: 22 min for the orbit's diameter (Phil. Trans. 1677, source) -> 11 min for the radius", 11 * 60.0),
        ("'astronomers of the succeeding half-century': 7 min (Whittaker, footnote)", 7 * 60.0),
        ("Delambre 1817 (Whittaker, footnote)", 493.2),
        ("Glasenapp 1875, most probable (Whittaker, footnote)", 500.88),
        ("Sampson 1909, own readings, +/-0.02 (Whittaker, footnote)", 498.64),
        ("Sampson 1909, Harvard readings, +/-0.02 (Whittaker, footnote)", 498.79)]
for name, v in vals:
    print(f"  {name:95s} {v:8.2f} s   ({(v - t_au)/t_au*100:+6.2f} %)")
print(f"Sampson's two values miss the modern value by {(t_au-498.64)/0.02:.0f} and {(t_au-498.79)/0.02:.0f} of his stated probable errors [D].")

# ---------------- T03 Huygens's and Newton's speeds of light and sound ----------------
section("T03  Huygens (Treatise 1690, source) and Newton (Opticks Query 21, source): light against sound")
v_huy = (16 + 2/3) * D_earth                    # 16 2/3 Earth diameters per second (source)
v_huy2 = 1100 * 100000 * toise                  # '11 hundred times a hundred thousand toises' per second (source)
v_snd_huy = 180 * toise                         # 180 toises per second (source)
print(f"Huygens: 16 2/3 Earth diameters/s = {v_huy/1e3:.0f} km/s ({(v_huy-c)/c*100:+.0f} % of c); 1.1e8 toises/s = {v_huy2/1e3:.0f} km/s")
print(f"Huygens: sound 180 toises/s = {v_snd_huy:.0f} m/s (modern 343 m/s at 20 C [S]: {(v_snd_huy-343)/343*100:+.1f} %)")
print(f"Huygens: light/sound 'more than 600,000'; his own numbers give {v_huy/v_snd_huy:.0f}; modern c/343 = {c/343:.0f}")
v_snd_newton = 1140 * foot                      # 'Sounds move about 1140 English Feet in a second' (source)
v_light_newton = 70e6 * mile / (7.5 * 60)       # 70,000,000 miles in 7 or 8 minutes (source)
print(f"Newton: sound 1140 ft/s = {v_snd_newton:.0f} m/s; light 7e7 miles in 7.5 min = {v_light_newton/1e3:.0f} km/s ({(v_light_newton-c)/c*100:+.0f} %);"
      f" ratio {v_light_newton/v_snd_newton:.0f} ('above 700000'); squared {(v_light_newton/v_snd_newton)**2:.2e} ('above 490000000000')")
print(f"modern (c/343)^2 = {(c/343)**2:.2e}: the aether's modulus/density would have to exceed air's by this factor [D]")
rho_lattice = 143.5e3                            # kg/m^3, the record's U07 lattice density [I from the record]
print(f"for the record's lattice density {rho_lattice:.3e} kg/m^3 (U07), a wave at c needs modulus rho c^2 = {rho_lattice*c**2:.2e} Pa (steel: 2e11 Pa [S])")

# ---------------- T04 Newton's speed of sound ----------------
section("T04  Newton's theory of sound (Principia II, Props 43-50; Whittaker p. 20): isothermal against adiabatic")
p0 = 101325.0; rho0 = 1.2922; gamma = 1.400     # dry air at 0 C [S]
print(f"Newton's sqrt(p/rho) = {math.sqrt(p0/rho0):.1f} m/s; Laplace's sqrt(gamma p/rho) = {math.sqrt(gamma*p0/rho0):.1f} m/s; measured 331.3 m/s at 0 C [S]")
print(f"Newton's formula is {(1-math.sqrt(1/gamma))*100:.1f} % low; the fix (1816) is the ratio of specific heats [S]. (Newton's own printed 979 and 1142 ft/s: memory.)")

# ---------------- T05 Newton's rings ----------------
section("T05  Newton's rings (Opticks II, Obs. 6, source): the thickness 1/178000 inch and the 'interval of fits'")
d1 = inch / 178000
lam = 4 * d1                                    # first bright ring of an air film at normal incidence: 2 d = lambda/2 (one phase inversion) [S]
print(f"first bright ring at d = 1/178000 in = {d1*1e9:.1f} nm -> lambda = 4 d = {lam*1e9:.0f} nm (yellow-orange: right) [D]")
print(f"rings at 1,3,5,... times that thickness (source) -> successive bright rings differ by lambda/2 = {2*d1*1e9:.0f} nm = Newton's interval of fits (1/89000 in, memory)")

# ---------------- T06 Newton's 1672 prism ----------------
section("T06  Newton's 1672 letter (Phil. Trans. 6, 3075, source): his geometry re-computed")
A = math.radians(63 + 12/60)                    # prism angle 63 deg 12' (source)
n_newton = 31 / 20                              # 'sines 20 to 31' (source)
Dmin = 2 * math.asin(n_newton * math.sin(A/2)) - A
print(f"n = 31/20 = {n_newton:.3f}; minimum deviation for A = 63d12' is {math.degrees(Dmin):.2f} deg; Newton measured 44d56' = 44.93 deg, with incidence 54d4' (source)")
n_from_inc = math.sin(math.radians(54 + 4/60)) / math.sin(A/2)
print(f"n from his incidence angle alone: sin(54d4')/sin(31d36') = {n_from_inc:.4f}")
spread = math.radians(2 + 49/60) - math.radians(31/60)      # image length 2d49' less the Sun's diameter 31' (source)
dD_dn = 2 * math.sin(A/2) / math.sqrt(1 - (n_newton * math.sin(A/2))**2)
print(f"angular length 2d49' = {(2+49/60)/(31/60):.2f} solar diameters ('more than five', source); pure dispersion {math.degrees(spread):.2f} deg;"
      f" dD/dn at minimum deviation = {dD_dn:.3f} rad -> n_violet - n_red = {spread/dD_dn:.3f} [D]")
print("a glass of n_D = 1.55 has n_violet - n_red of about 0.02 to 0.03 [S, memory]: Newton's 1666 numbers are those of ordinary glass dispersion")

# ---------------- T07 Huygens's spheroid ----------------
section("T07  Huygens's Iceland-spar spheroid (Treatise, source): semi-axes 105032 and 93410, 'very nearly 9 to 8'")
ratio_h = 105032 / 93410
n_o, n_e = 1.6584, 1.4864                        # calcite at 589 nm [S] (memory)
print(f"Huygens's axis ratio = {ratio_h:.4f} (9/8 = {9/8:.4f}); modern n_o/n_e = {n_o/n_e:.4f}: Huygens {(ratio_h/(n_o/n_e)-1)*100:+.1f} % [D]")
print("the spheroid for the extraordinary wave is exact for a uniaxial crystal [S]; his 'compressed sphere' (oblate) is right for calcite (negative uniaxial)")

# ---------------- T08 refraction speeds ----------------
section("T08  Descartes/Newton against Huygens/Fermat on the speed in matter (Whittaker pp. 6-7, 10, 25); Foucault 1850")
for name, n in [('water', 1.3330), ('crown glass', 1.52), ('calcite (ordinary)', n_o)]:
    print(f"  {name:20s} n = {n:.4f}: corpuscular prediction v = n c = {n:.3f} c; wave prediction v = c/n = {1/n:.3f} c; measured: slower (Foucault 1850; Michelson 1883 water 1.33 [S, memory])")

# ---------------- T09 light crossing light ----------------
section("T09  Huygens: beams 'do not interfere with each other in any way' (Whittaker p. 23). The modern residual: light-by-light scattering")
w = 2.5                                          # eV, visible photon
sigma = (973 / (10125 * math.pi)) * alpha**2 * r_e**2 * (w / m_e_eV)**6     # Euler-Heisenberg low-energy total cross-section [S, memory for the coefficient]
print(f"sigma(gamma gamma -> gamma gamma) at {w} eV = {sigma:.1e} m^2 (Euler-Heisenberg; coefficient 973/10125pi from memory); a barn is 1e-28 m^2")
print("so two crossing beams are independent to this level: Huygens's observation stands as a limit, not an absolute [S]")

# ---------------- T10 Cavendish and the photon mass ----------------
section("T10  Priestley's inference, Cavendish's 1773 null, Coulomb (Whittaker pp. 50-53, 56) against photon-mass limits")
a_in = 13.3 / 2 * inch; b_in = 12.1 / 2 * inch       # hemispheres 13.3 in, globe 12.1 in diameter (Cavendish, Maxwell ed. 1879, source)

def V_shell_q(r, R, q):
    """Potential at radius r of a unit charge spread on a shell of radius R, for a force law 1/s^(2+q) (potential 1/s^(1+q)) [D]."""
    if abs(q) < 1e-15:
        return 1 / max(r, R)
    return ((R + r)**(1 - q) - abs(R - r)**(1 - q)) / (2 * R * r * (1 - q))

def V_shell_yukawa(r, R, mu):
    """Same for a Proca (massive-photon) potential exp(-mu s)/s [D]; written to avoid overflow."""
    lo, hi = min(r, R), max(r, R)
    return 0.5 * (math.exp(-mu * (hi - lo)) - math.exp(-mu * (hi + lo))) / (mu * R * r)

def inner_fraction(Vf, a, b, par):
    """Cavendish's procedure [D]: outer shell (radius a) charged alone; inner (radius b) connected to it, then disconnected and the outer removed.
    Returns the charge left on the inner divided by the outer's original charge."""
    Caa, Cab, Cbb = Vf(a, a, par), Vf(a, b, par), Vf(b, b, par)
    # connection: Q_a + Q_b = Q0 and Caa Q_a + Cab Q_b = Cab Q_a + Cbb Q_b
    ratio = (Caa - Cab) / (Cbb - Cab)             # Q_b / Q_a
    return ratio / (1 + ratio)

def inner_fraction_q_linear(a, b, q):
    """First order in q (Maxwell, Treatise sect. 74, re-derived here) [D]: f = q b/(a-b) { [(a+b)ln(a+b) - (a-b)ln(a-b)]/(2b) - ln(2a) }.
    Needed when q is below the rounding of the exact formula (relative 1e-16)."""
    return q * b / (a - b) * (((a + b) * math.log(a + b) - (a - b) * math.log(a - b)) / (2 * b) - math.log(2 * a))

def inner_fraction_mu_linear(a, b, mu):
    """Leading order in mu for the Proca potential [D]: f = mu^2 b (a + b)/6."""
    return mu**2 * b * (a + b) / 6

f_cav = inner_fraction(V_shell_q, a_in, b_in, 1/50)
print(f"Cavendish's geometry a = {a_in*100:.2f} cm, b = {b_in*100:.2f} cm. For an exponent 2 + 1/50 the inner globe would keep {f_cav:.4f} = 1/{1/f_cav:.0f} of the outer's charge;")
print(f"  he found it 'certainly less than 1/60' (Art. 231, source) and concluded the exponent lies within 2 +/- 1/50 (source): consistent [D]")
q_for_60 = brentq(lambda q: inner_fraction(V_shell_q, a_in, b_in, q) - 1/60, 1e-6, 0.5)
print(f"  the exponent deviation that gives exactly 1/60 is q = {q_for_60:.4f} = 1/{1/q_for_60:.0f}; the linear formula gives f/q = {inner_fraction_q_linear(a_in, b_in, 1.0):.3f}")
hbar_c_eV_m = hbar * c / e
print("\nMapping each exponent sensitivity q to the Proca mass that would leave the same charge on the inner globe (same apparatus) [D]:")
cases = [("Cavendish 1773 (source)", 1/50, a_in, b_in),
         ("Maxwell 1879 note (source), 1/72000", 1/72000, a_in, b_in),
         ("Maxwell 1873 Treatise, 1/21600 (memory)", 1/21600, a_in, b_in),
         ("Plimpton & Lawton 1936, 2e-9 (memory), 1.5 m shells [M]", 2e-9, 0.75, 0.60),
         ("Williams, Faller & Hill 1971, q < 6e-16 (memory), 1.5 m shells [M]", 6e-16, 0.75, 0.60)]
for name, q, a, b in cases:
    if q > 1e-6:
        target = inner_fraction(V_shell_q, a, b, q)
        mu = brentq(lambda m: inner_fraction(V_shell_yukawa, a, b, m) - target, 1e-6, 1e3)
        how = 'exact'
    else:                                         # below double-precision rounding of the exact forms: first-order formulae
        target = inner_fraction_q_linear(a, b, q)
        mu = math.sqrt(6 * target / (b * (a + b)))
        how = 'linearised'
    m_gamma_eV = hbar_c_eV_m * mu                 # m c^2 = hbar c mu
    print(f"  {name:62s} q = {q:.1e}: inner fraction {target:.2e}; mu = {mu:.2e} /m -> m_gamma < {m_gamma_eV:.1e} eV = {m_gamma_eV*e/c**2*1e3:.1e} g ({how})")
print("  Williams, Faller and Hill quoted m_gamma < 1.6e-47 g (memory): same order as the mapping above. PDG: m_gamma < 1e-18 eV (memory), from the solar-wind field.")
print(f"  Coulomb's torsion balance (1785, source) checked 1/r^2 at the few-per-cent level over a few cm; no photon-mass limit beyond Cavendish's follows from it [D].")

# ---------------- T11 Aepinus's residual gravity ----------------
section("T11  Aepinus: 'a slight want of equality between these forces might give, as a residual, the force of gravitation' (Whittaker p. 49)")
k_e = 1 / (4 * math.pi * eps0)
ratio_g_e = G * m_p**2 / (k_e * e**2)
eps_needed = ratio_g_e / 2                        # [D]: two unlike pairs attract with k, two like pairs repel with k(1-eps): net 2 k eps
print(f"gravity/electric force for two protons: {ratio_g_e:.2e}; for two hydrogen atoms a like-charge shortfall eps = {eps_needed:.1e} would give gravity [D]")
ZA = {'Ti': (22, 47.867), 'Pt': (78, 195.084)}   # [S]
za = {k: Z / A for k, (Z, A) in ZA.items()}
eta = 2 * abs(za['Ti'] - za['Pt']) / (za['Ti'] + za['Pt'])
print(f"but such a force counts charges, not mass: Z/A = {za['Ti']:.4f} (Ti) and {za['Pt']:.4f} (Pt) -> Eotvos parameter eta = {eta:.3f}")
print(f"MICROSCOPE 2022: eta(Ti,Pt) = (-1.5 +/- 2.3 +/- 1.5) e-15 (memory): excluded by about 10^{math.log10(eta/3e-15):.0f} [D]. (Counting atoms instead of charges gives eta ~ 1.)")

# ---------------- T12 Michell, Newton's 'triplicate proportion' ----------------
section("T12  Michell's inverse square between poles and Newton's 'almost triplicate' decrease (Whittaker pp. 53-55)")
L = 0.10
print("force between two collinear thin bar magnets of length L = 10 cm, poles +-m at their ends, gap d: F = m^2[1/d^2 - 2/(d+L)^2 + 1/(d+2L)^2] [D]")
for dd in [0.005, 0.01, 0.03, 0.1, 0.3, 1.0]:
    F = lambda x: 1/x**2 - 2/(x+L)**2 + 1/(x+2*L)**2
    slope = -(math.log(F(dd*1.001)) - math.log(F(dd*0.999))) / (math.log(1.001) - math.log(0.999))
    print(f"  d = {dd*100:5.1f} cm: effective exponent {slope:.2f}")
print("so Michell's 1/r^2 holds for near poles (d << L) and Newton's 'almost triplicate' and worse holds for whole magnets far apart; the couple on a small magnet in a dipole field is exactly 1/r^3 [S]")

# ---------------- T13 Poisson's induced magnetism ----------------
section("T13  Poisson's law of induced magnetism (Whittaker p. 65): (4pi/3) I = k_p F with F the field in a spherical cavity")
print("with F = H + (4pi/3) I: I/H = kappa = 3 k_p / (4pi (1 - k_p)), so k_p = 4 pi kappa / (3 + 4 pi kappa) [D]; mu_r = 1 + 4 pi kappa (Gaussian) [S]")
for mu_r in [1.001, 2, 10, 200, 5000]:
    kappa = (mu_r - 1) / (4 * math.pi)
    print(f"  mu_r = {mu_r:7.3f}: kappa = {kappa:9.4f}, k_p = {4*math.pi*kappa/(3+4*math.pi*kappa):.5f}")
f_cp = math.pi / math.sqrt(18)
kappa_max = 3 * f_cp / (4 * math.pi * (1 - f_cp))
print(f"close-packed spheres fill at most {f_cp:.4f} [S] -> kappa <= {kappa_max:.3f}, mu_r <= {1+4*math.pi*kappa_max:.1f}; soft iron has mu_r of 200 to 5000 (memory): Poisson's picture fails by 20 to 500 [D]")

# ---------------- T14 Cavendish's conductivities ----------------
section("T14  Cavendish 1775 (Phil. Trans. 66, 196, quoted in the 1879 edition, source): iron 400 million times rain water; sea water 100, saturated salt 720 times rain water")
rho_Fe = 9.7e-8; rho_pure = 1.82e5; rho_rain = (100.0, 2000.0); rho_sea = 0.2; rho_sat = 1/22.0   # ohm m [S] / rain and saturated NaCl from memory
print(f"iron / ultrapure water: {rho_pure/rho_Fe:.1e}; iron / rain water (5-100 uS/cm): {rho_rain[0]/rho_Fe:.1e} to {rho_rain[1]/rho_Fe:.1e}; Cavendish 4e8")
print(f"sea / rain: {rho_rain[0]/rho_sea:.0f} to {rho_rain[1]/rho_sea:.0f} (Cavendish 100); saturated NaCl / sea: {rho_sea/rho_sat:.1f} (Cavendish 7.2)")
print("his water was a far better conductor than modern distilled water, and his ratios were set by feel ('physiological sensation', Whittaker p. 53); the sea/saturated ratio is close [D]")

# ---------------- T15 Davy's temperature law ----------------
section("T15  Davy 1821 (Phil. Trans. 111, 425, source): conducting power 'lower in some inverse ratio as the temperature was higher'")
alpha_Pt = 3.92e-3    # /K [S] (memory)
for T in [0, 100, 500, 1000]:
    print(f"  platinum at {T:4d} C: conductivity / conductivity(0 C) = {1/(1+alpha_Pt*T):.3f}  [S, linear law with alpha = 3.92e-3/K]")
print("modern: metals' resistivity rises nearly linearly with T (phonon scattering) [S]; Davy's statement is right in sign and roughly in form")

# ---------------- T16 Davy's chemical theory: the Daniell cell ----------------
section("T16  Davy: the pile's power comes from oxidation (Whittaker pp. 76-77). Modern form: E = -Delta G / (n F)")
F_const = 96485.33212   # C/mol [S]
dG = (-147.1 - 65.5) * 1e3      # J/mol: Zn + Cu2+ -> Zn2+ + Cu, from Delta G_f(Zn2+) = -147.1, Delta G_f(Cu2+) = +65.5 kJ/mol [S, NBS tables, memory]
print(f"Daniell cell: Delta G = {dG/1e3:.1f} kJ/mol -> E = {-dG/(2*F_const):.3f} V; measured 1.10 V [S] (Daniell 1836, after this part's period)")

# ---------------- T17 Volta's contact potential ----------------
section("T17  Volta's contact tension (Whittaker pp. 70-74): the Volta effect against the cell's EMF")
phi = {'Cu': 4.65, 'Zn': 4.33, 'Fe': 4.50}      # eV, work functions, polycrystalline [S] (memory; values vary by 0.2 eV with surface state)
print(f"contact potential Cu-Zn = phi_Cu - phi_Zn = {phi['Cu']-phi['Zn']:.2f} V (zinc positive, as Volta found with his electroscope, source); Daniell EMF 1.10 V")
loop = (phi['Cu'] - phi['Zn']) + (phi['Zn'] - phi['Fe']) + (phi['Fe'] - phi['Cu'])
print(f"round a closed chain of metals at one temperature the contact steps sum to {loop:.1e} V: Volta's 1801 law of successive contacts [S]; a pile needs the wet layers (chemistry)")

# ---------------- T18 Biot-Savart for a straight wire ----------------
section("T18  Biot and Savart (Whittaker p. 86): the element law integrated over an infinite straight wire gives 1/distance")
I = 1.0; dist = 0.01
B_num, _ = quad(lambda s: mu0 * I / (4 * math.pi) * dist / (s**2 + dist**2)**1.5, -np.inf, np.inf)
print(f"numerical integral of (mu0 I/4pi) [ds x r]/r^3 at 1 cm from a 1 A wire: {B_num:.6e} T; mu0 I/(2 pi d) = {mu0*I/(2*math.pi*dist):.6e} T [D]")

# ---------------- T19 Ampere's parallel wires and mu0 ----------------
section("T19  Ampere 1820: parallel currents attract (Whittaker p. 87). The force that defined the ampere 1948-2019")
print(f"mu0 from alpha, h, e, c (SI 2019): {mu0:.11e} N/A^2; 4 pi e-7 = {4*math.pi*1e-7:.11e}; ratio - 1 = {mu0/(4*math.pi*1e-7)-1:.2e} [D]")
print(f"force per metre between 1 A currents 1 m apart: mu0 I^2/(2 pi d) = {mu0/(2*math.pi):.10e} N/m (the pre-2019 definition: exactly 2e-7) [S]")

# ---------------- T20 Ampere's element law against Grassmann's ----------------
section("T20  Ampere's element formula and the Grassmann form (Whittaker pp. 89-92): equal for closed circuits, different for elements")
def loop_pts(radius, z, N):
    th = (np.arange(N) + 0.5) * 2 * np.pi / N
    pts = np.stack([radius * np.cos(th), radius * np.sin(th), np.full(N, z)], axis=1)
    ds = np.stack([-radius * np.sin(th), radius * np.cos(th), np.zeros(N)], axis=1) * (2 * np.pi / N)
    return pts, ds
def force_on_2(p1, ds1, p2, ds2, law):
    """Total force on circuit 2 from circuit 1, both with 1 A, by the element law 'ampere' or 'grassmann' [D]."""
    F = np.zeros(3)
    for j in range(len(p2)):
        r = p2[j] - p1                      # from element 1 to element 2
        rn = np.linalg.norm(r, axis=1)
        rhat = r / rn[:, None]
        if law == 'ampere':
            term = 2 * (ds1 @ ds2[j]) - 3 * (np.sum(ds1 * rhat, axis=1)) * (rhat @ ds2[j])
            dF = -(mu0 / (4 * np.pi)) * rhat * (term / rn**2)[:, None]
        else:
            dF = (mu0 / (4 * np.pi)) * np.cross(ds2[j], np.cross(ds1, rhat)) / rn[:, None]**2
        F += dF.sum(axis=0)
    return F
a_l, b_l, zsep, N = 0.10, 0.10, 0.05, 1500
p1, ds1 = loop_pts(a_l, 0.0, N); p2, ds2 = loop_pts(b_l, zsep, N)
FA = force_on_2(p1, ds1, p2, ds2, 'ampere'); FG = force_on_2(p1, ds1, p2, ds2, 'grassmann')
def M_neumann(z):
    k2 = 4 * a_l * b_l / ((a_l + b_l)**2 + z**2); k = math.sqrt(k2)
    return mu0 * math.sqrt(a_l * b_l) * ((2 / k - k) * ellipk(k2) - (2 / k) * ellipe(k2))
dz = 1e-5
F_neu = (M_neumann(zsep + dz) - M_neumann(zsep - dz)) / (2 * dz)     # F_z = I1 I2 dM/dz (energy method) [S]
print(f"coaxial loops, radii 10 cm, 5 cm apart, 1 A each, N = {N} segments:")
print(f"  Ampere   F_z on loop 2 = {FA[2]:+.6e} N (x,y: {FA[0]:+.1e}, {FA[1]:+.1e})")
print(f"  Grassmann F_z on loop 2 = {FG[2]:+.6e} N")
print(f"  Neumann  I1 I2 dM/dz    = {F_neu:+.6e} N  (attraction toward loop 1 is -z: sign {'agrees' if FA[2] < 0 else 'check'})")
print(f"  relative differences: Ampere-Grassmann {abs(FA[2]-FG[2])/abs(F_neu):.1e}, Ampere-Neumann {abs(FA[2]-F_neu)/abs(F_neu):.1e} [D]")
# isolated elements
ds_a = np.array([[1.0, 0, 0]]) * 1e-3; p_a = np.array([[0.0, 0, 0]])
ds_b = np.array([[0.0, 1, 0]]) * 1e-3; p_b = np.array([[1.0, 0, 0]])
print("two isolated elements: ds = x at the origin, ds' = y at (1,0,0), 1 A, 1 mm each:")
for law in ['ampere', 'grassmann']:
    print(f"  {law:9s}: force on ds' = {force_on_2(p_a, ds_a, p_b, ds_b, law)}, force on ds = {force_on_2(p_b, ds_b, p_a, ds_a, law)}")
print("Ampere's law obeys action and reaction between elements (Whittaker's requirement on p. 91); Grassmann's (the Lorentz force on an element) does not; only closed circuits are observable [S]")

# ---------------- T21 Ohm's series cells ----------------
section("T21  Ohm's early result (Whittaker p. 95): current against the number of cells in series")
E_cell, r_cell = 1.0, 1.0
for R in [1000.0, 0.01]:
    cur = [n * E_cell / (n * r_cell + R) for n in (1, 2, 4, 8)]
    print(f"  external R = {R:7.2f} ohm: I(n=1,2,4,8) = " + ', '.join(f'{x:.4g}' for x in cur) + " A  -> " + ("proportional to n" if R > 1 else "nearly independent of n") + " [D from I = nE/(nr+R)]")

# ---------------- T22 an Ohmic aether? ----------------
section("T22  Ohm's law and the vacuum: how conducting an aether could be, from the transparency of space [D]")
for name, Lpath in [("GRB 090510, 7.5 billion light years (Part 1B, Table 2.1)", 7.5e9 * 9.4607e15), ("CMB last scattering, about 4.4e26 m comoving [S]", 4.4e26)]:
    sig = 2 * eps0 * c / Lpath          # amplitude attenuation sigma/(2 eps0 c) per metre, set to 1/L [S, low-conductivity limit]
    print(f"  {name:65s}: a vacuum conductivity above {sig:.1e} S/m would dim the light by 1/e (copper: 6e7 S/m)")

# ---------------- T23 Huygens's isotropy and a cubic lattice ----------------
section("T23  Huygens's envelope needs an isotropic, dispersion-free medium: the record's lattice at optical wavelengths [D]")
a_lat = 6.374e-13                        # m, the record's spacing [I from the record, Part 1 U03]
k = 2 * math.pi / 500e-9
aniso = (k * a_lat)**2 / 36              # nearest-neighbour simple cubic: v([100]) - v([111]) over v, to leading order [D]
print(f"k a = {k*a_lat:.2e} at 500 nm; velocity difference between the [100] and [111] directions = (ka)^2/36 = {aniso:.1e};"
      f" rotating-cavity isotropy about 1e-17 (Part 1B, Table 2.1): a plain nearest-neighbour lattice at this spacing is {aniso/1e-17:.0e} times too anisotropic")
print("  (a lesson, not a new exclusion: the lattice is already excluded as the carrier by U34 and U38; a tuned dispersion could remove the (ka)^2 term, as 10.16 notes)")

# ---------------- T24 Seebeck ----------------
section("T24  Seebeck (Whittaker pp. 92-93): bismuth and antimony at the ends of the thermoelectric series")
S = {'Bi': -72, 'Sb': 47, 'Cu': 1.8, 'Fe': 19, 'Pb': -1.0}      # uV/K near 300 K [S] (memory)
print("Seebeck coefficients (uV/K, memory): " + ', '.join(f'{k} {v:+.1f}' for k, v in sorted(S.items(), key=lambda kv: kv[1])) + "  -> Bi and Sb are the extremes among common metals")
print(f"a Bi-Sb couple with 100 K between junctions gives about {(S['Sb']-S['Bi'])*100/1e3:.1f} mV [D]")

# ---------------- T25 charge conservation ----------------
section("T25  Franklin's conservation of charge (Whittaker p. 44): the modern limit")
print("electron decay (e -> nu gamma) lifetime > 6.6e28 years (Borexino 2015, memory); the neutrality of matter |q_p + q_e| < 1e-21 e (Dylla and King 1973, memory)")

print('\nend of run; commit', HEAD)