The module symbolicGA implements symbolic Geometric Algebra in python. The relevant references for this module are:

  1. “Geometric Algebra for Physicists” by C. Doran and A. Lazenby, Cambridge University Press, 2003.
  2. “Geometric Algebra for Computer Science” by Leo Dorst, Daniel Fontijne, and Stephen Mann, Morgan Kaufmann Publishers, 2007.
  3. SymPy Tutorial,
sympy.galgebra.GA.LaTeX_lst(lst, title='')[source]

Output a list in LaTeX format.

sympy.galgebra.GA.NUMPAT = <_sre.SRE_Pattern object at 0x10d917cd8>

Re pattern for rational number

sympy.galgebra.GA.collect(expr, lst)[source]

Wrapper for sympy.collect.

sympy.galgebra.GA.comb(N, P)[source]

Calculates the combinations of the integers [0,N-1] taken P at a time. The output is a list of lists of integers where the inner lists are the different combinations. Each combination is sorted in ascending order.

sympy.galgebra.GA.cp(A, B)[source]

Calculates the commutator product (A*B-B*A)/2 for the objects A and B.

sympy.galgebra.GA.diagpq(p, q=0)[source]

Return string equivalent metric tensor for signature (p, q).

sympy.galgebra.GA.dualsort(lst1, lst2)[source]

Inplace dual sort of lst1 and lst2 keyed on sorted lst1.


Determine if a array is square and diagonal with entries of +1 or -1.


Test for integer.


Test if string represents a rational number.


Calculate magnitude of vector containing trig expressions and simplify. This is a hack because of way he sign of magsq is determined and because of the way that absolute values are removed.


Return list of n empty lists.


make_scalars takes a string of symbol names separated by blanks and converts them to MV scalars and returns a list of the symbols.

sympy.galgebra.GA.normalize(elst, nname_lst)[source]

Normalize a list of vectors and rename the normalized vectors. ‘elist’ is the list (or array) of vectors to be normalized and nname_lst is a list of the names for the normalized vectors. The function returns the numpy arrays enlst and mags containing the normalized vectors (enlst) and the magnitudes of the original vectors (mags).


Returns rational numbers compatible with symbols. Input is a string representing a fraction or integer or a simple integer.

sympy.galgebra.GA.reciprocal_frame(vlst, names='')[source]

Calculate reciprocal frame of list (vlst) of vectors. If desired name each vector in list of reciprocal vectors with names in space delimited string (names).

sympy.galgebra.GA.reduce_base(k, base)[source]

If base is a list of sorted integers [i_1,...,i_R] then reduce_base sorts the list [k,i_1,...,i_R] and calculates whether an odd or even number of permutations is required to sort the list. The sorted list is returned and +1 for even permutations or -1 for odd permutations.

sympy.galgebra.GA.set_names(var_lst, var_str)[source]

Set the names of a list of multivectors (var_lst) for a space delimited string (var_str) containing the names.

sympy.galgebra.GA.sub_base(k, base)[source]

If base is a list of sorted integers [i_1,...,i_R] then sub_base returns a list with the k^th element removed. Note that k=0 removes the first element. There is no test to see if k is in the range of the list.


Test if all elements in list are 0.


Remove absolute values from expressions so a = sqrt(a**2). This is a hack.

sympy.galgebra.GA.vector_fct(Fstr, x)[source]

Create a list of functions of arguments x. One function is created for each variable in x. Fstr is a string that is the base name of each function while each function in the list is given the name Fstr+’__’+str(x[ix]) so that if Fstr = ‘f’ and str(x[1]) = ‘theta’ then the LaTeX output of the second element in the output list would be ‘f^{theta}’.

Previous topic

Geometric Algebra Module Docstring

Next topic


This Page