Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OK. I think I've figured out how to implement the Lie bracket. If there is a cleverer way to do this, I'd be grateful for improvements. It still seems rather clunky.

My code is the following:

Vir = CombinatorialFreeModule(QQbar,[Integer(), 'c'], prefix='L')

The Virasoro generators are output as L[n] for integers n, while the central element is output as L['c'] (just C would be nicer, but I haven't figured out how to do that).

I've implemented the Lie bracket as

def lie_bracket(element1, element2):
for i in comp1:
    for j in comp2:
        bracket= i[1]*j[1]*(i[0]-j[0])*Vir.monomial(i[0]+j[0]) + kronecker_delta(i[0],-j[0])*(i[0]^3-i[0])*Vir.monomial('c')/12 + bracket
return bracket

This code seems to work. E.g.

----->    4*L[0] + 1/2*L['c']

Which is the correct output.