Metadata-Version: 2.4
Name: supernumbers
Version: 0.24.0
Summary: Supernumbers and supergeometry in the sense of Bryce DeWitt's Supermanifolds.
Author: UFO Weekly
License: MIT
Project-URL: Homepage, https://github.com/GreyhawkTech/supernumbers
Project-URL: Documentation, https://github.com/GreyhawkTech/supernumbers/blob/main/docs/TUTORIAL.md
Keywords: supernumbers,grassmann,supermanifolds,supersymmetry
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: plot
Requires-Dist: matplotlib; extra == "plot"
Provides-Extra: geometry
Requires-Dist: clifford; extra == "geometry"
Requires-Dist: pyganja; extra == "geometry"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# Supernumbers

[![Tests](https://github.com/GreyhawkTech/supernumbers/actions/workflows/tests.yml/badge.svg)](https://github.com/GreyhawkTech/supernumbers/actions/workflows/tests.yml)

Finite and unlimited supernumbers in the sense of Bryce DeWitt's *Supermanifolds*.

A supernumber is an element of a Grassmann algebra generated by anticommuting
elements \(\xi_i\) with \(\xi_i^2 = 0\). Even elements commute with everything.
Odd elements anticommute with other odd elements. The scalar term is the body;
everything else is the nilpotent soul.

## Who this is for

The package is for people who want to compute with DeWitt's definitions rather
than re-derive them. Typical uses are checking a Berezinian, expanding a soul
series, confirming that a transition is determined by its body, or integrating a
polynomial density. It is a numerical library, not a computer-algebra system and
not a replacement for the book.

## Contract

These limits are part of the design. They are not temporary gaps.

- Finite generators are stored as bitmasks. Unlimited generators are stored as sorted index tuples. The two representations convert to each other.
- A real algebra accepts only real coefficients. A complex algebra accepts complex coefficients and exposes `real_part` and `imag_part`.
- Inverses, logarithms, real powers, and absolute value require a nonzero body. A zero-body supernumber raises `SupernumberError`.
- Polynomial densities integrate exactly, term by term. Any other density uses the trapezoid rule over a rectangular body domain.
- The Haar density on GL(m|n) is the reciprocal of the Berezinian. Integration skips body matrices that are not invertible.
- Geometric visualization needs the optional `clifford` and `pyganja` packages and is only meaningful for three generators or fewer.

The MIT license is in [LICENSE](LICENSE). The copyright holder is UFO Weekly.

## Module map

| Module | What it holds |
| --- | --- |
| `algebra` | GrassmannAlgebra and Supernumber (finite, bitmask) |
| `infinite` | UnlimitedAlgebra and InfiniteSupernumber (generators named on demand) |
| `real` | RealAlgebra, is_real, real_part, imag_part |
| `analysis` | c/a type, soul order, conjugate, absolute value, Superanalytic, DeWitt limit |
| `supervector` | Even and odd supervectors |
| `supermatrix` | Even and odd supermatrices, supertrace, Berezinian |
| `superfunction` | Polynomial maps on a superspace |
| `transition` | Chart transition maps |
| `atlas` | Charts and atlases |
| `manifold` | Supermanifolds, points, tangent vectors, densities |
| `dewitt` | Body manifold and DeWitt opens |
| `geometry` | Function sheaves and differential forms |
| `connections` | Supermetric, Connection, curvature, torsion, geodesic step |
| `integration` | Berezin integral, body integral, exact polynomial integral |
| `superlie` | GL(m|n), SL, OSp, U, Haar density |
| `examples` | The four gallery calculations |

## Install

```bash
pip install -e ".[dev]"
```

Optional extras:

```bash
pip install -e ".[plot]"      # coefficient charts
pip install -e ".[geometry]"  # Clifford export and pyganja view
```

## Tutorial

A short walkthrough of four DeWitt-style calculations is in
[docs/TUTORIAL.md](docs/TUTORIAL.md). The same calculations are callable:

```python
from supernumbers import (
    inverse_of_one_one_matrix,
    berezinian_of_a_linear_change,
    body_determined_transition,
    gaussian_over_a_soul,
)

inverse_of_one_one_matrix()
berezinian_of_a_linear_change()
body_determined_transition()
gaussian_over_a_soul()
```

## Use

```python
from supernumbers import GrassmannAlgebra

algebra = GrassmannAlgebra(2)
xi0, xi1 = algebra.generator(0), algebra.generator(1)

z = 3 + xi0 - 2 * xi0 * xi1
print(z)                  # 3 + xi_{0} - 2xi_{0,1}
print(z * z.inverse())    # 1
print((xi0 * xi1) == -(xi1 * xi0))
print(z.to_latex())
```

See [CHANGELOG.md](CHANGELOG.md) for the version history.

## How to cite

If you use this software, cite the repository and DeWitt's book:

- UFO Weekly. *Supernumbers*. https://github.com/GreyhawkTech/supernumbers
- Bryce DeWitt. *Supermanifolds*. Cambridge University Press, 2nd edition, 1992.

A machine-readable citation is in [CITATION.cff](CITATION.cff).

## License

MIT. See [LICENSE](LICENSE).
