Example symbolic
The symbolic part of aurel uses sympy and provides extra tensorial calculations using the automatic aurel process. So let’s first load those two packages.
import sympy as sp
import aurel
from IPython.display import display
The coordinates of the spacetime need to be provided. Here since it is symbolic this is not limited to Cartesian and handle more or less than four dimensions.
# Coordinate setup
coords = sp.symbols('t r theta phi')
t, r, theta, phi = coords
# Create AurelCoreSymbolic object
relsym = aurel.AurelCoreSymbolic(
coords,
verbose = True, # Default, shows calculation steps
simplify = True # Enable simplification during calculations
)
Like in the main AurelCore class, the base terms need to be provided otherwise assumptions are made. Here the specific assumption depends on the number of dimensions; if the are 4-dimensions, the assumption is Minkowski \(g_{\alpha\beta} = \eta_{\alpha\beta}\), if there are 3-dimensions, the assumption is \(g_{ij} = \delta_{ij}\), otherwise there is no support and AurelCoreSymbolic.data[‘gdown’] needs to be provided.
For this example lets use the Schwarzschild metric.
# Spacetime
M = sp.symbols('M', real=True, positive=True)
relsym.data['gdown'] = sp.Matrix([
[- (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]
])
relsym['gdown']
From here on you can directly call any of the currently implemented terms. Say the Ricci Scalar:
relsym['RicciS']
Calculated symbolic gup: Metric tensor in the up index form
Calculated symbolic Gamma_udd: Christoffel symbols in the up-down-down index form
Calculated symbolic Ricci_down: Ricci curvature tensor in the down index form
Calculated symbolic RicciS: Ricci scalar
For non scalars, the indicies are reflected in the shape, and the components can be individually called.
relsym['Gamma_udd'].shape
for i in range(relsym.dim):
for j in range(relsym.dim):
for k in range(j, relsym.dim):
if relsym['Gamma_udd'][i, j, k] != 0:
display(sp.Eq(sp.Symbol(f"\\Gamma^{i}_{{{j}{k}}}"),
relsym['Gamma_udd'][i, j, k]))