Ask Your Question

Gonneman's profile - activity

2018-12-12 03:03:41 -0500 commented answer Overloading the binary operation of symmetric groups to reverse the order

Thanks for the link to the bug report. That report also mentions setting multiplication to right-to-left (r2l), as you do, but then notes that this breaks code elsewhere. Quite unsatisfying.

I'm surprised that the _mul_ method is so hard to overload.

2018-12-11 10:17:12 -0500 received badge  Nice Question (source)
2018-12-11 09:49:40 -0500 asked a question Overloading the binary operation of symmetric groups to reverse the order

I believe the Sage implementation of symmetric groups uses GAP which composes permutations in the opposite order to what I am used to. E.g. if (1,2) denotes the permutations switching 1 and 2, and (2,3) switches 2 and 3, then I would say (1,2) * (2,3) = (1,2,3), because I would first evaluate (2,3) and then (1,2) (the order in which one evaluates functions). Sage on the other hand produces (1,2) * (2,3) = (1,3,2).

About a year ago, a friend helped me overload the definition of the binary operation to have the composition of permutations evaluated in the order I am used to. The code that worked was

class NewSymmetricGroupElement(sage.groups.perm_gps.permgroup_element.SymmetricGroupElement):
    def _mul_(self, other):
        """Calling the original class method with order inverted"""
        return sage.groups.perm_gps.permgroup_element.SymmetricGroupElement._mul_(other, self)

class NewSymmetricGroup(SymmetricGroup):
def _element_class(self):
    return NewSymmetricGroupElement

I recently updated to Sage 8.4 and the code no longer works. Here is what happens, after executing the code above, I run:

NS3=NewSymmetricGroup(3); NS3
  > Symmetric group of order 3! as a permutation group
a=NS3((1,2)); b=NS3((2,3));

a*b = (1,3,2) # I would expect (1,2,3)

Can anyone spot what I am doing wrong?

2018-12-09 16:51:13 -0500 received badge  Taxonomist
2018-11-12 17:48:40 -0500 received badge  Notable Question (source)
2017-11-08 00:44:40 -0500 received badge  Popular Question (source)
2016-12-11 14:15:48 -0500 commented answer Display the Young lattice using Sage and Latex

Hi S├ębastien. Thank you for the suggestion and sorry for my long silence. I'm currently travelling. I'll try out your suggestion once I'm back later this week!

2016-12-08 14:29:29 -0500 commented question Display the Young lattice using Sage and Latex

The latex code you linked to compiles for me too. How odd, I was certain cloud.sagemath did not produce code that worked for me, yet now it does (both your code and what cloud.sagemath produce for me, work).

I wonder why my local installation of sage produces different LaTeX code.

2016-12-08 05:14:12 -0500 commented question Display the Young lattice using Sage and Latex

Excellent advice regarding pastebin! I've edited the question accordingly.

2016-12-07 16:52:29 -0500 received badge  Notable Question (source)
2016-12-07 12:13:58 -0500 asked a question Display the Young lattice using Sage and Latex

Hi everyone,

I'm trying to follow http://doc.sagemath.org/html/en/thema... to generate pictures of Young's lattice. Unfortunately I seem to be getting LaTeX code which won't compile.

I'm using Sage 7.4 (run locally not on the cloud), pdfTeX, Version 3.1415926-2.5-1.40.14 and I have the TKZ packages installed. Running sage locally or on the cloud seems to generate the same LaTeX output. I get the same errors on 2 different computers, both running OpenSUSE 42.1. I've tried generating the LaTeX code using the sagecloud, but as far as I can tell it generates the same source code and I can't compile it.

The code I input is:

level = 6
elements = [b for n in range(level) for b in Partitions(n)]
ord = lambda x,y: y.contains(x)
Y = Poset((elements,ord), facade=True)
H = Y.hasse_diagram()
view(H)  # optional - dot2tex graphviz

I'd like to attach error logs and the latex source code generated by "latex(H)", but apparently I do not have enough karma to do so. The error messages are basically many repetitions of the following snippet.

! Illegal parameter number in definition of \cmdGR@vertex@L.
<to be read again> 
                   1
l.136 }$},x=1.0389cm,y=1.8082cm]{v1}

You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.

Edit: fidbc had the excellent idea of uploading my error log and latex source to pastebin, so here they are.

I am trying to compile the LaTeX code with the following packages: "tikz", "tkz-graph", "tkz-berge", "tkz-arith" and for tikz I am also loading the "arrows" and "shapes" libraries. Am I missing any necessary libraries?

2016-08-11 17:44:38 -0500 received badge  Famous Question (source)
2016-08-11 17:44:38 -0500 received badge  Notable Question (source)
2014-06-29 14:50:17 -0500 received badge  Popular Question (source)
2014-06-29 14:50:17 -0500 received badge  Notable Question (source)
2013-12-10 21:27:21 -0500 asked a question Ascending tuples of integers

Hi everyone,

I'm trying to define the set of all tuples of ascending integers (any length, repetitions allowed). What is the best way to do this? Do I use Family()? I'd like to use this set enumerate the basis of a combinatorial free algebra.

Bonus question: Is it possible to add an extra label to each integer in the tuple?

2013-12-06 01:11:53 -0500 answered a question A Sage implementation of the Virasoro algebra and its representations

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.

2013-12-05 11:31:19 -0500 asked a question 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.

2013-12-02 07:26:26 -0500 received badge  Popular Question (source)
2013-11-10 06:43:28 -0500 received badge  Popular Question (source)
2013-04-22 20:57:17 -0500 received badge  Scholar (source)
2013-04-22 20:57:17 -0500 marked best answer Compiling sage on opensuse 12.3

Do you have gcc installed in your system?

2013-04-22 20:57:09 -0500 commented answer Compiling sage on opensuse 12.3

Yes that was the problem. Can't believe I didn't notice that sooner. Anyway, thank you very much!

2013-04-21 20:05:50 -0500 asked a question Compiling sage on opensuse 12.3

Dear Sage support group,

I am trying to compile sage 5.8 on my newly installed opensuse 12.3. However, the install fails after checking my "build system type".

I've copy pasted the error message below. Any help would be greatly appreciated.

Best, Simon

***********************************************
make[1]: Entering directory `/home/gonneman/Downloads/sage-5.8/spkg'
make base
make[2]: Entering directory `/home/gonneman/Downloads/sage-5.8/spkg'
/home/gonneman/Downloads/sage-5.8/spkg/pipestatus "base/prereq-1.1-install 2>&1" "tee -a /home/gonneman/Downloads/sage-5.8/spkg/logs/prereq-1.1.log"
Starting prerequisite check.
Machine: Linux loki.site 3.7.10-1.1-desktop #1 SMP PREEMPT Thu Feb 28 15:06:29 UTC 2013 (82d3f21) x86_64 x86_64 x86_64 GNU/Linux
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized
configure: error: /bin/sh ./config.sub x86_64-unknown-linux- failed
You do not have all of the prerequisites needed to build Sage
from source. See the errors above.
If you would like to try the build anyway (to help porting)
export the variable 'SAGE_PORT' to something non-empty.
make[2]: *** [installed/prereq-1.1] Error 1
make[2]: Leaving directory `/home/gonneman/Downloads/sage-5.8/spkg'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/gonneman/Downloads/sage-5.8/spkg'
2011-08-09 19:32:01 -0500 received badge  Editor (source)
2011-08-09 00:13:10 -0500 received badge  Nice Question (source)
2011-08-08 18:14:18 -0500 commented answer Infinite dimensional Lie algebras in Sage

Thanks a lot for the help Niles and Benjaminfjones. Now I know where to start!

2011-08-08 18:13:06 -0500 received badge  Supporter (source)
2011-08-08 01:42:00 -0500 received badge  Student (source)
2011-08-08 00:32:34 -0500 asked a question Infinite dimensional Lie algebras in Sage

Dear Sage community,

I'm considering giving Sage a spin. Having the scripting possibilities that python offers at one's disposal seems very appealing.

But I would first like to know if - short of writing the module I need in python - Sage is currently capable of addressing the kind of problems I am interested in. I mainly work with infinite dimensional Lie algebras such as the Virasoro algebra. Is there an easy way to implement such algebras in Sage, by specifying structure constants or something like that?