Geometric algebra in sympy


Back to Blog

This is a small tutorial to using the geometric algebra package in SymPy.

The package was written by, and is maintained by, Alan Bromborsky.

Geometric algebra is best done without choosing a basis. For this, a pencil and a paper suffices. However, as soon as we need to specify a fixed object, we need to introduce a basis, and therefore coordinates. Computers are essential for computations based on coordinates, since a geometric algebra on an -dimensional space is -dimensional. Even in , the quaternions, the number of operations to perform a single quaternion rotation is too much work to perform by hand — and error-prone.

While there exists software to carry out numerical computations with geometric algebras, a mathematician craves, in addition, an ability to perform symbolic computations. This is sometimes useful as an intermediate step to a better coordinate-free proof.

The symbolic geometric algebra in SymPy allows you to compute both symbolically and numerically with multi-vectors using a given basis and a given symmetric bilinear form.

This tutorial was written to support a course in geometric algebra at Tampere University of Technology.



Install 32-bit Python 2.7

…unless you know better. Some Python libraries do not have prebuilt 64-bit versions available (on Windows). Also, Python 3 is not compatible with Python 2.7, and so older Python libraries may not run in Python 3.


Install SymPy.

Windows: On Windows, you must run the SymPy installer with administrator rights (right click -> Run as Administor). Otherwise you get a weird installation error. If you get that, no worries. Just run the installation again.


The best way to get acquainted with the geometric algebra package is probably to run the Python interpreter in an interactive mode. For more complex tasks, it is better to write a complete program in a text file, and then run that program.

Important: the operators in Python, which are overloaded to denote the operators of geometric algebra, have a precedence different to their actual counterparts. Therefore, you must use brackets to guarantee a correct order of evaluation.

Learn more