galgebra

Symbolic Geometric Algebra/Calculus package for SymPy :crystal_ball:

https://github.com/pygae/galgebra

Science Score: 41.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary

Keywords

clifford-algebras geometric-algebra physics python quaternions symbolic

Keywords from Contributors

mesh parallel closember interactive
Last synced: 6 months ago · JSON representation ·

Repository

Symbolic Geometric Algebra/Calculus package for SymPy :crystal_ball:

Basic Info
  • Host: GitHub
  • Owner: pygae
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Homepage: https://galgebra.rtfd.io/
  • Size: 53.2 MB
Statistics
  • Stars: 267
  • Watchers: 17
  • Forks: 67
  • Open Issues: 74
  • Releases: 8
Topics
clifford-algebras geometric-algebra physics python quaternions symbolic
Created about 8 years ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

GAlgebra

Symbolic Geometric Algebra/Calculus package for SymPy.

Ask DeepWiki PyPI PyPI - Python Version Python CI Documentation Status DOI

Development Status

PyPI - Status GitHub contributors Codecov Maintainability

brombo/galgebra was originally written by Alan Bromborsky, but was no longer actively maintained, and as of 2019-11-25 no longer exists.

pygae/galgebra is a community fork, maintained by Pythonic Geometric Algebra Enthusiasts.

The fork supports Python 3, increases test coverage, sets up CI and linters, maintains releases to PyPI, improves docs and has many bug fixes, see Changelog.

For information on how GAlgebra is used in other projects, see Used by.

[!IMPORTANT] Readers of Prof. Alan Macdonald's Linear and Geometric Algebra and Vector and Geometric Calculus, please check out Migrating guide for readers of LAGA&VAGC below.

If you are coming from sympy.galgebra or brombo/galgebra (unlikely nowadays), please check out section the old Migration Guide.

Features

Geometric Algebra

  • Arbitrary Vector Basis and Metric
  • Scalar, Vector, Bivector, Multivector, Pseudoscalar, Spinor, Blade
  • Basic Geometic Algebra Operations
    • Sum Difference
    • Geometric Product
    • Outer and Inner Products
    • Left and Right Contractions
    • Reverse, Dual, Exponential
    • Commutator
    • Projection, Reflection, Rotation
    • Reciprocal Frames
  • Inspecting Base/Blade Representation
  • Symbolic Manipulations
    • expand, factor, simplify, subs, trigsimp etc.

Overloaded Python operators for basic GA operations:

math \begin{split}\begin{aligned} A+B &= \texttt{A+B} \\ A-B &= \texttt{A-B} \\ AB &= \texttt{A*B} \\ A \wedge B &= \mathtt{A \verb!^! B} \\ A \cdot B &= \texttt{A|B} \\ A \rfloor B &= \mathtt{A \lt B} \\ A \lfloor B &= \mathtt{A \gt B} \\ A/B &= \texttt{A/B} \\ \end{aligned}\end{split}

Geometric Calculus

  • Geometric Derivative
  • Submanifolds
  • Linear Transformations
  • Differential Operators

The various derivatives of a multivector function is accomplished by multiplying the gradient operator vector with the function:

math \begin{aligned} \nabla F &= \texttt{grad*F} \\ F \bar{\nabla} &= \texttt{F*rgrad} \\ \nabla {\wedge}F &= \mathtt{grad \verb!^! F} \\ F {\wedge}\bar{\nabla} &= \mathtt{F \verb!^! rgrad} \\ \nabla \cdot F &= \texttt{grad|F} \\ F \cdot \bar{\nabla} &= \texttt{F|rgrad} \\ \nabla \rfloor F &= \mathtt{grad \lt F} \\ F \rfloor \bar{\nabla} &= \mathtt{F \lt rgrad} \\ \nabla \lfloor F &= \mathtt{grad \gt F} \\ F \lfloor \bar{\nabla} &= \mathtt{F \gt rgrad} \end{aligned}

math \begin{aligned} F \nabla &= \texttt{F*grad} \\ \bar{\nabla} F &= \texttt{rgrad*F} \\ F {\wedge}\nabla &= \mathtt{F \verb!^! grad} \\ \bar{\nabla} {\wedge}F &= \mathtt{rgrad \verb!^! F} \\ F \cdot \nabla &= \texttt{F|grad} \\ \bar{\nabla}\cdot F &= \texttt{rgrad|F} \\ F \rfloor \nabla &= \mathtt{F \lt grad} \\ \bar{\nabla} \rfloor F &= \mathtt{rgrad \lt F} \\ F \lfloor \nabla &= \mathtt{F \gt grad} \\ \bar{\nabla} \lfloor F &= \mathtt{rgrad \gt F} \end{aligned}

Tip: an example for getting grad and rgrad of a 3-d Euclidean geometric algebra in rectangular coordinates:

```python from sympy import symbols from galgebra.ga import Ga

o3d = Ga('e', g=[1,1,1], coords=symbols('x,y,z',real=True)) (grad,rgrad) = o3d.grads() ```

Printing

  • Enhanced Console Printing
  • Latex Printing
    • out-of-the-box support for Jupyter Notebook
    • PDF generation and croping support if you have pdflatex/pdfcrop installed

Getting Started

After installing GAlgebra (see section Installing GAlgebra below), in a Jupyter Notebook:

```python from sympy import symbols from galgebra.ga import Ga

from galgebra.printer import Format Format(Fmode = False, Dmode = True)

st4coords = (t,x,y,z) = symbols('t x y z', real=True) st4 = Ga('e', g=[1,-1,-1,-1], coords=st4coords)

M = st4.mv('M','mv',f = True)

M.grade(3).Fmt(3,r'\langle \mathbf{M} \rangle _3') ```

You will see:

math \begin{aligned} \langle \mathbf{M} \rangle _3 =& M^{txy} \boldsymbol{e}_{t}\wedge \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} \\ & + M^{txz} \boldsymbol{e}_{t}\wedge \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} \\ & + M^{tyz} \boldsymbol{e}_{t}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \\ & + M^{xyz} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{aligned}

You may also check out more examples here.

For detailed documentation, please visit https://galgebra.readthedocs.io/ .

Installing GAlgebra

Prerequisites

  • Works on Linux, Windows, Mac OSX
  • Python >= 3.8
    • 0.5.0 was the last supported release for Python 3.5-3.7
    • 0.4.x was the last supported release series for Python 2.7
  • SymPy >= 1.3
    • Only SymPy 1.12 is tested via CI, see .github/workflows/ci.yml for more details
    • 0.5.0 was the last supported release for SymPy 1.7

Installing GAlgebra From PyPI (Recommended for users)

bash pip install galgebra

Then you are all set!

Installing GAlgebra From Source (Recommended for developers)

To install from the latest source code of GAlgebra:

bash git clone https://github.com/pygae/galgebra.git cd galgebra pip install -e .

Note that the optional -e argument is used here for a developer install so modifying the source will take effect immediately without the need of reinstallation.

Now you may run tests to verify the installation, run from the root of the repository:

bash pip install pytest pytest test

Further, to run the complete test suite including the ones using nbval, just run:

bash pip install nbval pytest --nbval examples/ipython/ --nbval examples/primer/ test --nbval-current-env --nbval-sanitize-with test/.nbval_sanitize.cfg

This could take more than 10 minutes, please be patient.

Migration Guide

Migrating guide for readers of LAGA&VAGC

Readers of Linear and Geometric Algebra and Vector and Geometric Calculus might be guided by GAlgebra Primer (version November 29, 2022, accessed May, 2024) to download GAfiles.zip and copy gprinter.py, lt.py, mv.py, and GAlgebraInit.py¸ into where GAlgebra is installed.

These steps are NO LONGER NEEDED since GAlgebra 0.6.0 as they are merge into GAlgebra with tests, copying these files will cause conflicts and regressions of fixed bugs. Instead, you may follow the following steps:

bash pip uninstall galgebra pip install git+https://github.com/pygae/galgebra.git

GAlgebra will be installed as 0.6.0-dev as 0.6.0 has not yet been finalized and published to PyPI.

For minor differences to those files, please check out the change log for GAlgebra 0.6.0. Also please note that:

  • GAlgebraInit.py is renamed to primer.py and can be imported like from galgebra.primer import * but it's usage is discouraged, although it saves some boilerplate code, this is not part of GAlgebra's maintained API, GAlgebra might remove it in future.
  • Some notebooks from the zip are included in GAlgebra in examples/primer.

Bundled Resources

Note that in the doc/books directory there are:

  • BookGA.pdf which is a collection of notes on Geometric Algebra and Calculus based of "Geometric Algebra for Physicists" by Doran and Lasenby and on some papers by Lasenby and Hestenes.
  • galgebra.pdf which is the original main doc of GAlgebra in PDF format, while the math part is still valid, the part describing the installation and usage of GAlgebra is outdated, please read with caution or visit https://galgebra.readthedocs.io/ instead.
  • Macdonald which contains bundled supplementary materials for Linear and Geometric Algebra and Vector and Geometric Calculus by Alan Macdonald, see here and here for more information.
    • Particularly, GAlgebraPrimer.pdf is an archived version of GAlgebra Primer by Alan Macdonald, last updated on November 29, 2022.

Star History

Star History Chart

Contributors

Made with contrib.rocks.

Citing This Library

For citation information, see our CITATION.md file.

Owner

  • Name: pygae
  • Login: pygae
  • Kind: organization

Pythonic Geometric Algebra Enthusiasts

Citation (CITATION.md)

Citing This Library
-------------------

`galgebra` is published to zenodo.
DOI [10.5281/zenodo.10902114](https://doi.org/10.5281/zenodo.10902114) refers to all versions of `galgebra`.

If you want to cite all releases, use:
```BibTeX
@software{galgebra,
  author       = {Alan Bromborsky and
                  Utensil Song and
                  Eric Wieser and
                  Hugo Hadfield and
                  {The Pygae Team}},
  title        = {pygae/galgebra},
  month        = jun,
  year         = 2020,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.3857096},
  url          = {https://doi.org/10.5281/zenodo.3857096}
}
```

To obtain BibTex citation information for a _specific_ release (recommended):

* Run `python -m pip show galgebra` to determine which version you are using (or print `galgebra.__version__` from python)
* Click on the corresponding version from [this list of versions](https://zenodo.org/search?q=parent.id%3A3857096&f=allversions%3Atrue&l=list&p=1&s=10&sort=version)
* Scroll down to the bottom of the page, and click the "BibTex" link in the "Export" sidebar

GitHub Events

Total
  • Issues event: 7
  • Watch event: 34
  • Issue comment event: 36
  • Push event: 15
  • Pull request review event: 3
  • Pull request review comment event: 3
  • Pull request event: 9
  • Fork event: 4
  • Create event: 4
Last Year
  • Issues event: 7
  • Watch event: 34
  • Issue comment event: 36
  • Push event: 15
  • Pull request review event: 3
  • Pull request review comment event: 3
  • Pull request event: 9
  • Fork event: 4
  • Create event: 4

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 748
  • Total Committers: 10
  • Avg Commits per committer: 74.8
  • Development Distribution Score (DDS): 0.433
Past Year
  • Commits: 37
  • Committers: 1
  • Avg Commits per committer: 37.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Eric Wieser w****c@g****m 424
utensil u****l@g****m 234
Alan Bromborsky a****o 49
Mike Boyle m****e@g****m 21
Hugo Hadfield h****o@g****m 11
arsenovic a****c@g****m 4
Waldir Pimenta w****s@g****m 2
Alexander Engelsberger t****r@g****m 1
Sylvain Meunier s****r@g****m 1
dependabot[bot] 4****] 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 91
  • Total pull requests: 72
  • Average time to close issues: 11 months
  • Average time to close pull requests: 5 months
  • Total issue authors: 13
  • Total pull request authors: 7
  • Average comments per issue: 3.14
  • Average comments per pull request: 3.17
  • Merged pull requests: 57
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 6
  • Pull requests: 9
  • Average time to close issues: 2 days
  • Average time to close pull requests: 5 days
  • Issue authors: 4
  • Pull request authors: 2
  • Average comments per issue: 2.5
  • Average comments per pull request: 1.56
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • utensil (34)
  • eric-wieser (27)
  • Greg1950 (12)
  • mammalwong (7)
  • ingodahn (2)
  • ghost (2)
  • technolapin (1)
  • spinjo (1)
  • abrombo (1)
  • comp-algebra-42 (1)
  • arsenovic (1)
  • nadavsuissa (1)
  • moble (1)
Pull Request Authors
  • utensil (42)
  • eric-wieser (42)
  • moble (4)
  • dependabot[bot] (2)
  • spinjo (2)
  • meuns (1)
  • renovate[bot] (1)
Top Labels
Issue Labels
bug (16) component: transforms (7) from brombo/galgebra (7) component: core (7) component: printer (5) component: docs (5) enhancement (5) nice features (5) state:planned (5) component: differential operators (4) help wanted (3) stale (2) admin (2) fragment (2) question (1) performance (1)
Pull Request Labels
state: needs changelog (22) component: printer (18) component: docs (7) component: transforms (5) bug (5) Deprecation (4) enhancement (3) component: core (3) has changelog entry (2) dependencies (2) stale (2) state:reviewing (2) state:ready_to_merge (2) merge_postponed (1)

Dependencies

doc/readthedocs-pip-requirements.txt pypi
  • ipykernel *
  • ipython *
  • matplotlib *
  • nbsphinx *
  • nbsphinx-link *
  • notedown *
  • numba *
  • numpy *
  • pygments >=2.5.0
  • recommonmark >=0.6.0
  • releases >=1.6.1
  • scipy *
  • semantic-version ==2.6.0
  • sphinx-markdown-tables *
  • sphinx_rtd_theme >=0.5.0
  • sphinxcontrib-bibtex *
setup.py pypi
  • sympy *
test_requirements.txt pypi
  • ipython ==5.8.0 test
  • nbval * test
  • pytest >=4.4.0 test
  • pytest <6 test
  • pytest-cov * test
  • pytest-xdist * test
  • sympy ==1.7 test
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite