Note
Go to the end to download the full example code.
Einstein, 1905: velocity addition, the Doppler shift and aberration#
Sections 5 and 7 of the 1905 paper apply the Lorentz transformation to velocities and to light. Velocities do not add; they compose as
which never exceeds 1 and leaves the speed of light unchanged. The frequency of light from a source moving at \(\beta\) at angle \(\theta\) to the line of sight is multiplied by \(1/[\gamma(1 - \beta\cos\theta)]\), which is \(\sqrt{(1+\beta)/(1-\beta)}\) head on and the pure time-dilation factor \(1/\gamma\) at right angles. An observer moving at \(\beta\) sees a source at angle \(\theta\) shifted forward, to \(\cos\theta' = (\cos\theta + \beta)/(1 + \beta\cos\theta)\).
import matplotlib.pyplot as plt
import numpy as np
from physicskit.relativity.chapters.special import (
aberration_angle,
lorentz_transform,
relativistic_doppler,
velocity_addition,
)
Two boosts make one boost#
b1, b2 = 0.5, 0.7
event = np.array([2.0, 0.3])
twice = lorentz_transform(lorentz_transform(event, b1), b2)
once = lorentz_transform(event, velocity_addition(b1, b2))
print(f"0.5 c then 0.7 c = {float(velocity_addition(b1, b2)):.4f} c")
print(f"event after two boosts: {twice}, after one: {once}")
u = np.linspace(-1.0, 1.0, 300)
fig, ax = plt.subplots(figsize=(6, 4.5))
for v in (0.0, 0.5, 0.9, 0.99):
ax.plot(u, velocity_addition(u, v), label=f"v = {v}")
ax.plot(u, np.clip(u + 0.9, -2, 2), "k:", linewidth=0.8, label="Galileo, v = 0.9")
ax.set_ylim(-1.1, 1.1)
ax.set_xlabel("u (velocity in the moving frame)")
ax.set_ylabel("w (velocity in the lab)")
ax.set_title("Relativistic velocity addition")
ax.legend(fontsize=8)
plt.tight_layout()

0.5 c then 0.7 c = 0.8889 c
event after two boosts: [ 3.78355575 -3.22572381], after one: [ 3.78355575 -3.22572381]
The Doppler factor around a moving source#
theta = np.linspace(0.0, np.pi, 300)
fig, ax = plt.subplots(figsize=(6, 4.5))
for beta in (0.2, 0.5, 0.8):
ax.plot(np.degrees(theta), relativistic_doppler(beta, theta), label=f"beta = {beta}")
ax.axhline(1.0, color="gray", linewidth=0.5)
ax.set_yscale("log")
ax.set_xlabel("angle between source velocity and line of sight [degrees]")
ax.set_ylabel(r"$f_{obs}/f_{src}$")
ax.set_title("Relativistic Doppler shift")
ax.legend()
plt.tight_layout()

Aberration: the sky crowds forward#
A uniform ring of stars, as seen by observers at rest, at \(0.5c\) and at \(0.9c\) along \(+x\).
stars = np.linspace(0.0, 2.0 * np.pi, 36, endpoint=False)
fig, axes = plt.subplots(1, 3, figsize=(11, 4), subplot_kw={"projection": "polar"})
for ax, beta in zip(axes, (0.0, 0.5, 0.9)):
seen = aberration_angle(stars, beta) if beta > 0 else stars
ax.scatter(seen, np.ones_like(seen), s=12)
ax.set_yticks([])
ax.set_title(f"beta = {beta}")
plt.tight_layout()
plt.show()

Check#
Two boosts compose to \((b_1 + b_2)/(1 + b_1 b_2)\), light stays at \(c\), the head-on Doppler factor at \(0.8c\) is 3, and a star at 90 degrees appears at 60 degrees to an observer at \(0.5c\).
Total running time of the script: (0 minutes 0.193 seconds)