OGRePy is a modern, open-source Python package designed to perform symbolic tensor calculations, with a particular focus on applications in general relativity. Built on an object-oriented architecture, OGRePy encapsulates tensors, metrics, and coordinate systems as self-contained objects, automatically handling raising and lowering of indices, coordinate transformations, contractions, partial or covariant derivatives, and all tensor operations. By leveraging the capabilities of SymPy and Jupyter Notebook, OGRePy provides a robust, user-friendly environment that facilitates both research and teaching in general relativity and differential geometry. This Python package reproduces the functionality of the popular Mathematica package OGRe, while greatly improving upon it by making use of Python's native object-oriented syntax. In this paper, we describe OGRePy's design and implementation, and discuss its potential for reuse across research and education in mathematics and physics.
翻译:OGRePy是一个现代化的开源Python软件包,专为执行符号张量计算而设计,尤其侧重于广义相对论中的应用。基于面向对象的架构,OGRePy将张量、度规和坐标系封装为自包含的对象,自动处理指标的升降、坐标变换、缩并、偏导数或协变导数以及所有张量运算。通过利用SymPy和Jupyter Notebook的功能,OGRePy提供了一个强大且用户友好的环境,有助于广义相对论和微分几何领域的研究与教学。该Python软件包复现了流行的Mathematica软件包OGRe的功能,同时通过利用Python原生的面向对象语法对其进行了重大改进。本文描述了OGRePy的设计与实现,并讨论了其在数学和物理学研究与教育中的复用潜力。