ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 23 Oct 2022 14:02:51 +0200A Sage implementation of the Virasoro algebra and its representationshttps://ask.sagemath.org/question/10809/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)$.
Thanks in advance for any advice.Thu, 05 Dec 2013 18:31:19 +0100https://ask.sagemath.org/question/10809/a-sage-implementation-of-the-virasoro-algebra-and-its-representations/Answer by Gonneman for <p>Hello everyone,</p>
<p>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.</p>
<p>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).</p>
<p>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.</p>
<p>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.
<code>Vir=CombinatorialFreeModule(QQbar,Integer(), prefix='L')</code>
(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.</p>
<p>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.</p>
<ol>
<li>Define a bracket on the generators that extends linearly to the whole Virasoro algebra.</li>
<li>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 *.</li>
<li>Define an action of Virasoro generators on basis elements of $M(h,c)$ and extend this action linearly to all of $M(h,c)$.</li>
<li>Extend the action of Virasoro generators on $M(h,c)$ to products of Virasoro generators acting on $M(h,c)$.</li>
</ol>
<p>Thanks in advance for any advice.</p>
https://ask.sagemath.org/question/10809/a-sage-implementation-of-the-virasoro-algebra-and-its-representations/?answer=15765#post-id-15765OK. 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.Fri, 06 Dec 2013 08:11:53 +0100https://ask.sagemath.org/question/10809/a-sage-implementation-of-the-virasoro-algebra-and-its-representations/?answer=15765#post-id-15765Comment by AlAnGeTo for <p>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.</p>
<p>My code is the following:</p>
<pre><code>Vir = CombinatorialFreeModule(QQbar,[Integer(), 'c'], prefix='L')
</code></pre>
<p>The Virasoro generators are output as <code>L[n]</code> for integers <code>n</code>, while the central element is output as <code>L['c']</code> (just <code>C</code> would be nicer, but I haven't figured out how to do that).</p>
<p>I've implemented the Lie bracket as</p>
<pre><code>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
</code></pre>
<p>This code seems to work. E.g.</p>
<pre><code>lie_bracket(Vir.monomial(2),Vir.monomial(-2))
-----> 4*L[0] + 1/2*L['c']
</code></pre>
<p>Which is the correct output.</p>
https://ask.sagemath.org/question/10809/a-sage-implementation-of-the-virasoro-algebra-and-its-representations/?comment=64583#post-id-64583I think you want parentheses around some of the terms:
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
otherwise the Lie bracket is not bilinear.Sun, 23 Oct 2022 14:02:51 +0200https://ask.sagemath.org/question/10809/a-sage-implementation-of-the-virasoro-algebra-and-its-representations/?comment=64583#post-id-64583