Metadata-Version: 2.4
Name: numga
Version: 2.0.0
Summary: Geometric algebra and extensors in NumPy, JAX, PyTorch and WebGPU
Author-email: Eelco Hoogendoorn <hoogendoorn.eelco@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Eelco Hoogendoorn
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/EelcoHoogendoorn/numga
Project-URL: Repository, https://github.com/EelcoHoogendoorn/numga
Project-URL: Documentation, https://github.com/EelcoHoogendoorn/numga/blob/main/docs/README.md
Project-URL: Issues, https://github.com/EelcoHoogendoorn/numga/issues
Keywords: geometric algebra,clifford algebra,extensors,numpy,jax,pytorch,webgpu
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0
Provides-Extra: linalg
Requires-Dist: scipy>=1.13; extra == "linalg"
Provides-Extra: wgpu
Requires-Dist: wgpu>=0.32; extra == "wgpu"
Provides-Extra: jax
Requires-Dist: jax>=0.5; extra == "jax"
Provides-Extra: torch
Requires-Dist: torch>=2.3; extra == "torch"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# numga

[![CI](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml/badge.svg)](https://github.com/EelcoHoogendoorn/numga/actions/workflows/ci.yml)

Geometric algebra with extensors in NumPy, JAX, PyTorch and WebGPU.

Extensors generalize matrices and tensors from vectors to multivectors, and from the inner and tensor products to every product of geometric algebra.

<table>
<tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/relativity/gravitational_waves/"><b>Gravitational waves</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/relativity/gravitational_waves/waves.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/gravitational_waves_inside.gif" alt="Crystals of atoms ringing as a gravitational wave passes, seen from inside a closed universe whose great circles are strung with its mesh's vertices" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/thermodynamics/snowflake/"><b>Snowflake thermodynamics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/thermodynamics/snowflake/snowflake.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/snowflake.gif" alt="A seed of ice in undercooled water growing into a six-armed dendrite" width="100%"></td></tr>
<tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/geometry/scenegraph/"><b>Scenegraph and camera optics</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/geometry/scenegraph/scenegraph.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/scenegraph.gif" alt="A robot arm in 3D, and its picture on a camera sensor" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/mechanics/rattleback/"><b>Spin reversal by rolling contact</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/rattleback/rattleback.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/rattleback.gif" alt="A wooden rattleback spun the wrong way, rocking, stopping and spinning back" width="100%"></td></tr>
<tr><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/estimation/multiview/"><b>Summing cones into splats</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/estimation/multiview/multiview_reconstruction.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/multiview_convergence.gif" alt="Cameras aligning on a scene" width="100%"></td><td width="50%" align="center"><a href="https://github.com/EelcoHoogendoorn/numga/tree/v2.0.0/examples/quantum/condensate/"><b>Quantized vortices in a Bose–Einstein condensate</b></a> <a href="https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/quantum/condensate/condensate.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a><br><img src="https://raw.githubusercontent.com/EelcoHoogendoorn/numga/v2.0.0/plots/condensate.gif" alt="A rotating condensate settling into a lattice of quantized vortices" width="100%"></td></tr>
</table>

**Explore live:** [a rotating black hole](https://eelcohoogendoorn.github.io/numga/examples/relativity/kerr/kerr_webgpu.html) · [a gravitational wave](https://eelcohoogendoorn.github.io/numga/examples/relativity/gravitational_waves/gravitational_waves_webgpu.html)

## Extensors

**[An introduction to extensors, and a gallery of what they do](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensors.md)**: from a robot arm and its camera to a snowflake, a dynamo and a closed universe, each example a picture and the few lines of extensor code that compute it.

A short example of the extensor syntax: building unary maps and bilinear forms, and solving for the vibration modes of four point masses on springs:

```python
points = mv.point([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]])   # four unit masses
inertia = (points & points.commutator(Bivector)).sum(axis=0)   # Antibivector <- Bivector

springs = points[:, None] & points[None, :]                    # [points, points] Antibivector: a line through each pair
stiffness = (springs * (springs & Bivector)).sum(axis=(0, 1)) / 2   # Antibivector <- Bivector
# the vibration modes, between two bilinear energy forms
values, modes = (Bivector & stiffness).eigh(Bivector & inertia)
```

The full example: [vibration modes](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/mechanics/modes/modes.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/EelcoHoogendoorn/numga/blob/main/examples/mechanics/modes/modes.ipynb)

## Documentation

* [Tutorials](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#overview-and-tutorials): step-by-step primers on [geometric algebra](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/geometric-algebra/00-introduction.md) and [extensors](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/tutorial/extensors/00-introduction.md).
* [Guides and reference](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/README.md#guides-and-reference): [extensor syntax](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/extensor_syntax.md), [orientation](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/orientation.md), [fields](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/fields.md), [simplicial topologies](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/topology.md), [WebGPU shaders and rendering](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/rendering.md), [conventions](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/conventions.md) and [internals](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/docs/internals.md).
* [Examples](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/examples/README.md): over 200 runnable notebooks across geometry, estimation, surfaces, mechanics, fluids, optics, electromagnetism, relativity, quantum physics and thermodynamics.

## Articles

[Conceptual articles](https://github.com/EelcoHoogendoorn/numga/blob/v2.0.0/articles/README.md) on extensors, orientation, the regressive product, complementarity, discrete differential geometric algebra and coupled thermodynamics, and how extensors relate to linear algebra, tensors and forms.

## Install and run

Install from PyPI:

```sh
pip install numga
```

To install `numga` with the `examples` package from GitHub and run an example:

```sh
pip install "numga[examples] @ https://github.com/EelcoHoogendoorn/numga/archive/HEAD.tar.gz"
python -m examples.mechanics.modes.scenarios
```
