A sample presentation with selected figures from the paper Diagrammatic approaches to teaching special and general relativity is available for use and free modification: sample_presentation/sample_presentation.pdf.
The file figures.tex contains the spacetime diagrams used in the paper. The diagrams can be used to teach relativity of simultaneity, time dilation and visualizing the causal structure of the Schwarzschild spacetime.
The python script worldlines.py generates radial free-fall trajectories (“worldlines”) and lightcone anchor points and writes them to CSV files. The CSV outputs are intended to be plotted with LaTeX using TikZ/PGFPlots (see figures.tex).
The goal is reproducible spacetime diagrams: the curves and cone positions are computed numerically (not sketched) and then rendered in LaTeX. Parameters of the diagrams, worldlines and the light cones can be adjusted.
The Python script integrates an ODE for radial motion (starting from rest at several initial radii) and produces two datasets:
data_pg/traj_1.csv ... data_pg/traj_N.csvdata_pg/cone_points.csv
data_pg/traj_bh_1.csv ... data_pg/traj_bh_N_bh.csvdata_pg/cone_points_bh.csv
Both sets are generated in a single run.
- Python 3.x
numpyscipy
To compile figures.tex you need a LaTeX distribution with:
- tikz
- pgfplots
- pgfplotstable
- csvsimple
-
(Optional) Adjust parameters in
worldlines.py- Schwarzschild radii (
rS,rS_bh) - Number of trajectories (
N,N_bh) - Integration ranges (
tmax, etc.) - Cone placement (
cone_times)
- Schwarzschild radii (
-
If you changed
rSvalues, ensure the same values are set infigures.tex(e.g.\pgfmathsetmacro{\rs}{...}). -
Generate the CSV data:
python worldlines.py
-
Compile the figures latexmk -pdf figures.tex