physics-time-dilation
The solution is a self-contained Python module (~/solution.py) that implements the full derivation chain:
def lorentz_boost(t: float, x: float, v: float) -> tuple[float, float]:
c = 1.0 # natural units
gamma = 1.0 / math.sqrt(1.0 - v*v / (c*c))
t_prime = gamma * (t - v*x / (c*c))
x_prime = gamma * (x - v*t)
return t_prime, x_prime
Proper time Δt₀ is the interval measured by a clock at rest in its own frame. From the Lorentz transform of two events at the same spatial location in the rest frame (Δx = 0):
Δt' = γ (Δt₀ - v·Δx/c²) = γ·Δt₀
Implemented as:
def time_dilation(delta_t0, v):
gamma = gamma_factor(v)
return gamma * delta_t0
The traveling twin ages less because the Earth-frame round trip time is 2d/v while the traveler's proper time is (2d/v)/γ. The asymmetry is resolved by the traveler's acceleration at turnaround.
At v=0.866c → γ ≈ 2.000. A proper-time interval of 1 second dilates to ~2 seconds. Verified by Lorentz-transforming two co-local events (Δt₀=1, Δx=0) and checking Δt'/Δt₀ = γ.
Output from running the solution: ``` ================================================================= TIME DILATION FROM LORENTZ TRANSFORMATIONS ================================================================= 1. LORENTZ BOOST (x-direction): t' = γ (t - v x / c²) x' = γ (x - v t) (t=0, x=0) → (t'=0.0000, x'=0.0000) [v=0.6c] (t=1, x=0) → (t'=1.2500, x'=-0.7500) [v=0.6c] (t=2, x=3) → (t'=0.2500, x'=2.2500) [v=0.6c] 2. PROPER TIME & DILATION FORMULA: Δt = γ · Δt₀ v=0.100c γ=1.0050 Δt₀=1s → Δt=1.0050s v=0.500c γ=1.1547 Δt₀=1s → Δt=1.1547s v=0.866c γ=1.9998 Δt₀=1s → Δt=1.9998s v=0.990c γ=7.0888 Δt₀=1s → Δt=7.0888s 3. TWIN PARADOX: Earth twin ages 23.09 years while traveling twin ages 11.55 years. 4. NUMERICAL EXAMPLE (v = 0.866c): γ = 1.9998, Δt₀ = 1s → Δt = 1.9998s ✓ All assertions passed. ``` Edge cases verified: - **v = 0**: γ = 1 (identity transform), ✓ - **v → 0** (classical limit): γ → 1, ✓ - **v → c**: γ diverges (707 at v=0.999999c), ✓ - **Negative velocity**: same time dilation (time dilation depends on |v|), ✓ - **Co-local events** (Δx=0): Δt'/Δt₀ = γ exactly, ✓ - **Spacetime invariant**: (cΔt)² − (Δx)² is preserved under all Lorentz boosts, ✓ ---
{"model": "pi", "problem_class": "physics-time-dilation", "result": "passed", "tests": 5}The solution is a self-contained Python module (~/solution.py) that implements the full derivation chain:
def lorentz_boost(t: float, x: float, v: float) -> tuple[float, float]:
c = 1.0 # natural units
gamma = 1.0 / math.sqrt(1.0 - v*v / (c*c))
t_prime = gamma * (t - v*x / (c*c))
x_prime = gamma * (x - v*t)
return t_prime, x_prime
Proper time Δt₀ is the interval measured by a clock at rest in its own frame. From the Lorentz transform of two events at the same spatial location in the rest frame (Δx = 0):
Δt' = γ (Δt₀ - v·Δx/c²) = γ·Δt₀
Implemented as:
def time_dilation(delta_t0, v):
gamma = gamma_factor(v)
return gamma * delta_t0
The traveling twin ages less because the Earth-frame round trip time is 2d/v while the traveler's proper time is (2d/v)/γ. The asymmetry is resolved by the traveler's acceleration at turnaround.
At v=0.866c → γ ≈ 2.000. A proper-time interval of 1 second dilates to ~2 seconds. Verified by Lorentz-transforming two co-local events (Δt₀=1, Δx=0) and checking Δt'/Δt₀ = γ.
Output from running the solution: ``` ================================================================= TIME DILATION FROM LORENTZ TRANSFORMATIONS ================================================================= 1. LORENTZ BOOST (x-direction): t' = γ (t - v x / c²) x' = γ (x - v t) (t=0, x=0) → (t'=0.0000, x'=0.0000) [v=0.6c] (t=1, x=0) → (t'=1.2500, x'=-0.7500) [v=0.6c] (t=2, x=3) → (t'=0.2500, x'=2.2500) [v=0.6c] 2. PROPER TIME & DILATION FORMULA: Δt = γ · Δt₀ v=0.100c γ=1.0050 Δt₀=1s → Δt=1.0050s v=0.500c γ=1.1547 Δt₀=1s → Δt=1.1547s v=0.866c γ=1.9998 Δt₀=1s → Δt=1.9998s v=0.990c γ=7.0888 Δt₀=1s → Δt=7.0888s 3. TWIN PARADOX: Earth twin ages 23.09 years while traveling twin ages 11.55 years. 4. NUMERICAL EXAMPLE (v = 0.866c): γ = 1.9998, Δt₀ = 1s → Δt = 1.9998s ✓ All assertions passed. ``` Edge cases verified: - **v = 0**: γ = 1 (identity transform), ✓ - **v → 0** (classical limit): γ → 1, ✓ - **v → c**: γ diverges (707 at v=0.999999c), ✓ - **Negative velocity**: same time dilation (time dilation depends on |v|), ✓ - **Co-local events** (Δx=0): Δt'/Δt₀ = γ exactly, ✓ - **Spacetime invariant**: (cΔt)² − (Δx)² is preserved under all Lorentz boosts, ✓ ---
{"model": "pi", "problem_class": "physics-time-dilation", "result": "passed", "tests": 5}