Chapter 2: Introduction to special relativity

Below is a set of python codes associated with Chapter 2 of Daniele Pelliccia and David M. Paganin, “Synchrotron Light: A Physics Journey from Laboratory to Cosmos” (Oxford University Press, 2025).

In order to run any of these python codes, you will need to include the following header file.

Plot of the Lorentz factor

See Fig. 2.7.

An infinity of stacked carts

See computational exercise on page 29, together with Figs. 2.14-2.15.

Relativistic aberration

See Fig. 2.17.

Longitudinal Doppler effect

See Fig. 2.20 for a plot of the dependency of the ratio \omega' / \omega as a function of the velocity, for four values of the direction angle \theta.

Acceleration of a particle pushed by a uniform force

See Figs. 2.23 and 2.24.

Bonus content: relativistic contraction of field lines

Let us suppose a charge is moving along the x-axis with constant speed v which is a sizeable fraction of the speed of light. How does the Coulomb field lines transform for an observer that is at rest compared to the moving charge? We expect the lines to be contracted by a factor \gamma in the direction of motion.