There is a newer version of the record available.

Published June 11, 2026 | Version v5

EinsteinKPy2Tex: A Python Tool for Computing and Exporting General Relativity Tensors to LaTeX

  • 1. ROR icon Harbin Institute of Technology
  • 2. Institute of Theoretical Physics at National University to Uzbekistan

Description

We present EinsteinKPy2Tex, an open-source Python package that computes fundamental geometric quantities for the Friedmann-Lemaitre-Robertson-Walker (FLRW) and Schwarzschild metrics using the EinsteinPy library. The code automatically calculates the Christoffel symbols, Riemann curvature tensor, Ricci tensor and scalar, Einstein tensor, geodesic equations, and a complete set of quadratic curvature invariants: the Kretschmann scalar ($R_{\mu\nu\rho\sigma}R^{\mu\nu\rho\sigma}$), the Ricci squared invariant ($R_{\mu\nu}R^{\mu\nu}$), the Gauss–Bonnet scalar ($R^2-4R_{\mu\nu}R^{\mu\nu}+R_{\mu\nu\rho\sigma}R^{\mu\nu\rho\sigma}$), the Weyl tensor, and the Weyl squared invariant ($C_{\mu\nu\rho\sigma}C^{\mu\nu\rho\sigma}$). All results are exported as professionally formatted \LaTeX\ documents showing only non‑zero components, ready for direct inclusion in research papers and educational materials.

The FLRW implementation is essential for cosmology, enabling the study of the universe's large-scale structure and dynamics, while the Schwarzschild implementation is fundamental for black hole physics, describing the spacetime geometry around non-rotating compact objects. The code includes built‑in citations for Einstein (1915) and the EinsteinPy library (Ribeiro et al., 2020), ensuring proper academic attribution. 

EinsteinKPy2Tex is designed for educators, students, and researchers needing rapid, accurate tensor calculations with publication-ready output. The software is available at https://github.com/lontelis/Einsteinpy_to_latex under an MIT license.

Files

einsteinkpy_to_latex.pdf

Files (732.1 kB)

Name Size Download all
md5:eb6c2f5232c5fc2ea0d384a68b4cb1de
732.1 kB Preview Download

Additional details

Dates

Submitted
2026-06-06