General Relativity
The general relativity domain provides tools for calculations in curved spacetime, including black holes, gravitational lensing, and cosmology.
Overview
The general relativity module implements:
Schwarzschild metric for non-rotating black holes
Kerr metric for rotating black holes
Geodesic solver for particle/photon trajectories
Gravitational lensing calculations
FLRW cosmology for the expanding universe
Quick Start
from mechanics_dsl.domains.general_relativity import (
SchwarzschildMetric, GravitationalLensing, FLRWCosmology,
SOLAR_MASS
)
# Black hole analysis
bh = SchwarzschildMetric(mass=10 * SOLAR_MASS)
rs = bh.schwarzschild_radius() # ~30 km
r_isco = bh.isco_radius() # 3 × rs
T_hawking = bh.hawking_temperature()
# Gravitational lensing
lens = GravitationalLensing(mass=SOLAR_MASS)
alpha = lens.deflection_angle(impact_parameter=7e8) # 1.75 arcsec
# Cosmology
cosmos = FLRWCosmology(H0=70, Omega_m=0.3, Omega_Lambda=0.7)
age = cosmos.age()
Classes
SchwarzschildMetric
The Schwarzschild metric describes non-rotating, spherically symmetric black holes:
where \(r_s = 2GM/c^2\) is the Schwarzschild radius.
Key methods:
schwarzschild_radius(): Event horizon radiusisco_radius(): Innermost stable circular orbit (3rs)photon_sphere_radius(): Light orbit radius (1.5rs)hawking_temperature(): Black hole temperaturegravitational_redshift(r): Photon redshift from radius r
KerrMetric
The Kerr metric describes rotating black holes with spin parameter \(a = J/(Mc)\).
Key features:
outer_horizon(): Outer event horizoninner_horizon(): Inner (Cauchy) horizonergosphere_radius(theta): Static limit surfaceframe_dragging_rate(r): Spacetime rotation rateisco_radius(prograde): ISCO for prograde/retrograde orbits
GravitationalLensing
Light deflection by massive objects.
Deflection angle (weak field):
For the Sun at grazing incidence: α ≈ 1.75 arcseconds.
FLRWCosmology
Friedmann-Lemaître-Robertson-Walker cosmological model:
Key methods:
hubble_parameter(z): H(z) at redshift zage(): Age of the universecomoving_distance(z): Distance to redshift zluminosity_distance(z): For standard candles
Physical Constants
from mechanics_dsl.domains.general_relativity import (
SPEED_OF_LIGHT, # 299792458 m/s
GRAVITATIONAL_CONSTANT, # 6.674e-11 m³/(kg·s²)
SOLAR_MASS # 1.989e30 kg
)
See Also
Special Relativistic Mechanics - Special relativity
Quantum Mechanics - Quantum mechanics