Skip to content

JWKennington/pystein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General Relativity Symbolic Utilities

PyPI version PyPI downloads PyPI versions Build CodeFactor codecov License

The pystein package contains utilities for computing symbolic utilities for computing various quantities that arise in general relativity. Presently, this package is essentially a sympy extension that computes components of tensors directly.

Installation

The pystein package is available on PyPI, and can be installed via pip:

pip install pystein

Symbolic Tools

The pystein package makes use of sympy to compute symbolic curvature equations (EFE). A sample snippet is below. For more detail see the documentation.

# Imports
import sympy
from sympy.diffgeom import Manifold, Patch
from pystein import coords, metric, curvature
from pystein.utilities import tensor_pow as tpow

# Create metric
M = Manifold('M', dim=2)
P = Patch('origin', M)
theta, phi, a = sympy.symbols('theta phi a', nonnegative=True)
cs = coords.CoordSystem('spherical', P, [theta, phi])
dtheta, dphi = cs.base_oneforms()
ds2 = a ** 2 * (tpow(dtheta, 2) + sympy.sin(theta) ** 2 * tpow(dphi, 2))
g = metric.Metric(twoform=ds2)

# Compute Christoffel Component
curvature.christoffel_symbol_component(0, 1, 0, g)

Numeric Tools

The pystein package contains some limited numerical utilities, including:

  • ability to numerically integrate the geodesic equations geodesic.numerical_geodesic
  • convenience functions to compute multiple geodesics from a variety of initial conditions (2D)

These utilities are compatible with the symbolic tools thanks to sympy.lambdify, which is used to convert symbolic equations into numeric equations.

*Note that the numeric tools in pystein are still in beta.

Releases

No releases published

Packages

No packages published