Sage and Sage-Combinat demo, Affine Schubert Calculus Workshop, Toronto -- Sage Reference Manual v4.4.4 system:sage
Arithmetic:
Symbolic calculations:
Statistics:
Type plot( and then press the TAB key:
Click on Help at the top of this page
There is also Live Documentation in which you can evaluate the examples.
Introspection:
Looking at the sources:
Let us create the Coxeter group W:
It is constructed as a group of permutations, from root data given by GAP3+Chevie (thanks to Franco’s interface):
with operations on permutations implemented in Sage:
and group operations implemented in GAP:
Now, assume we want to do intensive computations on this group, requiring heavy access to the left and right Cayley graphs (e.g. Bruhat interval calculations, representation theory, ...). Then we can use Jean-Eric Pin’s Semigroupe, a software written in C:
The following triggers the full expansion of the group and its Cayley graph in memory:
And we can now iterate through the elements, in length-lexicographic order w.r.t. their reduced word:
The elements of S are handles to C objects from Semigroupe:
Products are calculated by Semigroupe:
Powering operations are handled by Sage:
Altogether, S is a full fledged Sage Coxeter group, which passes all the generic tests:
And of course it works for general semigroups too, and can further compute much more information about those, like the (Knuth-Bendix completion of the) relations between the generators:
which contains the usual commutation + braid relations.
Let’s try now the 0-Hecke monoid:
Let us throw in more mathematical information:
Here is a function that computes in pure Python:
Let us compare this with the Cython version:
A function to count the number of integer partitions with parts in a given set:
Let’s see how long it takes to find the number of partitions of 500 into odd parts:
Make two changes:
Surely two tiny changes in some Python code can’t make it much faster:
ToDo
Summary:
- Every mathematical object (element, set, category, ...) is modeled by a Python object</li>
- All combinatorial classes share a uniform interface</li>
Summary:
- Basic combinatorial classes + constructions give a flexible toolbox
- This is made possible by uniform interfaces
- Lazy algorithms and data structures for large / infinite sets (iterators, ...)
Integer lists:
Fibonacci words:
Binary trees:
Juggling automaton:
This example used PALP and J-mol
An infinite periodic word:
The Fibonacci word:
The Thue-Morse word:
A random word over the alphabet [0, 1] of length 1000:
The fixed point of a morphism:
Their prefixes of length 1000:
A comparison of their complexity function:
Construction of a permutation and builds its associated Rauzy diagram:
Let us now construct a self-similar interval exchange transformation associated to a loop in the Rauzy diagram:
We can plot it and all its power:
Check the self similarity of T:
And get the symbolic coding of 0 using the substitution associated to the path:
Affine Weyl groups:
Classical basis:
Jack polynomials:
Macdonald polynomials: