Nicalas... Your suggestion almost work, and in fact it is exactly what I'm talking about!
Specifically, my idea is to work with connections with values in a non- Abelian Lie algebra, SU(2), so there are 3 generators. Therefore, the first entry of my function is a form, and the second is a Lie algebra generator!. I tried this class nAform(object): def __init__(self, a, b): self._form = a self._matrix = b def __add__(self, other): if isinstance(other, nAform): if (self._matrix == other._matrix): return nAform(self._form + other._form, self._matrix) else: raise NotImplemented raise NotImplemented def __mul__(self, other): if isinstance(other, nAform): return nAform(self._form.wedge(other._form), self._matrix.commutator(other._matrix)) raise NotImplemented def __repr__(self): return str((self._form, self._matrix)) def __str__(self): return self.__repr__() And for monomials form it can multiply. But I got stacked in the definition of an addition, if the generators of the algebra are different! Which is, of course, one of the most important part of the class. Any additional help is welcome! DOX -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org