The Doppler effect alters the frequency of waves when the source moves relative to the observer. In acoustics the phenomenon is familiar: a passing siren drops in pitch as it speeds away. Light behaves similarly, yet at velocities approaching the speed of light classical formulas fail. This simulator couples the relativistic Doppler equations to an animated canvas. Each frame shows wavefronts emitted by a moving source and the arrival times at a stationary observer. By adjusting speed, direction, and time step, you can see wavelengths stretch or compress and measure numerical stability.
The source emits waves with rest wavelength . It moves with constant velocity along a straight line toward or away from the observer located at the origin. The wavefronts travel at light speed . We assume motion purely along the line of sight, neglecting transverse components. The simulation uses explicit Euler integration for the source motion and records each emitted wavefront with its launch time.
The relativistic Doppler shift for light is given by where and the upper sign corresponds to receding motion. The canvas also computes the observed wavelength by measuring the time between successive wavefront arrivals at the observer. Comparing the measured value with the analytic formula exposes numerical error.
Source position is updated with explicit Euler:
0
Consider a spacecraft emitting green light with and traveling toward Earth at . The analytic formula predicts , giving 366 nm. Running the simulation with shows wavefronts bunching up ahead of the craft; measuring arrival times yields an observed wavelength around 365 nm, within 0.3% of theory. Downloading the CSV reveals the evolving position and wavelength for further analysis.
Case | v (m/s) | λ′ receding (nm) |
---|---|---|
Baseline | 100000 | 500.17 |
Half light speed | 149896229 | 866.03 |
Approach 0.5c | -149896229 | 288.68 |
Circles represent expanding wavefronts. The source appears as a moving dot whose color shifts from blue (approaching) to red (receding). The observer sits at the canvas center. When a wavefront crosses the origin, a tick mark is recorded and the observed wavelength is updated. An energy bar visualizes the ratio between rest and observed photon energies via ; green denotes initial energy and orange the shift.
This simplified model ignores cosmological expansion, gravitational redshift, and transverse Doppler effects. The explicit Euler update is adequate for constant velocity but would require refinement for accelerating sources. For extremely large the emission schedule becomes inaccurate and energy bars may drift.
Future improvements could add accelerating motion, three-dimensional visualization, or phase-space plots of frequency versus time. Incorporating bandwidth and noise would bridge the gap between ideal wavefronts and real detectors.
Related calculators: relativistic kinetic energy, time dilation, wavelength-frequency converter.