A high-performance, object-oriented symbolic tensor engine for General Relativity.
Project description
EinsteinEngine
A high-performance, object-oriented symbolic tensor engine for General Relativity, powered by Python and C++.
EinsteinEngine is designed to solve the performance bottlenecks of traditional pure-Python symbolic calculators. By wrapping SymEngine (C++) backend inside a Python API, it computes Christoffel Symbols, Riemann Tensors, and other complex relativistic structures faster than standard pure Python libraries.
Key Features
- ⚡ C++ Backend: Mathematical heavy-lifting (partial derivatives, massive tensor contractions) is routed directly to
SymEngine, bypassing Python's native performance limits. - 🧠 Smart Memoization: Built-in memory caching prevents redundant calculations of highly complex objects like inverse metric tensors.
- 📦 Clean Object-Oriented API: Complex tensor pipelines are reduced to a few lines of readable code using class inheritance.
- 🛡️ Exact Mathematics: Built to handle rational numbers securely, preventing floating-point contamination and ensuring textbook-perfect algebraic simplifications.
Quick Start
EinsteinEngine calculates the entire Riemann Curvature Tensor of a Black Hole in just two lines of code:
import sympy as sp
from einsteinpy.symbolic.metric import MetricTensor
from einsteinpy.symbolic.riemann import RiemannCurvatureTensor
# 1. Define your symbols and metric array
t, r, theta, phi = sp.symbols('t r theta phi', real=True)
M = sp.symbols('M', real=True)
g_schwarzschild = [
[-(1 - 2*M/r), 0, 0, 0],
[0, 1/(1 - 2*M/r), 0, 0],
[0, 0, r**2, 0],
[0, 0, 0, r**2 * sp.sin(theta)**2]
]
# 2. Run the EinsteinEngine Pipeline
metric = MetricTensor(g_schwarzschild, [t, r, theta, phi], name="Schwarzschild")
riemann = RiemannCurvatureTensor.from_metric(metric)
# 3. Extract exact, simplified textbook results
print(riemann.get_component(1, 0, 1, 0))
# Output: 2*M*(2*M - r)/r**4
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file einsteinengine-0.5.0.tar.gz.
File metadata
- Download URL: einsteinengine-0.5.0.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2bd148c16c02887f5c3fcd5455008e8008b5fb6a0464b1e3961d6ce010b1e89
|
|
| MD5 |
8ee3f42f61e753a983bc3ba039f60a46
|
|
| BLAKE2b-256 |
a126e2fbb7b7e97f58c7bc6b81d4d7a4b15f864b1e4e6cd10e820e62312f0abb
|
File details
Details for the file einsteinengine-0.5.0-py3-none-any.whl.
File metadata
- Download URL: einsteinengine-0.5.0-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bcad67072720f08ac57ed273886fc8af13368a738da515d530f76ec6a01d834
|
|
| MD5 |
354fa69eb3f2abea24657b8376ffefd7
|
|
| BLAKE2b-256 |
52629a5221db5a929fc84fd964cef49ba4c8715306e24ee240322d5ecbf3375e
|