Does light charge the quons? › Files cited on the page › check_trial21_fable/

r27_derive.py

In the investigation at sim/models_AB/check_trial21_fable/r27_derive.py · last changed in commit 3f155ac, 23 November 2026 · 12,897 bytes · the folder as a zip


#!/usr/bin/env python3
"""Twenty-seventh reviewer (r27), trial 21 blind part: symbolic derivations.

Written before reading the trial's script, output or results paper.
Everything here is derived from the model definitions in sections 1 to 4 of
papers/Lock_geared_gyrostat_2026-11-22.md and from standard rigid-body dynamics [S].

Parts:
 D1. Kelvin's gyrostat: Routhian, linearized equations, stiffness K = S^2/I.
 D2. Continuum of geared gyrostats on a rigid ground: dispersion, cutoff, group index.
 D3. Rotor bound K <= 2 m_r v_rim^2 (ring equality), disc, sphere.
 D4. Theorem (static stiffness): differential gear between two gyrostats never beats K1 + K2.
 D5. Flexible couplings: a gimbal spring, and a gear referenced to a free flywheel: dynamic stiffness.
 D6. Two media: static stiffness and the two wave branches.
 D7. Intrinsic spin hbar/2 on a frame: speed, tuned radius, cutoff.
 D8. Kelvin's time limit: density needed to hold a static field for a time T.
"""
import sympy as sp

def banner(s):
    print("\n" + "=" * 78 + "\n" + s + "\n" + "=" * 78)

# ---------------------------------------------------------------- D1
banner("D1. One gyrostat: Routhian and linearized equations")
t = sp.symbols('t', real=True)
I, I3, S, m, k, w, G, J, Im = sp.symbols('I I_3 S m k omega G J I_m', positive=True)
al = sp.Function('alpha')(t)   # mount rotation about the stiff axis (absolute)
ph = sp.Function('phi')(t)     # gimbal angle
# Exact Routhian of a symmetric rotor (spin axis z'' of the gimbal), gimbal free about x',
# mount turned about the fixed Y by alpha(t); spin momentum S conserved (psi cyclic) [S]:
R = sp.Rational(1, 2) * I * (ph.diff(t)**2 + al.diff(t)**2 * sp.cos(ph)**2) - S * al.diff(t) * sp.sin(ph)
EL_phi = sp.diff(R.diff(ph.diff(t)), t) - R.diff(ph)
tau_alpha = sp.diff(R.diff(al.diff(t)), t) - R.diff(al)   # couple the mount must supply
print("Exact gimbal equation (= 0):", sp.simplify(EL_phi))
print("Exact couple the mount supplies:", sp.simplify(tau_alpha))
# linearize in phi, drop alpha_dot^2 terms
eps = sp.symbols('epsilon')
p0, p1, p2, a1_, a2_ = sp.symbols('phi phi_d phi_dd alpha_d alpha_dd')
def lin(e):
    e2 = e.subs({ph.diff(t, 2): p2, ph.diff(t): p1, al.diff(t, 2): a2_, al.diff(t): a1_}).subs(ph, p0)
    e2 = e2.subs({p0: eps * p0, p1: eps * p1, p2: eps * p2, a1_: eps * a1_, a2_: eps * a2_})
    return sp.series(e2, eps, 0, 2).removeO().subs(eps, 1)
print("Linearized gimbal equation:", sp.simplify(lin(EL_phi)))
print("Linearized couple on mount:", sp.simplify(lin(tau_alpha)))
print("-> I phi_dd = -S alpha_d ;  reaction on mount = -(I alpha_dd + S phi_d).")
print("   Integrating with phi_d(0)=alpha(0)=0: phi_d = -(S/I) alpha, reaction = +S phi_d ... = -(S^2/I) alpha")
print("   so K = S^2/I per gyrostat, and the stored 'spring' energy 1/2 I phi_d^2 = 1/2 K alpha^2 is gimbal kinetic energy.")
print("   A held twist alpha0 leaves the gimbal coasting at phi_d = -(S/I) alpha0: the couple is -K alpha0 cos(phi),")
print("   phi = (S/I) alpha0 t. It falls to zero at phi = pi/2 and reverses beyond: Kelvin's time limit (his 1890 par. 8).")

# ---------------------------------------------------------------- D2
banner("D2. Continuum, gear G to a rigid ground, mount inertia I_m: dispersion")
Jt = I + Im  # inertia the gyroscopic couple must accelerate
U, Phi = sp.symbols('U Phi')
# plane wave u = U e^{i(kx - wt)}, phi = Phi e^{i(kx-wt)}, theta = -u_x/2 = -(i k/2) U, alpha = G theta
Theta = -sp.I * k / 2 * U
# gimbal: Jt phi_dd = S G theta_d  (sign choice of D1 reversed is immaterial: K depends on S^2)
eq_phi = sp.Eq(-Jt * w**2 * Phi, S * G * (-sp.I * w) * Theta)
Phi_sol = sp.solve(eq_phi, Phi)[0]
# element: from L = 1/2 m u_t^2 + 1/2 Jt (phi_t^2 + G^2 theta_t^2) + S G phi theta_t, theta = -u_x/2.
#   Euler-Lagrange for a Lagrangian in u_t and u_xt: d_t(dL/du_t) = d_x d_t (dL/du_xt)  (two integrations by parts)
#   -> m u_tt = (1/4) Jt G^2 u_xxtt - (1/2) S G phi_xt   [my first draft had the right-hand signs flipped: own slip]
eq_u = -m * w**2 * U - sp.Rational(1, 4) * Jt * G**2 * w**2 * k**2 * U + sp.Rational(1, 2) * S * G * (sp.I * k) * (-sp.I * w) * Phi_sol
disp = sp.solve(sp.Eq(sp.simplify(eq_u / U), 0), w**2)[0]
disp = sp.simplify(disp)
print("omega^2 =", disp)
K = S**2 / Jt
cw2 = G**2 * K / (4 * m)
ell2 = G**2 * Jt / (4 * m)
print("check omega^2 == c_w^2 k^2/(1 + k^2 ell^2) with c_w^2 = G^2 K/(4m), ell^2 = G^2 (I+I_m)/(4m):",
      sp.simplify(disp - cw2 * k**2 / (1 + k**2 * ell2)) == 0)
print("omega_max = lim k->inf:", sp.simplify(sp.limit(sp.sqrt(disp), k, sp.oo)), "  (= S/(I+I_m); independent of G and m)")
# group index
kk = sp.symbols('kappa', positive=True)  # k*ell
om = sp.sqrt(cw2) * kk / sp.sqrt(1 + kk**2) / sp.sqrt(ell2)   # omega(k) with k = kappa/ell
vg = sp.simplify(sp.diff(om, kk) / (1 / sp.sqrt(ell2)))
ng = sp.simplify(sp.sqrt(cw2) / vg)
print("group index n_g(kappa=k ell) =", ng)
x = sp.symbols('x', positive=True)  # (omega/omega_max)^2 = kappa^2/(1+kappa^2)
ng_x = sp.simplify(ng.subs(kk, sp.sqrt(x / (1 - x))))
print("n_g as a function of x = (omega/omega_max)^2:", ng_x, "  -> (1-x)^(-3/2); n_g - 1 ~ 3x/2 for small x")
print("series:", sp.series(ng_x, x, 0, 3))

# ---------------------------------------------------------------- D3
banner("D3. Rotor bound")
mr, R, Om = sp.symbols('m_r R Omega_s', positive=True)
shapes = {"thin ring": (mr * R**2, mr * R**2 / 2), "solid disc": (mr * R**2 / 2, mr * R**2 / 4),
          "solid sphere": (sp.Rational(2, 5) * mr * R**2, sp.Rational(2, 5) * mr * R**2)}
for name, (i3, it) in shapes.items():
    Ks = sp.simplify((i3 * Om)**2 / it)
    print(f"{name:13s}: I3 = {i3}, I_t = {it}, K = S^2/I_t = {Ks} = {sp.simplify(Ks/(mr*(R*Om)**2))} m_r v_rim^2 ;"
          f" omega_max = S/I_t = {sp.simplify(i3*Om/it)}")
print("General: I_t >= I3/2 (I_x + I_y >= I_z for any body, I_x = I_y for a symmetric rotor), I3 <= m_r R^2,")
print("so K = I3^2 Om^2/I_t <= 2 I3 Om^2 <= 2 m_r v_rim^2, equality only for a thin ring.")
print("Relativistic rim (gamma = 1.155 at c/2): S = gamma m v R, I_t ~ gamma m R^2/2 -> K = 2 gamma m v^2, but the element")
print("mass the wave moves is the rotor's energy gamma m, so c_w^2 = K/(4 gamma m) = v^2/2 unchanged (my estimate [D]).")

# ---------------------------------------------------------------- D4
banner("D4. Theorem check: differential gear between two gyrostats in one element")
K1, K2, Gp, th = sp.symbols('K_1 K_2 Gprime theta', positive=True)
b2 = sp.symbols('beta_2', real=True)
# mount rotations relative to the body: beta_1 = -G' beta_2 (an ideal gear between the two mounts); body turns theta
a1 = th - Gp * b2
a2 = th + b2
E = sp.Rational(1, 2) * K1 * a1**2 + sp.Rational(1, 2) * K2 * a2**2
b2_eq = sp.solve(sp.diff(E, b2), b2)[0]
Keff = sp.simplify(2 * E.subs(b2, b2_eq) / th**2)
print("K_eff =", sp.factor(Keff))
print("K1 + K2 - K_eff =", sp.factor(sp.simplify(K1 + K2 - Keff)), " >= 0, zero only at G' = K2/K1.")
print("With K2 -> oo (a rigid reference) K_eff -> (1+G')^2 K1 = G^2 K1: the rigid-ground result, but then K1 + K2 -> oo too.")
print("General statement: the undeformed relative configuration (all mounts carried with the body) is admissible for any")
print("linkage housed in the element and costs no spring energy; there the energy is 1/2 (sum K_i) theta^2; the static")
print("equilibrium is the minimum over admissible configurations; hence K_static <= sum K_i. [D]")

# ---------------------------------------------------------------- D5
banner("D5. Flexible couplings: gimbal spring; gear referenced to a free flywheel")
kg, If, al0 = sp.symbols('k_g I_f alpha_0', positive=True)
# (i) gimbal spring k_g: I phi_dd + k_g phi = S alpha_d  (linear), reaction -S phi_d
Phi_s = sp.solve(sp.Eq((-I * w**2 + kg) * Phi, S * (-sp.I * w) * al0), Phi)[0]
reaction = -S * (-sp.I * w) * Phi_s
Keff_spring = sp.simplify(-reaction / al0)
print("(i) gimbal spring: K_eff(omega) =", sp.factor(Keff_spring), " = (S^2/I) omega^2/(omega^2 - k_g/I)")
print("    -> 0 as omega -> 0 (no static stiffness); > S^2/I only above the gimbal resonance; plasma-like dispersion.")
# (ii) gyrostat (as an ideal spring K, massless mount) geared G:1 against a free flywheel of inertia I_f inside the element
Kc, psi = sp.symbols('K psi')
psi_f = sp.Function('psi')(t)
th_f = sp.Function('theta')(t)
# gear: mount rotation relative to body = -G' (flywheel rotation relative to body)  -> alpha = (1+G') theta - G' psi
alpha_f = (1 + Gp) * th_f - Gp * psi_f
Lf = sp.Rational(1, 2) * If * psi_f.diff(t)**2 - sp.Rational(1, 2) * Kc * alpha_f**2
EL_psi = sp.diff(Lf.diff(psi_f.diff(t)), t) - Lf.diff(psi_f)
Th0, Ps0 = sp.symbols('Theta_0 Psi_0')
EL_psi_f = EL_psi.subs({psi_f.diff(t, 2): -w**2 * Ps0, psi_f: Ps0, th_f: Th0})
Ps_sol = sp.solve(EL_psi_f, Ps0)[0]
react_theta = -(Lf.diff(th_f)).subs({psi_f: Ps_sol, th_f: Th0}) * (-1)  # generalized force on theta = dL/dtheta
force_theta = (Lf.diff(th_f)).subs({psi_f: Ps_sol, th_f: Th0})
Keff_fly = sp.simplify(-force_theta / Th0)
print("(ii) flywheel reference: K_eff(omega) =", sp.factor(Keff_fly))
print("    -> -(1+G')^2 I_f omega^2/G'^2 as omega -> 0 (an inertia, no static stiffness);")
print("    -> (1+G')^2 K = G^2 K as omega -> oo, approached as G^2 K/(1 - omega_f^2/omega^2), omega_f^2 = K G'^2/I_f:")
print("    a massive-photon (plasma) dispersion n^2 = 1 - omega_f^2/omega^2 with no static stiffness. [D]")

# ---------------------------------------------------------------- D6
banner("D6. Two media (medium m, K; ground m_g, K_g): static and wave stiffness")
Kg, mg, thg = sp.symbols('K_g m_g theta_g', positive=True)
thg_v = sp.symbols('theta_g_v', real=True)
alpha2 = G * th - (G - 1) * thg_v
E2 = sp.Rational(1, 2) * Kc * alpha2**2 + sp.Rational(1, 2) * Kg * thg_v**2
thg_eq = sp.solve(sp.diff(E2, thg_v), thg_v)[0]
Kstat = sp.simplify(2 * E2.subs(thg_v, thg_eq) / th**2)
print("K_static =", sp.simplify(Kstat), "   [= G^2 K/(1 + (G-1)^2 K/K_g)]")
Gopt = sp.solve(sp.diff(Kstat, G), G)
print("stationary in G at G =", Gopt, "; value there:", [sp.simplify(Kstat.subs(G, g)) for g in Gopt], " = K + K_g")
print("K + K_g - K_static =", sp.factor(sp.simplify(Kc + Kg - Kstat)), " >= 0: the static stiffness never beats the sum.")
# wave branches: V = (k^2/8)[K (G U - (G-1) U_g)^2 + K_g U_g^2]; M = diag(m, m_g)
Kmat = sp.Matrix([[Kc * G**2, -Kc * G * (G - 1)], [-Kc * G * (G - 1), Kc * (G - 1)**2 + Kg]]) / 4
Mmat = sp.diag(m, mg)
A = Mmat.inv() * Kmat   # v^2 eigenvalues
v2 = list(A.eigenvals().keys())
print("v^2 branches (general K_g): two roots of det(A - v^2) = 0; with K_g = 0:")
A0 = A.subs(Kg, 0)
print("   eigenvalues:", [sp.simplify(e) for e in A0.eigenvals().keys()])
print("   -> one soft branch v^2 = 0 (medium and ground co-rotate, the gyrostat unloaded: a static twist is not held),")
print("      and the light branch 4 v^2 = K (G^2/m + (G-1)^2/m_g): the ground serves light by inertia alone. [D]")
print("   m_g -> oo: 4 v^2 -> G^2 K/m (rigid ground). m_g = m, G = 1: 4 v^2 = K/m (ungeared).")

# ---------------------------------------------------------------- D7
banner("D7. Intrinsic spin hbar/2 on a frame of mass M, radius r_g, J = j M r_g^2")
hb, c, M, rg, j = sp.symbols('hbar c M r_g j', positive=True)
Sq = hb / 2
Jf = j * M * rg**2
cw = Sq / (2 * sp.sqrt(Jf * M))     # c_w^2 = K/(4M), K = S^2/J, element mass = frame mass M (one axis)
lamC = hb / (M * c)
print("c_w =", sp.simplify(cw), " = c lambda_C/(4 sqrt(j) r_g) with lambda_C = hbar/(M c):",
      sp.simplify(cw - c * lamC / (4 * sp.sqrt(j) * rg)) == 0)
rg_c = sp.solve(sp.Eq(cw, c), rg)[0]
print("c_w = c at r_g =", rg_c, " = lambda_C/(4 sqrt j)")
wmax = sp.simplify((Sq / Jf).subs(rg, rg_c))
print("omega_max = S/J at that radius =", wmax, " -> hbar omega_max = 8 M c^2 (independent of j)")
print("rim speed if the frame itself carried hbar/2 by spinning: v = S r_g/J = hbar/(2 j M r_g); at the tuned radius:",
      sp.simplify((Sq * rg / Jf).subs(rg, rg_c) / c), "c")

# ---------------------------------------------------------------- D8
banner("D8. Kelvin's time limit")
rho, wd, T, wm = sp.symbols('rho w T omega_max', positive=True)
# energy density of a static field held as twist: w = 2 kappa theta^2 with kappa = rho c^2 (c_w = c), one-axis convention
theta_f = sp.sqrt(wd / (2 * rho * c**2))
# gimbal angle after T: phi = omega_max G theta T < 1 (G = 1)
rho_min = sp.solve(sp.Eq(wm * theta_f * T, 1), rho)[0]
print("theta =", theta_f, ";  phi(T) = omega_max theta T < 1 rad  ->  rho >=", rho_min)
print("(with a looser criterion phi < phi_c the bound divides by phi_c^2; order one.)")
print("Kelvin's own escape (1890 par. 9): infinitely fast gyrostats as an absolute-rotation reference and flexural yielding")
print("of the bars for the stiffness: series combination k_b K/(k_b + K) <= K, so the rotor bound still holds, and with")
print("finite S the frame yields by k_b/(K + k_b) and the gimbals still wind up, (K+k_b)/k_b times more slowly. [D]")