Visualization of how mass warps spacetime, inspired by Einstein's General Theory of Relativity —
explained using the classic "rubber sheet" analogy and simulated in Python using `matplotlib`.
In simple words, mass and energy tell spacetime how to curve, and curved spacetime tells matter how to move.
The greater the mass (or concentrated energy), the deeper the curve in the space-time fabric — resulting in a stronger gravitational pull.
- Simulate mass and energy in 2D space
- Show how one object affects another (i.e., simulate relativity)
- Represent time dilation based on the curve intensity
- Solid understanding of Python + NumPy + Matplotlib
- Clear grasp of general relativity
- Create a 2D grid representing space:
X,Y - Add mass at the center (or anywhere on the grid)
- Apply a gravitational potential function to warp the grid:
Where:
G: gravitational constant (set to 1 for simplicity)M: mass value(x₀, y₀): coordinates of the massε: a small value to avoid division by zero
- Use a 3D surface plot (
matplotlib) to visualize space-time curvature.
pip install numpy matplotlib