[1]:
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))

import sympy as sp
import numpy as np
import itertools as it
import pysymmpol as sy
import pysymmpol.utils as ut
from IPython.display import display, Latex

Class: YoungDiagram

There are two modules describing the creation and manipulation of young diagrams, this and the next one. We basically have two notations for these objects, and we treat them differently.

  1. The first is the usual definition in a partition form, with the usual notation \(\lambda = (\lambda_1, \lambda_2, \dots, \lambda_N)\) with \(\lambda_{i+1} \leq \lambda_i\) for any \(i \in [1, N-1]\).

  2. We also define Young diagrams in the conjugacy class notation, where \(\lambda = (1^{k_1} 2^{k_2}\cdots)\).

In the subsections below, we describe how to initialize and work with these classes.

We initialize the Young diagrams with the class YoungDiagram(partition: tuple). The partition must be tuple in the standard monotonic decreasing form, otherwise it will raise a ‘NonStandardError’. Of course, the user can remove this error with some simple list methods to reorder the list, but I do not recommend this approach because this error might be useful when we use this to study symmetric polynomials. Moreover, we should pass a tuple as argument since it is imutable and we do not want the user doing silly things, such as bringing the partition to a nonstandard form after the initialization.

[18]:
# Let us create some Young diagrams to use as examples in the text.
lambda1 = sy.YoungDiagram((10, 9, 8, 7, 5, 4, 2, 1))
lambda2 = sy.YoungDiagram((5, 5, 4, 3))
lambda3 = sy.YoungDiagram((3, 3, 2))
[19]:
lambda1
[19]:
YoungDiagram(_partition=(10, 9, 8, 7, 5, 4, 2, 1))

Properties

Diagram

The graphical representation can be obtained from the getter .diagram

[20]:
lambda1.draw_diagram(2) # It accepts  4 arguments: 0 (default), 1, 2, 3
🎲
🎲 🎲
🎲 🎲 🎲 🎲
🎲 🎲 🎲 🎲 🎲
🎲 🎲 🎲 🎲 🎲 🎲 🎲
🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲
🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲
🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲

Getters

The Young diagrams the following getters: 1) partition 2) rows 3) columns 4) boxes

[21]:
lambda1.partition # returns the partition as a list or a tuple.
[21]:
(10, 9, 8, 7, 5, 4, 2, 1)
[12]:
lambda2.rows # returns the number of rows
[12]:
4
[13]:
lambda3.columns # returns the number of columns
[13]:
3
[22]:
lambda1.boxes # returns the number of boxes
[22]:
46

Methods

Count diagonal

This method counts the number of boxes in the diagonal of the Young diagram

[23]:
lambda1.count_diagonal() # Retturns the number of boxes in the diagonal
[23]:
5

Frobenius Coordinates

From these methods and properties, we have also find the Frobenius coordinates for a given partition.

[24]:
lambda1.frobenius_coordinates()
[24]:
[[19/2, -15/2], [15/2, -11/2], [11/2, -7/2], [7/2, -5/2], [1/2, -1/2]]
[25]:
lambda2.frobenius_coordinates()
[25]:
[[9/2, -7/2], [7/2, -5/2], [3/2, -3/2]]
[26]:
lambda3.frobenius_coordinates()
[26]:
[[5/2, -5/2], [3/2, -3/2]]

Transposed Young Diagram

The method transpose, as the name suggests,returns the transposed (or conjugate) Young diagram as a new object.

[27]:
lambda1_T = lambda1.transpose()
[28]:
lambda1_T.partition
[28]:
(8, 7, 6, 6, 5, 4, 4, 3, 2, 1)
[31]:
# And all the getters are also available for the conjugate diagram
lambda1_T.rows
[31]:
10

Conjugacy Partition

It is also useful to represent the partitions in terms of its cycles conjugacy class. For example, we know that: \(\lambda_1 = (4, 3, 2) = (2^1 3^1 2^1)\) and \(\mu_1 = (5, 5, 4, 3, 3, 3, 2, 2, 1, 1) = (1^2 2^2 3^3 4^1 5^2)\).

We can get these representations from the method .conjugacy_partition. For a generic partition \(\lambda = (\lambda_1, \lambda_2, \dots, \lambda_N)\) we have \(\lambda = (1^{k_1} 2^{k_2}\cdots)\). In order to avoid confusion with the partition notation, this method returns a dictinary \((1: k_1, 2: k_2, 3: k_3, \dots)\). In our examples, we have \(\lambda_1 = \{1: 0, 2: 1, 3: 1, 4: 1\}\) and \(\mu_1 = \{1: 2, 2: 2, 3: 3, 4: 1, 5: 2\}\).

[33]:
lambda1.conjugacy_partition()
[33]:
{1: 1, 2: 1, 3: 0, 4: 1, 5: 1, 6: 0, 7: 1, 8: 1, 9: 1, 10: 1}
[34]:
lambda2.conjugacy_partition()
[34]:
{1: 0, 2: 0, 3: 1, 4: 1, 5: 2}

Contains and Interlaces

Finally, given two Young diagrams, say \(\lambda\) and \(\mu\), the contains and interlaces methods, lambda.contains(mu) and lambda.interlaces(mu), checks if the partition lambda contains and interlaced the partition mu, respectivelly.

[35]:
lambda1.draw_diagram(0)
■
■ ■
■ ■ ■ ■
■ ■ ■ ■ ■
■ ■ ■ ■ ■ ■ ■
■ ■ ■ ■ ■ ■ ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■
[36]:
lambda2.draw_diagram(1)
• • •
• • • •
• • • • •
• • • • •
[37]:
lambda1.contains(lambda2) # partition lambda1 contains lambda2
[37]:
True
[38]:
lambda2.interlaces(lambda1) # partition lambda2 interlaces lambda1
[38]:
False