Posted in Code, Math, Physics, Projects

Lie Group Computations With Python

lie is a python module for computations with Lie groups, Lie algebras, representations, root systems, and more.

I based it on the computer algebra package LiE, written by M. A. A. van Leeuwen, A. M. Cohen and B. Lisser in the early 90’s. They chose to implement a proprietary scripting language as a wrapper for all the fancy mathematical algorithms. While this language is useful for interactive computations and short scripts, python is more expressive and powerful — definitely what you want when exploring your favorite exceptional group.

A Fun Example

Here’s an example of using lie to do a calculation that’s near and dear to every high energy theorist’s heart. We’ll show how the 10 + 5bar + 1 representation of SU(5) contains a single standard model generation. First we’ll fire up python and import the lie module.

Python 3.1 (r31:73578, Jun 27 2009, 21:49:46)
>>> from lie import *

Let’s let g be the GUT group SU(5) (A4 in Cartan’s classifiation).

>>> g = A4; g.pprint()

We’ll let the representation r be a single GUT generation: 10 + 5bar + 1 of SU(5).

>>> r = g.fund().dual() + g.alt_tensor(2) + g.trivial()
>>> r.pprint()
'(1) + (5b) + (10)'

Here, we’ll check that SU(2)×SU(3) is a subgroup of SU(5). Then we’ll get the restriction matrix for SU(2)×SU(3) in SU(5), and add the U(1) part by hand:

>>> [h.pprint() for h in g.max_subgrps()]
['SU(4)', 'SO(5)', 'SU(2)xSU(3)']
>>> m = g.res_mat(A1*A2)
>>> m = m.transpose().concat(mat([[-2,1,-1,2]])).transpose()

Finally, we decompose r under the group SU(2)×SU(3)×U(1). The first two numbers are the SU(2) and SU(3) rep dimensions, and the third is the U(1) charge (which differs from the conventional hypercharge by a factor of 6).

>>> r.branch(A1*A2*T1, m).pprint() 
'(1,1,0) + (1,1,6) + (1,3b,-4) + (1,3b,2) + (2,1,-3) + (2,3,1)'

These are indeed the representations of a generation of standard model fermions (written as left-handed Weyl spinors). In order, we have: a heavy neutrino, the positron, the up quark, the down quark, the lepton doublet, and the left-handed quark doublet. Yay!


I decided I needed something like lie last summer while working on Superconformal Flavor Simplified with David Poland. Since none of the mathematical tools that physicists commonly use (e.g. Mathematica) had any routines for Lie group representation theory, I was delighted to stumble upon LiE, which implemented basically all the algorithms I wanted. However, the authors’ choice to create their own scripting language was a little silly, and definitely not future-proof. For instance, while LiE implements lists of numbers (vectors) and lists of lists of numbers (matrices), it doesn’t know anything about lists of lists of lists of numbers. This might seem insignificant, but it was frustrating for two reasons:

LiE uses a list of integers to represent the highest weight vector of a representation, so if I want lists of representations, like in a model, I need lists of lists. And if I want lists of models, I need lists of lists of lists. Turns out I was trying to write a whole paper about lists of models.

Future Work

I developed lie to the point where it was capable of doing what I needed for Superconformal Flavor Simplified. There’s definitely some debugging and restructuring to be done. For instance, the sourcecode currently includes the entire lexer and parser from the original LiE, just because I haven’t bothered to extract them from everything else (I originally took the approach of trying to modify the LiE source as little as possible). It’s a work in progress, but lie has already been useful to me, so I figure others might benefit from it too.

So check out the source, give it a whirl, and if it doesn’t do what you want, help me make it better!

5 Responses to “Lie Group Computations With Python” Comment Feed, Trackback.

  1. Joseph Smidt says: Jun 03, 2010 @ 11:39 am

    Now here’s a cool Python module! Talk about useful. I love Lie groups.

  2. Puff says: Jun 08, 2010 @ 3:31 pm

    It’s Bremsstrahlung.

  3. davidsd says: Jun 08, 2010 @ 4:03 pm

    Good call.

  4. A.J. says: Nov 05, 2011 @ 11:37 am

    Thumbs up! Nice work.

  5. Rex says: Apr 16, 2013 @ 4:14 am

    Great! LiE and Macaulay2 are two of my favorite tools. With Macaulay2 we could handle rings and solve homology/cohomology groups.

    But I do agree both of them have limitations, for example, there is no MPI or OpenMP implemented and we can not do any high performance computaion.

    It is great to have a python module of LiE. Is there any python module comparable to Macaulay2?

Leave a Reply