Skip to content

Latest commit

 

History

History
188 lines (130 loc) · 4.73 KB

2010-12-11-Nikolaus.rst

File metadata and controls

188 lines (130 loc) · 4.73 KB

Nikolaus Conference 2010, Aachen: Sage-Combinat demo

.. MODULEAUTHOR:: Nicolas M. Thiéry <nthiery at users.sf.net>

sage: %hide                           # not tested
sage: pretty_print_default(False)     # not tested

Tableaux and the like

sage: s = Permutation([5,3,2,6,4,8,9,7,1])
sage: s
[5, 3, 2, 6, 4, 8, 9, 7, 1]

sage: (p,q) = s.robinson_schensted()
sage: p.pp()
1  4  7  9
2  6  8
3
5

sage: p.row_stabilizer()
Permutation Group with generators [(), (7,9), (6,8), (4,7), (2,6), (1,4)]

Counting & the like

sage: Partitions(100000).cardinality()
27493510569...

Species:

sage: from sage.combinat.species.library import *
sage: o   = var("o")
sage: BT = CombinatorialSpecies(min=1)
sage: Leaf =  SingletonSpecies()
sage: BT.define(Leaf+(BT*BT))
sage: BT.isotypes([o]*5).list()
[o*(o*(o*(o*o))), o*(o*((o*o)*o)), o*((o*o)*(o*o)), o*((o*(o*o))*o), o*(((o*o)*o)*o), (o*o)*(o*(o*o)), (o*o)*((o*o)*o), (o*(o*o))*(o*o), ((o*o)*o)*(o*o), (o*(o*(o*o)))*o, (o*((o*o)*o))*o, ((o*o)*(o*o))*o, ((o*(o*o))*o)*o, (((o*o)*o)*o)*o]

Words

sage: m = WordMorphism('a->acabb,b->bcacacbb,c->baba')
sage: m.fixed_point('a')
word: acabbbabaacabbbcacacbbbcacacbbbcacacbbac...

Lattice points of polytopes

sage: A = random_matrix(ZZ,6,3,x=7)
sage: L = LatticePolytope(A)
sage: L.plot3d()
Graphics3d Object

sage: L.npoints()  # should be cardinality! # random
28

This example used PALP and J-mol

Graphs up to an isomorphism

sage: show(next(graphs(5, lambda G: G.size() <= 4)))

Symmetric functions

Usual bases:

sage: Sym = SymmetricFunctions(QQ); Sym
Symmetric Functions over Rational Field
sage: Sym.inject_shorthands()
Defining ...

sage: m(( ( h[2,1] * ( 1 + 3 * p[2,1]) ) + s[2](s[3])))
3*m[1, 1, 1] + ...

Macdonald polynomials:

sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
sage: J = Sym.macdonald().J()
sage: P = Sym.macdonald().P()
sage: Q = Sym.macdonald().Q()
sage: J
Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald J basis

sage: P(J[2,2] + 3 * Q[3,1])
(...)*McdP[2, 2] + ...

Root systems

sage: L = RootSystem(['A',2,1]).weight_space()
sage: L.plot(alcove_walk=[0,2,0,1,2,1,2,0,2,1])
Graphics object consisting of 148 graphics primitives

sage: W = WeylGroup(["B", 3])
sage: W.cayley_graph(side = "left").plot3d(color_by_label = True)
Graphics3d Object

GAP at work

sage: W = WeylGroup(["B", 3])
sage: print(W.character_table())  # Thanks GAP!
CT1
...
X.1      1  1  1  1  1  1  1  1  1  1
X.2      1  1  1 -1 -1 -1 -1  1  1 -1
X.3      1  1 -1 -1  1 -1  1  1 -1  1
X.4      1  1 -1  1 -1  1 -1  1 -1 -1
X.5      2  2  .  . -2  .  1 -1  . -2
X.6      2  2  .  .  2  . -1 -1  .  2
X.7      3 -1 -1  1 -1 -1  .  .  1  3
X.8      3 -1  1  1  1 -1  .  . -1 -3
X.9      3 -1  1 -1 -1  1  .  . -1  3
X.10     3 -1 -1 -1  1  1  .  .  1 -3

sage: type(W.character_table())
<class 'sage.interfaces.interface.AsciiArtString'>

sage: G = W.gap(); G
<matrix group of size 48 with 3 generators>

sage: G.Ch      # not tested

sage: T = G.CharacterTable(); T
CharacterTable( <matrix group of size 48 with 3 generators> )

sage: T.Irr()[4,4]
-2

Coxeter3 at work

sage: W3 = CoxeterGroup(["B", 3], implementation="coxeter3")
sage: KL = matrix([ [ W3.kazhdan_lusztig_polynomial(u,v) if u.bruhat_le(v) else 0 for u in W3 ]
....:             for v in W3])
sage: show(KL)

sage: W = WeylGroup(["C", 3, 1])
sage: W
Weyl Group of type ['C', 3, 1] (as a matrix group acting on the root space)

sage: W.from_reduced_word([1,2,3,0,3,0,3,2,1,3,3,2]).stanley_symmetric_function()
256*m[1, 1, 1, 1, 1, 1] + 128*m[2, 1, 1, 1, 1] + 64*m[2, 2, 1, 1] + 32*m[2, 2, 2] + 48*m[3, 1, 1, 1] + 24*m[3, 2, 1] + 8*m[3, 3] + 16*m[4, 1, 1] + 8*m[4, 2] + 4*m[5, 1]

Crystals

sage: K = crystals.KirillovReshetikhin(['A',3,1], 2,2)
sage: G = K.digraph()
sage: G.set_latex_options(format = "dot2tex", edge_labels = True, color_by_label = {0:"black", 1:"blue", 2:"red", 3:"green"}, edge_options=lambda u_v_label:({"backward": u_v_label[2] == 0}))
sage: view(G, viewer="pdf", tightpage=True)