# A Sage implementation of the Virasoro algebra and its representations

Hello everyone,

A few years ago I tried to implement the Virasoro algebra on Sage, but due to having a lot of other things to do, I didn't really get anywhere. Now I'd like to try again in earnest. But due to not having a lot of experience with programming, I'm having a hard time reading the Sage documentation. So I was hoping people could give me some pointers to get me going.

First some math: The Virasoro algebra is a complex infinite dimensional Lie algebra with generators $L_n, n\in \mathbb{Z}$ and bracket $[L_m,L_n]=(m-n)L_{m+n}+\delta_{m,-n}(m^3-m)\frac{C}{12}$, where $\delta$ is the Kronecker delta and $c$ is the central element of the Virasoro algebra (aka central charge).

A Verma module $M(h,c)$ of the Virasoro algebra is generated by a highest weight vector $v(h,c)$ such that $L_0v(h,c)=hv(h,c)$, $Cv(h,c)=cv(h,c)$ and $L_nv(h,c)=0,\ n>0$. The remaining generators act freely up to the relations coming from the Virasoro algebra itself. Therefore, a basis of $M(h,c)$ is given by $L_{-n_1}L_{-n_2}\cdots L_{-n_m}v(h,c)$, where $n_1\geq n_2\geq \cdots \geq n_n\geq1,\ m\geq0$, i.e. it is parametrised by all partitions of integers.

Here is what I've learned from talking to people on this forum a few years ago: Since the Virasoro algebra and its Verma modules are parametrised by integers and partitions of integers, it seems natural to define them using CombinatorialFreeModule, e.g. Vir=CombinatorialFreeModule(QQbar,Integer(), prefix='L') (this does not include the central element $C$). Unfortunately I'm clueless as to how to define the Lie bracket, orderings of generators and an action on the Verma module.

The list below is a detailed list of things I wish to implement. If someone could help me with one or two of those, I think I should be able to figure out the rest by example.

1. Define a bracket on the generators that extends linearly to the whole Virasoro algebra.
2. Define an ordering of generators such that a multiplication of generators can be defined, i.e. the universal enveloping algebra. The ordering is: If $m < n$ then $L_m \cdot L_n$ just stays $L_m\cdot L_n$ but $L_n\cdot L_m=[L_n,L_M]+L_m\cdot L_n$. All the better if this product could overload the multiplication symbol *.
3. Define an action of Virasoro generators on basis elements of $M(h,c)$ and extend this action linearly to all of $M(h,c)$.
4. Extend the action of Virasoro generators on $M(h,c)$ to products of Virasoro generators acting on $M(h,c)$.

edit retag close merge delete

Sort by ยป oldest newest most voted

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):
comp1=element1.monomial_coefficients().items()
comp2=element2.monomial_coefficients().items()
bracket=Vir.zero()
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.

lie_bracket(Vir.monomial(2),Vir.monomial(-2))
----->    4*L[0] + 1/2*L['c']


Which is the correct output.

more