SageDays26
system:sage


<h2>Crystal graphs</h2>
<p>For the drawing command to work you will need to:</p>
<p>- install graphviz</p>
<p>- install dot2tex via: sage -f http://sage.math.washington.edu/home/nthiery/dot2tex-2.8.7-2.spkg</p>
<p>- enter this in the notebook or in your ./sage/init.sage file:</p>
<p>&nbsp; from sage.misc.latex import latex<br />&nbsp; latex.add_to_preamble('\\usepackage{tikz}')<br />&nbsp; latex.add_to_jsmath_avoid_list('\\begin{tikzpicture}')</p>

{{{id=83|
B = CrystalOfTableaux(['A',2], shape=[2,1])
view(B, pdflatex = True)
///
<html><img src="cell://sage0.png"></html>
}}}

{{{id=84|
b = B(rows=[[1,3],[3]])
b.weight()
///
(1, 0, 2)
}}}

{{{id=85|
b.f(1)
///
[[2, 3], [3]]
}}}

{{{id=86|
b.e(2)
///
[[1, 3], [2]]
}}}

{{{id=93|
b.epsilon(2)
///
2
}}}

{{{id=94|
b.phi(2)
///
0
}}}

{{{id=87|
b.s(2)
///
[[1, 2], [2]]
}}}

<h2>Semistandard tableaux and charge</h2>

{{{id=1|
T = SemistandardTableaux(mu=[2,1,1])
T.list()
///
[[[1, 1, 2, 3]], [[1, 1, 2], [3]], [[1, 1, 3], [2]], [[1, 1], [2, 3]], [[1, 1], [2], [3]]]
}}}

{{{id=2|
for t in T:
    t.pp()
    print "charge: ", t.charge()
    print ""
///
  1  1  2  3
charge:  3

  1  1  2
  3
charge:  2

  1  1  3
  2
charge:  1

  1  1
  2  3
charge:  1

  1  1
  2
  3
charge:  0
}}}

<p>The following does not yet work and is on the wishlist (see below):</p>

{{{id=109|
show(Tableau([[1,2,2],[2,3]]))
///
<html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
\raisebox{-.6ex}{$\begin{array}[b]{ccc}
\cline{1-1}\cline{2-2}\cline{3-3}
\lr{1}&\lr{2}&\lr{2}\\
\cline{1-1}\cline{2-2}\cline{3-3}
\lr{2}&\lr{3}\\
\cline{1-1}\cline{2-2}
\end{array}$}
}</div></html>
}}}

{{{id=108|
%latex
\sage{Tableau([[1,2,2],[2,3]])}
///
}}}

<p><strong>Wishlist: </strong>cyclage graph in Sage!!</p>
<p><strong>Wishlist: </strong>LaTeX support for tableaux, compatible with jsmath/mathjax for visualization in the notebook, see trac#4355.</p>
<p>&nbsp;</p>
<h2>Kostka-Foulkes polynomials</h2>

{{{id=4|
la = [3,2,1]
mu = [2,2,1,1]
T = SemistandardTableaux(p=la,mu=mu); T.list()
///
[[[1, 1, 2], [2, 3], [4]], [[1, 1, 2], [2, 4], [3]], [[1, 1, 3], [2, 2], [4]], [[1, 1, 4], [2, 2], [3]]]
}}}

{{{id=5|
t = PolynomialRing(QQ,'t').gen()
sum( t^(b.charge()) for b in T )
///
t^3 + 2*t^2 + t
}}}

{{{id=46|
KostkaFoulkesPolynomial(la,mu)
///
t^3 + 2*t^2 + t
}}}

{{{id=10|
HL = HallLittlewoodP(QQ)
s = SFASchur(HL.base_ring())
expansion = HL(s(la)); expansion
///
(t^11+2*t^10+2*t^9+3*t^8+3*t^7+2*t^6+2*t^5+t^4)*P[1, 1, 1, 1, 1, 1] + (t^6+2*t^5+2*t^4+2*t^3+t^2)*P[2, 1, 1, 1, 1] + (t^3+2*t^2+t)*P[2, 2, 1, 1] + (t^2+t)*P[2, 2, 2] + (t^2+t)*P[3, 1, 1, 1] + P[3, 2, 1]
}}}

{{{id=11|
expansion.coefficient(mu)
///
t^3 + 2*t^2 + t
}}}

<h2>Charge from the geometry of classical crystals</h2>
<p>see <a href="http://www.ams.org/mathscinet/search/publications.html?pg1=IID&amp;s1=110435">Lascoux, </a><a href="http://www.ams.org/mathscinet/search/publications.html?pg1=IID&amp;s1=327337">Leclerc, </a><a href="http://www.ams.org/mathscinet/search/publications.html?pg1=IID&amp;s1=172040">Thibon </a><span>Crystal graphs and <span style="display: none;">$q$</span>q-analogues of weight multiplicities for the root  system,<span><span id="MathJax-Span-7"></span></span></span><a href="http://www.ams.org/mathscinet/search/journaldoc.html?cn=Lett_Math_Phys"><em>Lett. Math. Phys.</em></a> <a href="http://www.ams.org/mathscinet/search/publications.html?pg1=ISSI&amp;s1=144284"> 35 </a><a href="http://www.ams.org/mathscinet/search/publications.html?pg1=ISSI&amp;s1=144284"> (1995), </a><a href="http://www.ams.org/mathscinet/search/publications.html?pg1=ISSI&amp;s1=144284"> no. 4,</a> 359&ndash;374.</p>

{{{id=12|
n = len(mu)-1
B = CrystalOfTableaux(['A',n], shape=la)
b = B(rows=[[1,1,2],[2,4],[3]]); b
///
[[1, 1, 2], [2, 4], [3]]
}}}

{{{id=17|
b = B(rows=[[1,1,2],[2,4],[3]]); b
///
[[1, 1, 2], [2, 4], [3]]
}}}

{{{id=19|
b.e(3)
///
[[1, 1, 2], [2, 3], [3]]
}}}

{{{id=20|
b.s(2)
///
[[1, 1, 3], [2, 4], [3]]
}}}

<p>We calculate the orbit of an element in the crystal under the group generated by the reflections along i-strings in the crystal</p>

{{{id=23|
C = TransitiveIdeal(lambda x: [ x.s(i) for i in x.index_set() ] , [b])
list(C)
///
[[[1, 1, 2], [2, 4], [3]], [[1, 1, 3], [2, 4], [3]], [[1, 2, 3], [2, 4], [3]], [[1, 1, 3], [2, 4], [4]], [[1, 2, 3], [2, 4], [4]], [[1, 3, 3], [2, 4], [4]]]
}}}

<p>We calculate the shortest distance to the end of a string</p>

{{{id=25|
def length_to_end_of_string(x,i):
    return min(x.phi(i), x.epsilon(i))
///
}}}

<p>Analogue of the major index in terms of the distance to end of string in crystal</p>

{{{id=27|
def element_statistic(x):
    return sum(i*length_to_end_of_string(x,i) for i in x.index_set())
///
}}}

{{{id=28|
element_statistic(b)
///
4
}}}

<p>The real statistic is given by the average over the orbit of an element of the above statistic</p>

{{{id=29|
def orbit_statistic(x):
    orbit = list(TransitiveIdeal(lambda y: [ y.s(i) for i in y.index_set() ] , [x]))
    return 1/len(orbit) * sum(element_statistic(y) for y in orbit)
///
}}}

{{{id=30|
orbit_statistic(b)
///
2
}}}

<p>We collect all elements in the crystal of weight mu</p>

{{{id=36|
Bmu = [x for x in B if [i[1] for i in x.weight()]==mu]
///
}}}

{{{id=32|
sum(t^orbit_statistic(x) for x in Bmu)
///
t^3 + 2*t^2 + t
}}}

<p>The charge and orbit statistic only agree after the application of the Schuetzenberger involution \Omega_2</p>

{{{id=33|
for x in Bmu:
    x.pp()
    print "orbit and tableaux charge ", orbit_statistic(x), x.to_tableau().charge()
    print " "
///
  1  1  4
  2  2
  3
orbit and tableaux charge  3 1
 
  1  1  2
  2  4
  3
orbit and tableaux charge  2 2
 
  1  1  3
  2  2
  4
orbit and tableaux charge  2 2
 
  1  1  2
  2  3
  4
orbit and tableaux charge  1 3
 
}}}

<p><strong>Wishlist: </strong>implementation of the Schuetzenberger involution Omega_2 on tableaux and words</p>
<h2>Energy function of affine crystals</h2>
<p>M. Okado. A. Schilling, M. Shimozono<strong>&nbsp; A tensor product theorem related to perfect crystals </strong> <br /><a href="http://www.sciencedirect.com/science/journal/00218693">J. Algebra</a> <strong>267</strong> (2003) 212-245    ( <a href="http://xxx.lanl.gov/abs/math.QA/0111288"> math.QA/0111288 </a>)</p>
<p>A. Schilling, P. Tingley, <strong>Demazure crystals and energy functions, </strong>preprint</p>

{{{id=66|
print n, la, mu
///
3 [3, 2, 1] [2, 2, 1, 1]
}}}

{{{id=48|
def K(n,k):
    return KirillovReshetikhinCrystal(['A',n,1],k,1)
///
}}}

{{{id=95|
view(K(2,1), pdflatex = True)
///
<html><img src="cell://sage0.png"></html>
}}}

{{{id=96|
view(K(3,2), pdflatex = True)
///
<html><img src="cell://sage0.png"></html>
}}}

{{{id=49|
KR = [ K(n,i) for i in mu ]
T = TensorProductOfCrystals(*KR)
///
}}}

{{{id=65|
def vacuum(T):
    K = T.crystals
    l = len(K)
    vac = [ K[l-1].module_generator() ]
    for i in range(l-1):
        vac = [b for b in K[l-2-i] if b.Epsilon() == vac[0].Phi()] + vac
    return vac
///
}}}

{{{id=67|
vacuum(T)
///
[[[1], [2]], [[3], [4]], [[2]], [[1]]]
}}}

{{{id=50|
@cached_function
def string_rep(T, u=None):
    r"""
    Calculates the string representation for all elements in 
    `T = K(n,k_1) \otimes \cdots \otimes K(n,k_l)`:

    The output is a dictionary which gives for every `x\in T` the shortest
    path in `f_i` from `u = u_1 \otimes \cdots \otimes u_l` to `x`.
    By default, `u` is the vacuum of T.
    """
    index_set = T.index_set()
    import copy
    if u is None:
        u = vacuum(T)
    string = { T(*u) : [] }
    known = set( string.keys() )
    todo = copy.copy(known)
    # Invariants:
    # - known contains all elements x for which we know string(x)
    # - todo  contains all elements x for which we haven't propagated to each child
    while todo <> set( [] ):
        x = todo.pop()
        for i in index_set:
            eix  = x.f(i)
            if (eix is not None and eix not in known):
                todo.add(eix)
                known.add(eix)
                string[eix] = string[x] + [i]
    return string.__getitem__
///
}}}

{{{id=51|
def energy(x):
    r"""
    Calculates the energy function of `x` which is a tensor
    product of elements in `K(n,k)`. If 
    `x \in K(n,k_1) \otimes \cdots \otimes K(n,k_l)`, then the
    energy is defined as the number of `f_0` in the shortest path
    from `u_1 \otimes \cdots \otimes u_l` to `x`.
    """
    g = string_rep(x.parent())
    return g(x).count(0)
///
}}}

{{{id=55|
Lambda = T.weight_lattice_realization().fundamental_weights()
Lambda
///
Finite family {0: Lambda[0], 1: Lambda[1], 2: Lambda[2], 3: Lambda[3]}
}}}

{{{id=71|
def to_weight(la,La):
    weight = sum(La[i] for i in la)
    return weight - weight.level()*La[0]
///
}}}

{{{id=72|
to_weight(la,Lambda)
///
-3*Lambda[0] + Lambda[1] + Lambda[2] + Lambda[3]
}}}

{{{id=57|
I = T.index_set()
I.remove(0)
S = [ t for t in T if all(t.epsilon(i) == 0 for i in I) ]
S = [ t for t in S if t.weight()== to_weight(la,Lambda)]
///
}}}

{{{id=58|
len(S)
///
4
}}}

{{{id=59|
S
///
[[[[1], [2]], [[1], [3]], [[2]], [[1]]], [[[1], [2]], [[2], [3]], [[1]], [[1]]], [[[1], [3]], [[1], [2]], [[2]], [[1]]], [[[2], [3]], [[1], [2]], [[1]], [[1]]]]
}}}

{{{id=62|
g=string_rep(T)
///
}}}

{{{id=63|
[g(x) for x in S]
///
[[2, 3, 1, 0, 0], [2, 3, 0, 1, 2, 3, 1, 0, 0], [2, 3, 1, 0, 2, 3, 1, 0, 0], [2, 3, 0, 1, 1, 0, 2, 3, 2, 3, 1, 0, 0]]
}}}

<p>This is again the Kostka-Foulkes polynomial up to an overall factor</p>

{{{id=60|
t = PolynomialRing(QQ,'t').gen()
sum(t^energy(x) for x in S)
///
t^4 + 2*t^3 + t^2
}}}

{{{id=61|
KostkaFoulkesPolynomial(la,mu)
///
t^3 + 2*t^2 + t
}}}

<p><strong>Wishlist: </strong>faster implementation of the energy function (possibly in terms of the R-matrix)</p>

<h2>k-Schur functions</h2>
<p>These functions will be introduced in Sara Billey's talk!</p>

{{{id=97|
ks3 = kSchurFunctions(QQ, 3); ks3
///
k-Schur Functions at level 3 over Univariate Polynomial Ring in t over Rational Field
}}}

{{{id=99|
s = SFASchur(ks3.base_ring())
///
}}}

{{{id=100|
s(ks3[3,2,1,1])
///
s[3, 2, 1, 1] + t*s[3, 3, 1] + t*s[4, 1, 1, 1] + (t^2+t)*s[4, 2, 1] + t^2*s[4, 3] + (t^3+t^2)*s[5, 1, 1] + t^3*s[5, 2] + t^4*s[6, 1]
}}}

<h2>Affine Stanley symmetric functions</h2>
<p>implemented with Steve Pon and Nicolas Thiery</p>
<p>These functions are dual to the k-Schur functions</p>

{{{id=101|
W = WeylGroup(['A', 3, 1])
w = W.from_reduced_word([3,1,2,0,3,1,0])
w
///
[-1  0  2  0]
[-2  1  2  0]
[-2  1  1  1]
[-2  0  2  1]
}}}

{{{id=103|
w.stanley_symmetric_function()
///
8*m[1, 1, 1, 1, 1, 1, 1] + 4*m[2, 1, 1, 1, 1, 1] + 2*m[2, 2, 1, 1, 1] + m[2, 2, 2, 1]
}}}

{{{id=104|
W = WeylGroup(['C',3,1])
W.from_reduced_word([0,2,1,0]).stanley_symmetric_function()
///
32*m[1, 1, 1, 1] + 16*m[2, 1, 1] + 8*m[2, 2] + 4*m[3, 1]
}}}

<p><strong>Wishlist:&nbsp; </strong>make the k-Schur function and their duals live in the right subspace/quotient of the ring of symmetric functions.</p>

{{{id=105|

///
}}}

{{{id=107|

///
}}}