"""Executable examples for Part III chapters (17-19, 21, 22). All numbers use v = 3/5, so gamma = 5/4 exactly and no rounding enters. Run from the repository root: uv run python content/examples/math/part3/part3_kinematics_demo.py ILLUSTRATIVE. These statements are not versioned claims and produce no EvidenceResult. Each would need a claim contract, a fingerprint, and an adapter run to count as engine evidence. """ import z3 from sympy import Rational, factor, simplify, sqrt, symbols v = Rational(3, 5) gamma = 1 / sqrt(1 - v**2) assert gamma == Rational(5, 4) def boost(t, x): return gamma * (t - v * x), gamma * (x - v * t) def interval(t, x): return t**2 - x**2 print("gamma =", gamma, "; gamma^2 (1-v^2) =", gamma**2 * (1 - v**2)) print("\n== Ch 17: simultaneity is frame-dependent") a, b = (0, 0), (0, 1) # simultaneous in S: t = 0 for both (ta, xa), (tb, xb) = boost(*a), boost(*b) print("S' times of the two events:", ta, tb, "-> difference", tb - ta) print("interval S:", interval(0, 1), " interval S':", interval(tb - ta, xb - xa)) print("\n== Ch 18/19: light-cone coordinates and the Doppler factor k") t, x = symbols("t x", real=True) tp, xp = boost(t, x) print("t'-x' =", factor(simplify(tp - xp)), " ; factor on (t-x):", (gamma * (1 + v))) print("t'+x' =", factor(simplify(tp + xp)), " ; factor on (t+x):", (gamma * (1 - v))) k = sqrt((1 + v) / (1 - v)) print("k = sqrt((1+v)/(1-v)) =", k, "; k * (1/k) =", k * (1 / k)) print("gamma(1+v) * gamma(1-v) =", gamma * (1 + v) * gamma * (1 - v)) vs = symbols("v", positive=True) ks = sqrt((1 + vs) / (1 - vs)) print("(k + 1/k)/2 - 1/sqrt(1-v^2) =", simplify((ks + 1 / ks) / 2 - 1 / sqrt(1 - vs**2))) print(" ^ simplify() does NOT reduce this to 0 (heuristic limit; see Chapter 9).") kp = symbols("k", positive=True) v_of_k = (kp**2 - 1) / (kp**2 + 1) # invert k^2 = (1+v)/(1-v) print("with v = (k^2-1)/(k^2+1): sqrt(1-v^2) =", simplify(sqrt(simplify(1 - v_of_k**2))), "; (k+1/k)/2 =", (kp + 1 / kp) / 2, "; 1/sqrt(1-v^2) =", simplify(1 / sqrt(simplify(1 - v_of_k**2)))) print("\n== Ch 21: time dilation and length contraction (3-4-5)") # clock at rest in S' (x'=0), proper time tau = 4: the S-frame coordinates tau = 4 t_S, x_S = gamma * (tau + v * 0), gamma * v * tau print("S coordinates of clock reading tau=4:", (t_S, x_S), "; interval:", interval(t_S, x_S)) # rod of rest length L0 = 5 in S', ends at x'=0 and x'=5; measure both ends at t = 0 in S L0 = 5 x_end_S = Rational(L0) / gamma # x' = gamma (x - v t) at t=0 -> x = x'/gamma print("rod: rest length", L0, "-> S-frame length at fixed t:", x_end_S) # symmetry: S-clock seen from S' tS_clock = 4 print("S-clock at x=0, t=4 -> S' coordinates:", boost(tS_clock, 0)) print("\n== Ch 22: velocity composition and causal order") def compose(u, w): return (u + w) / (1 + u * w) four_fifths = Rational(4, 5) print("3/5 (+) 3/5 =", compose(v, v), "; 1 (+) 3/5 =", compose(1, v), "; 4/5 (+) 4/5 =", compose(four_fifths, four_fifths)) # timelike vs spacelike separation: time-order of two events under the boost for dt, dx, kind in [(2, 1, "timelike"), (1, 2, "spacelike"), (1, 1, "null")]: dtp, dxp = boost(dt, dx) print(f"{kind:9s} (dt,dx)=({dt},{dx}) interval {interval(dt, dx):>2} " f"-> (dt',dx')=({dtp},{dxp}) interval {interval(dtp, dxp)}") print("\n== Z3: timelike order is preserved by every subluminal boost") T, X, V, G = z3.Reals("t x v gamma") s = z3.Solver() s.add(G > 0, G * G * (1 - V * V) == 1, V > -1, V < 1) # boost hypotheses s.add(T > 0, T * T - X * X > 0) # future timelike separation s.add(G * (T - V * X) <= 0) # negated goal: t' > 0 print("negation of 't' > 0' for timelike (t,x):", s.check()) s2 = z3.Solver() s2.add(G > 0, G * G * (1 - V * V) == 1, V > -1, V < 1) s2.add(T > 0, X * X - T * T > 0) # spacelike s2.add(G * (T - V * X) <= 0) print("same for spacelike (can the order flip?):", s2.check(), s2.model())