Skip to main content

Python wrapper for XAct.jl — tensor algebra for general relativity

Project description

xact-py

PyPI Build Status License: GPL v3

Python wrapper for XAct.jl — a native Julia port of the Wolfram xAct tensor algebra library for general relativity.

Note: All code in this repository is generated by AI. It was built under strict engineering practices but is not warranted to be absolutely correct. See the full disclaimer.

Installation

Install the latest published release from PyPI:

pip install xact-py

If you need unreleased changes from this repository, install from a local checkout in editable mode:

git clone https://github.com/sashakile/XAct.jl.git
cd XAct.jl
uv pip install -e packages/xact-py

Julia is managed automatically via juliacall.

Quick Start

import xact

xact.reset()
M = xact.Manifold("M", 4, ["a", "b", "c", "d"])
T = xact.Tensor("T", ["-a", "-b"], M, symmetry="Symmetric[{-a,-b}]")
xact.canonicalize("T[-b,-a] - T[-a,-b]")  # returns "0"

Features

  • Canonicalization — Butler-Portugal algorithm for tensor index canonicalization
  • Contraction & Simplification — metric contraction, iterative simplification
  • Covariant Derivatives — commutation, sorting, Riemann identities
  • Perturbation Theory — multinomial Leibniz expansion, curvature perturbations
  • Coordinate Components (xCoba) — basis changes, Christoffel symbols, CTensor
  • Riemann Invariants (xInvar) — classification and database of Riemann polynomial invariants
  • Variational Calculus — Euler-Lagrange operator, integration by parts

Example: Metric and Curvature

import xact

xact.reset()
M = xact.Manifold("M", 4, ["a", "b", "c", "d", "e", "f"])
g = xact.Metric("g", ["-a", "-b"], M)

# Riemann symmetry: R_abcd + R_abdc = 0
xact.canonicalize("RiemannCD[-a,-b,-c,-d] + RiemannCD[-a,-b,-d,-c]")
# returns "0"

# Simplify a contracted Riemann expression
xact.simplify("RicciCD[-a,-b] - RiemannCD[-a,-c,-b,-d] * g[c,d]")
# returns "0"

Documentation

Full documentation at saxa.xyz/XAct.jl.

License

GPL-3.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xact_py-0.7.1-py3-none-any.whl (221.7 kB view details)

Uploaded Python 3

File details

Details for the file xact_py-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: xact_py-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 221.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xact_py-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abb0a2f7be0b3bc2694b34bd9e2f2b619af37e0c60ea8522164aca91fd18f762
MD5 a757acfbdb60e0027945bf3613e6b0a0
BLAKE2b-256 5d44a21542fa62af09674ccc9966e72025e7a6d601eb87ac977b7499e9a882d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for xact_py-0.7.1-py3-none-any.whl:

Publisher: release.yml on sashakile/XAct.jl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page