Metric Tensor Calculator: Christoffel, Riemann and Einstein Tensors

Free metric tensor calculator for general relativity: pick Schwarzschild, de Sitter, FLRW, a wormhole or type your own metric and get the Christoffel symbols, geodesic equations, Riemann, Ricci and Einstein tensors and the Kretschmann scalar, plus geodesics drawn on spheres, tori and hyperbolic planes.

The metric tensor gμν tells you how to measure distances and times in any coordinates. From it, a computer algebra system (SymPy, running in your browser) derives everything about the geometry: how the grid twists (Christoffel symbols), how free particles move (geodesics) and how space-time is curved (Riemann, Ricci, Einstein, and the Kretschmann scalar). Pick a famous metric or type your own.

The metric gμν (symmetric: typing in one corner fills the mirror image)

What the metric tensor is

In flat space the distance between two nearby points is ds² = dx² + dy² (Pythagoras). Use other coordinates, or curve the space, and you need correction factors: ds² = Σ gμν dxμ dxν. The nine or sixteen numbers gμν are the metric tensor. In general relativity it is the gravitational field: a minus sign for time and plus signs for space gives the signature (−,+,+,+), and the metric of a black hole, an expanding universe or a wormhole is just a different choice of gμν.

Christoffel \(\displaystyle \Gamma^{k}{}_{ij} = \tfrac12\, g^{kl}\left(\partial_i g_{lj} + \partial_j g_{li} - \partial_l g_{ij}\right)\)
geodesic \(\displaystyle \dfrac{d^2x^k}{d\tau^2} + \Gamma^{k}{}_{ij}\,\dfrac{dx^i}{d\tau}\,\dfrac{dx^j}{d\tau} = 0\)
Riemann \(\displaystyle R^{\rho}{}_{\sigma\mu\nu} = \partial_\mu \Gamma^{\rho}{}_{\nu\sigma} - \partial_\nu \Gamma^{\rho}{}_{\mu\sigma} + \Gamma^{\rho}{}_{\mu\lambda}\Gamma^{\lambda}{}_{\nu\sigma} - \Gamma^{\rho}{}_{\nu\lambda}\Gamma^{\lambda}{}_{\mu\sigma}\)
Einstein \(\displaystyle G_{\mu\nu} = R_{\mu\nu} - \tfrac12 R\, g_{\mu\nu} = \dfrac{8\pi G}{c^4}\,T_{\mu\nu}\ \ (+\,\Lambda\, g_{\mu\nu})\)

How to read the results

  • Christoffel symbols say how the coordinate grid itself bends. They are not a measure of curvature: flat space in polar coordinates has non-zero ones. Straight Cartesian coordinates give all zeros.
  • The Riemann tensor is the real curvature. If it is zero everywhere the space is flat, however odd the coordinates look (try “Minkowski in spherical coordinates” and “Rindler”).
  • Ricci tensor and scalar. A Ricci tensor of zero is a vacuum solution of Einstein's equations: empty space, curved by a mass somewhere else (Schwarzschild, Kasner). A non-zero one needs matter, energy or a cosmological constant (de Sitter, FLRW, Reissner–Nordström).
  • The Kretschmann scalar is a coordinate-independent measure of curvature. For Schwarzschild it is 48M²/r⁶ (in units where G = c = 1): finite at the horizon, so that is only a coordinate singularity, but infinite at r = 0, a real singularity.
  • The geodesic equations are the equations of motion of a free particle (or light ray) in that geometry. The Geodesics tab solves them numerically for surfaces.

Typing your own metric

List the coordinates (for example t, r, theta, phi), type each entry of the symmetric matrix gμν as an expression (-(1-2*M/r), r^2*sin(theta)^2, exp(2*H*t); use ^ for powers), list any constants like M and tick the symbols you know are positive (it makes simplification faster and cleaner). Functions of the coordinates like sin, cos, exp, sqrt, log, cosh work. Components that are not zero are listed; the rest are zero by symmetry or by calculation.

Limits

The algebra is done by SymPy inside your browser (nothing is uploaded), so a complicated 4-dimensional metric can take a while, and a result is only as simplified as SymPy manages (“Cancel” stops a long run, and partial answers appear as they finish). The Kerr (spinning) black hole is deliberately not included as a preset: its curvature is too heavy for a browser. The geodesic shooter handles two-dimensional metrics with a positive-definite signature only, integrates with a fixed-step Runge-Kutta method (good for drawing, not for research) and does not detect geodesics that run into a coordinate singularity beyond stopping them.

Things people ask

  • Why does the flat polar-coordinate metric have non-zero Γ? Because a grid of circles and radial lines is not straight. A geodesic there is still a straight line, but written in polar coordinates it is not a straight line on the coordinate chart.
  • What is the signature? The signs of the metric's diagonal at a sample point: (−,+,+,+) for relativity.
  • Why is the Schwarzschild Ricci tensor zero but not its Riemann tensor? Ricci is a contraction of Riemann. Empty space can still be curved (tidal forces); it just has no source there.

Everything runs on your device. Black Hole Simulator · Light in a Medium · CAS calculator · More MES tools

Comments
Advertisement