Hi everyone, today I start to write a new class for dealing with non-Abelian forms, i.e., forms with values in a certain Lie-algebra. This could be really useful when computing Yang-Mills theories in physics.
So, I started by defining a new object which have two entries, a differential form and a matrix, and call it nAform. The code I wrote was,
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: return NotImplemented return NotImplemented def __mul__(self, other): if isinstance(other, nAform): return nAform(self._form.wedge(other._form), self._matrix.commutator(other._matrix)) return NotImplemented def diff(self): return nAform(self._form.diff(), self._matrix) def __repr__(self): return str((self._form, self._matrix)) def __str__(self): return self.__repr__()
One should enter a couple of arguments when defining the nAform object. The __init__ attribute recognize them.
Then an addition attribute is defined, this is incomplete!!!
Another attribute is the multiplication, which take the wedge product of the forms and the commutator of the matrices.
I also implement the exterior derivative on nAform objects.
Finally the __repr__ and __str__ are attributes for returning the data.
Nicolas M. Thiery note, this objects should define a Monoid (or something quit close to it). But my programming skills are not so developed.
sage: x, y, z = var('x, y, z') sage: U = CoordinatePatch((x, y, z)); U Open subset of R^3 with coordinates x, y, z sage: F = DifferentialForms(U); F Algebra of differential forms in the variables x, y, z sage: F.gens() (dx, dy, dz) sage: F.ngens() 3
I’d like one which do like this,
sage: form1 = DifferentialForm(F, 1); form1.ngens() 3 sage: form1 = DifferentialForm(F, 1); form1.gens() (dx, dy, dz) form2 = DifferentialForm(F, 2); form2.ngens() 3 sage: form1 = DifferentialForm(F, 1); form1.gens() (dx/\dy, dy/\dz, dz/\dx)
Simple SAGE sheet
Hope you can help me with these plenty tasks.