Getting Started with iTensor
Set up the environment and perform your first tensor calculations for general relativity and differential geometry
Prerequisites
iTensor requires the following components:
Core Requirements
- Python: Version 3.8 or higher
- NumPy: For array operations and numerical computation
- SymPy: For symbolic mathematics
- SciPy: For numerical integration and special functions
For Advanced Features
- C/C++ Compiler: GCC 9+, Clang 10+, or MSVC 2019+ for compiling extensions
- CUDA Toolkit: Version 11.2+ for GPU acceleration (NVIDIA GPUs only)
- OpenBLAS/LAPACK: For optimized linear algebra operations
Installation
Using PyPI (Recommended)
For GPU acceleration support (requires CUDA Toolkit):
From Source
When installing from source, use pip install -e .[dev]
to include development dependencies for contributing to the project.
Online Calculator
If you prefer not to install anything, use the web calculator at https://itensor.online.
The online calculator provides:
- Metric definition and tensor calculation interface
- Step-by-step derivation visualization
- LaTeX export for publications
- Limited computational capabilities compared to the full package
First Steps: Computing the Schwarzschild Tensors
Let's compute the Ricci tensor for the Schwarzschild metric:
Expected output:
Schwarzschild metric: ds² = -(1 - 2M/r)dt² + (1 - 2M/r)⁻¹dr² + r²dθ² + r²sin²θdφ² Ricci tensor components: R_{00} = 0 R_{01} = 0 R_{02} = 0 R_{03} = 0 R_{10} = 0 R_{11} = 0 R_{12} = 0 R_{13} = 0 R_{20} = 0 R_{21} = 0 R_{22} = 0 R_{23} = 0 R_{30} = 0 R_{31} = 0 R_{32} = 0 R_{33} = 0
All components are zero, confirming the Schwarzschild metric is a vacuum solution to Einstein's field equations.
Computing the Einstein Tensor
If you want to numerically evaluate tensors at specific coordinates, use:
Creating a Custom Metric
Define your own metric using symbolic variables:
Important Note on Coordinates
iTensor uses the convention that timelike coordinates come first in the coordinate list, followed by spacelike coordinates. This affects the signature of the metric and the sign conventions in tensor calculations.