Ask Your Question

RegularUser's profile - activity

2018-09-17 08:09:37 -0500 answered a question What is a 'CoxeterGroup'?

Okay, here are the minimal steps that you need to take (for a complete working example, see here):

Create a class representing the group

This class should look as follows:

class MyCoxeterGroup(UniqueRepresentation, FinitelyGeneratedMatrixGroup_generic):
    Element = MyCoxeterGroupElement
    def index_set(self):
        ...
    def simple_reflection(self, i):
        ...
    def is_finite(self):
        ...
    def __repr__(self):
        ...
    def __contains__(self, x):
        ...
    def coxeter_matrix(self):
        ...

The requirements on the semantics of these methods are implicit, but can be gathered quite easily from the source file of sage.categories.coxeter_groups and other related ones. Subclassing from FinitelyGeneratedMatrixGroup_generic isn't strictly necessary, but if your Coxeter group has anything to do with matrices, you probably want to subclass from it.

Subclassing from UniqueRepresentation is necessary, at least if you plan on building the corresponding Iwahori-Hecke algebra over it. The reason for this is that if you don't subclass from UniqueRepresentation, the object returned by

CombinatorialFreeModule(ZZ, W).basis().keys()

(given that W is an instance of MyCoxeterGroup) will not be an instance of MyCoxeterGroup. For this reason, also the following command will fail

IwahoriHeckeAlgebra(W, 0, 0, ZZ).T().algebra_generators()

I don't exactly know how subclassing from UniqueRepresentation fixes that problem, but it seems to have to do with the magic that Sage uses when dynamically creating classes.

Create a class representing elements of the group

This should look like this:

class MyCoxeterGroupElement(MatrixGroupElement_generic):
    def __eq__(self, other):
        ...
    def __mul__(self, other):
        ...
    def has_left_descent(self, i):
        ...

I won't go into all details here, but __eq__ should be the equality test for elements of your group, __mul__ should at least implement multiplication of two instances of type MyCoxeterGroupElement, and has_left_descent should for a given index i (which should be one of the elements returned by MyCoxeterGroup.index_set) returned a boolean (!) specifying whether the simple reflection corresponding to i lies in the left descent set of the element in question (self). In other words, has_left_descent(self, i) should evaluate to True iff l(s_i w) < l(w).

Note that it's really important that has_left_descent returns a boolean and not a more general truth object, as the default implementation of has_descent will make a test of the form

`has_left_descent(i) != False`

which can evaluate to True even if has_left_descent(i) is a truth object representing falsehood.

2018-09-07 08:33:59 -0500 commented answer What is a 'CoxeterGroup'?

This does not seem to answer my question.

2018-09-06 05:27:53 -0500 asked a question What is a 'CoxeterGroup'?

Hi, I'm trying to implement a certain Coxeter group in Sage, for the purpose of building the corresponding Iwahori-Hecke algebra over it using sage.algebras.iwahori_hecke_algebra.IwahoriHeckeAlgebra. In the documentation of the constructor of this class, it says that it takes a "Coxeter group" as an argument. However, Coxeter groups as generated by sage.combinat.root_system.coxeter_group.CoxeterGroup aren't actually instances of a common superclass.

Afaict, the methods of IwahoriHeckeAlgebra simply implicitly assume the existence of certain instance methods (like W.is_finite or W.from_reduced_word), probably also with some implicitly assumed semantics of said methods. So, my question is whether the behaviour of being a "Coxeter group" are actually anywhere formally documented, or whether I'm stuck piecing together the required methods & semantics through trial and error.

2018-06-13 11:59:54 -0500 commented answer PARI stack overflows

Would computing the kernel of an integer matrix of size about 2000x2000 be "heavy"?

2018-06-12 11:38:18 -0500 asked a question PARI stack overflows

Trying to determine the kernel of a map between free ZZ-modules of finite rank, I get the following error

  File "/home/ubuntu/SageMath/local/lib/python2.7/site-packages/sage/modules/matrix_morphism.py", line 720, in kernel
    V = self.matrix().kernel()
  File "sage/matrix/matrix2.pyx", line 4337, in sage.matrix.matrix2.Matrix.left_kernel (build/cythonized/sage/matrix/matrix2.c:32211)
  File "sage/matrix/matrix2.pyx", line 4178, in sage.matrix.matrix2.Matrix.right_kernel (build/cythonized/sage/matrix/matrix2.c:31652)
  File "sage/matrix/matrix2.pyx", line 3782, in sage.matrix.matrix2.Matrix.right_kernel_matrix (build/cythonized/sage/matrix/matrix2.c:30166)
  File "sage/matrix/matrix_integer_dense.pyx", line 2558, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._right_kernel_matrix (build/cythonized/sage/matrix/matrix_integer_dense.c:22234)
  File "cypari2/gen.pyx", line 4483, in cypari2.gen.Gen.matkerint
  File "cypari2/handle_error.pyx", line 196, in cypari2.handle_error._pari_err_handle
cypari2.handle_error.PariError: the PARI stack overflows (current size: 259719168; maximum size: 259719168)
You can use pari.allocatemem() to change the stack size and try again

How do I adjust the maximum PARI stack size from within Sage?

Edit: Strangely, whether this problem occurs does not only depend on the total memory used. In one case, the computation used up to 14 GB and ran just fine, in another case this error occured when only 8 GB had been used.

2018-06-12 09:14:06 -0500 received badge  Editor (source)
2018-06-12 09:13:50 -0500 asked a question Running several commands from command line

You can make Sage evaluate a given Python expression by running sage -c <your-command> from command line. However, it seems that the -c parameter can only be given once. How do I make sage evaluate several commands in succession then?

2018-05-24 11:47:26 -0500 commented answer free module changes dimensions after base change

The map that I want to base change is not multiplication by two. In fact, trying to base change the map in question throws an exception, precisely because the dimension of the codomain changes.

2018-05-23 09:46:42 -0500 received badge  Scholar (source)
2018-05-23 09:07:45 -0500 commented answer free module changes dimensions after base change

I have a homomorphism between two free modules and what to base change it to a finite field.

2018-05-21 18:16:13 -0500 received badge  Supporter (source)
2018-05-21 18:15:27 -0500 commented answer free module changes dimensions after base change

So, change_ring applies to the ambient module and not the module itself? That's messed up! Is there a way to base change the module itself then?

2018-05-21 16:30:25 -0500 received badge  Student (source)
2018-05-21 15:46:30 -0500 asked a question free module changes dimensions after base change

Hi, I have a free module of rank 1 over the integers

sage: M

Free module of degree 1 and rank 1 over Integer Ring
Echelon basis matrix:
[2]

However, when I base change it to the field with two elements, it changes dimension!

sage: M.change_ring(GF(2))

Vector space of degree 1 and dimension 0 over Finite Field of size 2
Basis matrix:
[]

What's going on?

P.S.: What does Sage mean by "degree"?

2018-05-21 15:46:30 -0500 asked a question free module changes dimensions after base change

Hi, I have a free module of rank 1 over the integers

sage: M

Free module of degree 1 and rank 1 over Integer Ring
Echelon basis matrix:
[2]

However, when I base change it to the field with two elements, it changes dimension!

sage: M.change_ring(GF(2))

Vector space of degree 1 and dimension 0 over Finite Field of size 2
Basis matrix:
[]

What's going on?

P.S.: What does Sage mean by "degree"?