Examples#
Runnable demonstrations of General Relativity’s classic results, from the Schwarzschild and Kerr black-hole solutions through cosmology and gravitational-wave astrophysics.
Each script in this gallery is self-contained and can be run directly with
python examples/relativity/<section>/<script>.py. Every script also
carries an RST module docstring as its title/description and uses # %%
markers to split narrative text from code, which is exactly what
Sphinx-Gallery renders into the pages below – the script is the source of
truth for what you see, not a copy of it.
Sections#
schwarzschild – the non-rotating black hole: light bending and the photon-sphere shadow, perihelion precession (the anomaly that first confirmed General Relativity), tidal “spaghettification,” and the GPS relativistic correction you carry in your pocket.
kerr – the rotating black hole: frame dragging, the ergosphere, the Penrose process, and the Kerr shadow and redshift.
kerr_newman – the charged, rotating black hole: its horizons, spherical photon orbits, charged-particle geodesics and ray-traced shadow.
spacetime_geometry – curvature itself: validating the curvature engine against Einstein’s vacuum field equations, Flamm’s paraboloid (gravity as curved geometry rather than a force), and Kruskal-Szekeres/Penrose-Carter diagrams of spacetime’s true shape.
lensing – Einstein rings, multiple images, and microlensing.
neutron_star – solving the TOV equations for the neutron-star maximum mass.
cosmology – the expanding universe: Hubble’s law and the Friedmann equations.
gravitational_waves – the Hulse-Taylor binary pulsar’s orbital decay, the first (indirect) evidence for gravitational waves, and the GW150914 binary-merger chirp, the first direct detection.
interactive – interactive Plotly visualizations of orbits and the black-hole shadow.
Cosmology#
FLRW cosmic expansion and the distance-redshift relation.
The expanding universe: Hubble’s law and the Friedmann equations
Gravitational waves#
Einstein’s quadrupole waves, binary black hole and binary neutron star inspiral chirps and ringdown, and the merger remnant numerical relativity computed.
GW150914: the first direct detection of gravitational waves
Einstein predicts gravitational waves: polarizations and the quadrupole formula
The Hulse-Taylor binary pulsar: the first (indirect) evidence for gravitational waves
Numerical relativity solves the binary black hole merger
Interactive Plotly visualizations#
Pan/zoom/rotate-enabled 3D orbits and shadow images.
Kerr black holes#
Frame dragging, the ergosphere, and the Penrose process.
Frame dragging and the ergosphere of a Kerr black hole
The Kerr shadow: a rotating black hole’s asymmetric silhouette
The Penrose process: extracting a black hole’s rotational energy
Animating the shadow: a black hole spun up from rest
Kerr-Newman black holes#
The charged, rotating black hole: horizons, spherical photon orbits, charged-particle geodesics, and the shadow that completes the Schwarzschild, Reissner-Nordström and Kerr family.
The Kerr-Newman black hole: geodesics and the shadow of a charged, rotating hole
Gravitational lensing#
Einstein rings, multiple images, and microlensing magnification.
Neutron stars#
The Tolman-Oppenheimer-Volkoff equations and the maximum neutron star mass.
The neutron star maximum mass: solving the TOV equations
Schwarzschild black holes#
Orbits, perihelion precession, the 1919 eclipse deflection of starlight, the photon sphere and black hole shadow, and a radial infall’s finite proper time to the horizon.
The Eddington eclipse expedition: starlight bent by the Sun
The black hole shadow: from the photon sphere to the Event Horizon Telescope
Perihelion precession: the anomaly that first confirmed General Relativity
Penrose’s singularity theorems: finite proper time, divergent coordinate time
Spacetime geometry#
ADM (3+1) black-hole initial data, curvature, embedding diagrams, and the global causal structure of Schwarzschild spacetime.
The ADM (3+1) formalism: black-hole initial data and the ADM mass
Validating the curvature engine: Einstein’s vacuum field equations
Flamm’s paraboloid: gravity as curved geometry, not a force
Kruskal-Szekeres and Penrose-Carter diagrams: the true shape of spacetime