Symbolic Calculations

Use iTensor's symbolic tools for Christoffel symbols, Riemann/Ricci tensors, and more. Perfect for advanced relativity and geometry tasks.

Last updated: January 15, 2025


Christoffel, Riemann, and Ricci

The symbolic module provides specialized classes and methods for working with geometric objects from differential geometry:

  • Christoffel Symbols - Represent the difference between coordinate derivatives and covariant derivatives on a manifold.
  • Riemann Tensor - Characterizes the curvature of a Riemannian manifold.
  • Ricci Tensor and Scalar - Contractions of the Riemann tensor that provide crucial information for Einstein's field equations.

Integration with SymPy

iTensor's symbolic module is built on top of SymPy, providing seamless integration with this powerful symbolic mathematics library.

from itensor.symbolic import Metric, Tensor, symbols
from sympy import simplify

# Define symbols
r, theta, phi = symbols('r θ φ')
t = symbols('t')
M = symbols('M', positive=True)  # Mass

# Define Schwarzschild metric components
g_tt = -(1 - 2*M/r)
g_rr = 1/(1 - 2*M/r)
g_thth = r**2
g_phph = r**2 * (theta.sin())**2

# Create the metric tensor
g = Metric('g', [(t, t, g_tt), (r, r, g_rr), 
               (theta, theta, g_thth), (phi, phi, g_phph)])

# Calculate Christoffel symbols
christoffel = g.christoffel_symbols()

Frequently Asked Questions

How does the symbolic module handle tensor index placement?

iTensor follows Einstein's convention for tensor index placement, distinguishing between contravariant (superscript) and covariant (subscript) indices.

Can I export symbolic calculations to LaTeX?

Yes, all symbolic tensors can be exported to LaTeX format using the .latex() method.