Crystal Demo
system:sage


<h2>Crystal of letters</h2>
<p><span id="cell_outer_0">
<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>
</span></p>
<p>We can create the crystal for the vector representation for all classical types.</p>

{{{id=1|
C = CrystalOfLetters(['A',2])
C.list()
///
[1, 2, 3]
}}}

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

{{{id=5|
C = CrystalOfLetters(['D',4])
view(C, pdflatex=True, tightpage=True)
///
<html><img src="cell://sage0.png"></html>
}}}

<h2>Crystals in terms of Kashiwara-Nakashima tableaux</h2>

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

{{{id=8|
b = B.an_element(); b
///
[[1, 1], [2]]
}}}

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

{{{id=10|
b.weight()
///
(2, 1, 0)
}}}

{{{id=11|
b.phi(2)
///
1
}}}

<h2>Tensor products of crystals</h2>
<p>Sage uses the anti-Kashiwara convention for tensor products.</p>

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

<h2>Spin crystals</h2>

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

<h2>Lusztig involution</h2>
<p>The Lusztig involution on a finite-dimensional highest weight crystal <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/6da0a4aab0b7c4109e88b383815a0f19bce1ca0e.png" alt="B(\lambda)" /> of highest weight <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/ce4588fd900d02afcbd260bc07f54cce49a7dc4a.png" alt="\lambda" /> maps the highest weight vector to the lowest weight vector and the Kashiwara operator <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/61c594c97b61f72af93af4e61894b3f16a3bbb30.png" alt="f_i" /> to <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/9291384e036023bb0d4d071a154443aec54cdf20.png" alt="e_{i^*}" />, where <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/7d7bc59093f2310a341b7f78ba2105f9ba047c5f.png" alt="i^*" /> is defined as <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/feb66cca560f873f92c3d34c01ac9df131569463.png" alt="\alpha_{i^*} = -w_0(\alpha_i)" />. Here <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/eb37b8f84b267a3318413dcd963c9a5872051634.png" alt="w_0" /> is the longest element of the Weyl group acting on the <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/34857b3ba74ce5cd8607f3ebd23e9015908ada71.png" alt="i" />-th simple root <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/7e46fc708bb0d019ec0b54d24b166024d6c146ff.png" alt="\alpha_i" />. For example, for type <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/1eccfbd65334353f671fb71c27b9b9f2c689b0bf.png" alt="A_n" /> we have <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/d5a646f8bc0848755d87ffee8ec7499304834496.png" alt="i^*=n+1-i" />, whereas for type <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/4e173907ca992482385a50c6f62ede920362b1bf.png" alt="C_n" /> we have <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/88718aca8beec57872da96897e6622cdcecdb4a1.png" alt="i^*=i" />. For type <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/2eacbcb991af87d495f8689ac0e952b51317dbaa.png" alt="D_n" /> and <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/174fadd07fd54c9afe288e96558c92e0c1da733a.png" alt="n" /> even also have <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/88718aca8beec57872da96897e6622cdcecdb4a1.png" alt="i^*=i" />, but for <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/174fadd07fd54c9afe288e96558c92e0c1da733a.png" alt="n" /> odd this map interchanges nodes <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/4bdca93962a2beaffc172ca394e04fe05bd74ffd.png" alt="n-1" /> and <img src="http://www.sagemath.org/doc/thematic_tutorials/_images/math/174fadd07fd54c9afe288e96558c92e0c1da733a.png" alt="n" />. Here is how to achieve this in Sage:</p>

{{{id=15|
B = CrystalOfTableaux(['A',2],shape=[2,1])
b = B(rows=[[1,2],[2]])
b.lusztig_involution()
///
[[2, 2], [3]]
}}}

{{{id=17|
view(B)
///
<html><img src="cell://sage0.png"></html>
}}}

<h2>Kirillov-Reshetikhin crystals</h2>

{{{id=18|
K = KirillovReshetikhinCrystal(['B',2,1],1,1)
view(K)
///
<html><img src="cell://sage0.png"></html>
}}}

<h2>Littelmann path model</h2>

{{{id=38|
C = CrystalOfLSPaths(['A',2],[1,1])
view(C, pdflatex=True, tightpage=True)
///
<html><img src="cell://sage0.png"></html>
}}}

{{{id=39|
B = CrystalOfTableaux(['A',2],shape=[2,1])
B.digraph().is_isomorphic(C.digraph())
///
True
}}}

<p>Now we consider a bigger crystal and view the individual Littelmann paths:</p>

{{{id=20|
C = CrystalOfLSPaths(['A',2],[6,3])
///
}}}

{{{id=35|
def line_of_path(path):
    if path is None:
        result = []
    else:
        L = path.parent().weight.parent()
        v = vector(L.zero())
        result = [v]
        for d in path.value:
            v = v + vector(d)
            result.append(v)
        result = list(result)
    print result
    result = line(result)
    result.set_axes_range(-10,10,-10,10)
    return result
///
}}}

{{{id=37|
@interact
def string(element = slider(0, C.cardinality(),1), i=C.index_set(), l=slider(-10, 10, 1,0)):
    x = C[element]
    if l>=0:
        y = x.f_string([i]*l)
    else:
        y = x.e_string([i]*-l)
    line_of_path(y).show()
///
<html><!--notruncate--><div padding=6 id="div-interact-37"> <table width=800px height=20px bgcolor="#c5c5c5"
                 cellpadding=15><tr><td bgcolor="#f9f9f9" valign=top align=left><table>
<tr><td colspan=3><table><tr><td align=right><font color="black">element&nbsp;</font></td><td><table><tr><td>
        <div id="slider-element-37" style="margin:0px; margin-left: 1.0em; margin-right: 1.0em; width: 15.0em;"></div>
        </td><td><font color="black" id="slider-element-37-lbl"></font></td></tr></table><script>(function(){ var values = ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136","137","138","139","140","141","142","143","144","145","146","147","148","149","150","151","152","153","154"]; setTimeout(function() {
    $('#slider-element-37').slider({
        step: 1, min: 0, max: 154, value: 0,
        change: function (e,ui) { var position = ui.value; if(values!=null) $('#slider-element-37-lbl').text(values[position]); interact(37, '_interact_.update(\'37\', \'element\', 4, _interact_.standard_b64decode(\''+encode64(position)+'\'), globals()); _interact_.recompute(\'37\');'); },
        slide: function(e,ui) { if(values!=null) $('#slider-element-37-lbl').text(values[ui.value]); }
    });
    if(values != null) $('#slider-element-37-lbl').text(values[$('#slider-element-37').slider('value')]);
    }, 1); })();</script></td>
</tr><tr><td align=right><font color="black">i&nbsp;</font></td><td><table style="border:1px solid #dfdfdf; background-color:#efefef;">
<tr><td><button style="border-style:inset;" value="0" onclick="$('BUTTON', this.parentNode).css('border-style', 'outset'); $(this).css('border-style', 'inset'); interact(37, '_interact_.update(\'37\', \'i\', 5, _interact_.standard_b64decode(\''+encode64(this.value)+'\'), globals()); _interact_.recompute(\'37\');')">1</button>
<button style="border-style:outset;" value="1" onclick="$('BUTTON', this.parentNode).css('border-style', 'outset'); $(this).css('border-style', 'inset'); interact(37, '_interact_.update(\'37\', \'i\', 5, _interact_.standard_b64decode(\''+encode64(this.value)+'\'), globals()); _interact_.recompute(\'37\');')">2</button>
</td></tr></table></td>
</tr><tr><td align=right><font color="black">l&nbsp;</font></td><td><table><tr><td>
        <div id="slider-l-37" style="margin:0px; margin-left: 1.0em; margin-right: 1.0em; width: 15.0em;"></div>
        </td><td><font color="black" id="slider-l-37-lbl"></font></td></tr></table><script>(function(){ var values = ["-10","-9","-8","-7","-6","-5","-4","-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"]; setTimeout(function() {
    $('#slider-l-37').slider({
        step: 1, min: 0, max: 20, value: 10,
        change: function (e,ui) { var position = ui.value; if(values!=null) $('#slider-l-37-lbl').text(values[position]); interact(37, '_interact_.update(\'37\', \'l\', 6, _interact_.standard_b64decode(\''+encode64(position)+'\'), globals()); _interact_.recompute(\'37\');'); },
        slide: function(e,ui) { if(values!=null) $('#slider-l-37-lbl').text(values[ui.value]); }
    });
    if(values != null) $('#slider-l-37-lbl').text(values[$('#slider-l-37').slider('value')]);
    }, 1); })();</script></td>
</tr></table></td></tr>
<tr><td></td><td style='width: 100%;'><div id="cell-interact-37"><?__SAGE__START>
        <table border=0 bgcolor="white" width=100%>
        <tr><td bgcolor="white" align=left valign=top><pre><?__SAGE__TEXT></pre></td></tr>
        <tr><td  align=left valign=top><?__SAGE__HTML></td></tr>
        </table><?__SAGE__END></div></td><td></td></tr>
<tr><td colspan=3></td></tr>
</table></td>
                 </tr></table></div>
                 </html>
}}}

<p>Littelmann paths also works for exceptional types.</p>

{{{id=23|
C = CrystalOfLSPaths(['E',6],[1,0,0,0,0,0])
b = C.module_generators[0]
b
///
(Lambda[1],)
}}}

{{{id=25|
b.f(1)
///
(-Lambda[1] + Lambda[3],)
}}}

<p>Or level zero Littelmann paths:</p>

{{{id=40|
C = CrystalOfLSPaths(['A',2,1],[-1,0,1]); C
///
The crystal of LS paths of type ['A', 2, 1] and weight (-1, 0, 1)
}}}

{{{id=27|
c = C.module_generators[0]; c
///
(-Lambda[0] + Lambda[2],)
}}}

{{{id=42|
c.f(2).f(1)
///
(Lambda[0] - Lambda[1],)
}}}