Package: galgebra
GAlgebraSymbolic Geometric Algebra/Calculus package for SymPy.Development Statusbrombo/galgebrawas originally written by Alan Bromborsky, but was no longer actively maintained, and as of 2019-11-25 no longer exists.pygae/galgebrais a community fork, maintained byPythonic Geometric Algebra Enthusiasts.The fork supports Python 3, increases test coverage, set up CI and linters, maintains releases toPyPI, improvesdocsand has many bug fixes, seeChangelog.FeaturesGeometric AlgebraArbitrary Vector Basis and MetricScalar, Vector, Bivector, Multivector, Pseudoscalar, Spinor, BladeBasic Geometic Algebra OperationsSum DifferenceGeometric ProductOuter and Inner ProductsLeft and Right ContractionsReverse, Dual, ExponentialCommutatorProjection, Reflection, RotationReciprocal FramesInspecting Base/Blade RepresentationSymbolic Manipulationsexpand,factor,simplify,subs,trigsimpetc.Overloaded Python operators for basic GA operations:Geometric CalculusGeometric DerivativeSubmanifoldsLinear TransformationsDifferential OperatorsThe various derivatives of a multivector function is accomplished by multiplying the gradient operator vector with the function:Tip: an example for gettinggradandrgradof a 3-d Euclidean geometric algebra in rectangular coordinates:fromsympyimportsymbolsfromgalgebra.gaimportGao3d=Ga('e',g=[1,1,1],coords=symbols('x,y,z',real=True))(grad,rgrad)=o3d.grads()PrintingEnhanced Console PrintingLatex Printingout-of-the-box support for Jupyter NotebookPDF generation and croping support if you havepdflatex/pdfcropinstalledGetting StartedAfter installing GAlgebra (see sectionInstalling GAlgebrabelow), in a Jupyter Notebook:fromsympyimportsymbolsfromgalgebra.gaimportGafromgalgebra.printerimportFormatFormat(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:You may also check out more exampleshere.For detailed documentation, please visithttps://galgebra.readthedocs.io/.NOTE:If you are coming fromsympy.galgebraorbrombo/galgebra, please check out sectionMigration Guidebelow.Installing GAlgebraPrerequisitesWorks on Linux, Windows, Mac OSXPython>= 3.5  (0.4.x was the last supported release series for Python 2.7)SymPy>= 1.3Installing GAlgebra From PyPI (Recommended for users)pipinstallgalgebraThen you are all set!Installing GAlgebra From Source (Recommended for developers)To install from the latest source code of GAlgebra:gitclonehttps://github.com/pygae/galgebra.gitcdgalgebra
pipinstall-e.Note that the optional-eargument 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:pipinstallpytest
pytesttestFurther, to run the complete test suite including the ones usingnbval, just run:pipinstallnbval
pytest--nbvalexamples/ipython/test--current-env--sanitize-withtest/.nbval_sanitize.cfgThis could take more than 10 minutes, please be patient.Migration GuideNote: The APIs have changed since the era ofsympy.galgebraandbrombo/galgebra, some properties and methods are deprecated, the supported versions of Python and SymPy have also changed, please checkChangelogand further update your scripts accordingly besides the following. If you encounter any problems, feel free toopen an issue!Migrating fromsympy.galgebraGAlgebra is no longer part of SymPy since 1.0.0, if you have an import like this in your source:fromsympy.galgebra.gaimport*Simply remove thesympy.prefix beforegalgebrathen you are good to go:fromgalgebra.gaimport*Migrating frombrombo/galgebraThesetgapth.pyway to install is now deprecated bypip install galgebraand all modules in GAlgebra should be imported fromgalgebra, for example:fromgalgebra.printerimportFormat,Eprint,latex,GaPrinterfromgalgebra.gaimportGafromgalgebra.mvimportMv,NgaBundled ResourcesNote that in thedoc/booksdirectory there are:BookGA.pdfwhich 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.pdfwhich 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 cautious or visithttps://galgebra.readthedocs.io/instead.Macdonaldwhich constains bundled supplementary materials forLinear and Geometric AlgebraandVector and Geometric Calculusby Alan Macdonald, seehereandherefor more information.