{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "ecca1305-b80f-4e29-8f16-23571fdc9cfd", "metadata": {}, "outputs": [], "source": [ "import os \n", "import sys\n", "sys.path.insert(0, os.path.abspath('../..'))\n", "\n", "import sympy as sp\n", "import numpy as np\n", "import itertools as it\n", "import pysymmpol as sy\n", "import pysymmpol.utils as ut\n", "from IPython.display import display, Latex" ] }, { "cell_type": "markdown", "id": "a036c5ed-81ce-4a3c-bf45-6f75435a0c86", "metadata": {}, "source": [ "# Class: YoungDiagram" ] }, { "cell_type": "markdown", "id": "a63408c5-2fc0-47e7-a908-138f5bea510e", "metadata": {}, "source": [ "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. \n", "\n", "1) The first is the usual definition in a partition form, with the usual notation $\\lambda = (\\lambda_1, \\lambda_2, \\dots, \\lambda_N)$\n", "with $\\lambda_{i+1} \\leq \\lambda_i$ for any $i \\in [1, N-1]$.\n", "2) We also define Young diagrams in the conjugacy class notation, where $\\lambda = (1^{k_1} 2^{k_2}\\cdots)$.\n", "\n", "In the subsections below, we describe how to initialize and work with these classes. " ] }, { "cell_type": "markdown", "id": "24643168-1ce6-401f-ba0b-ec55039b8e66", "metadata": { "jp-MarkdownHeadingCollapsed": true }, "source": [ "We initialize the Young diagrams with the class **YoungDiagram(partition: tuple)**. \n", "The partition must be tuple in the standard monotonic decreasing form, otherwise \n", "it will raise a 'NonStandardError'. Of course, the user can remove this error with some simple \n", "list methods to reorder the list, but I do not recommend this approach because this error \n", "might be useful when we use this to study symmetric polynomials. Moreover, we \n", "should pass a tuple as argument since it is imutable and we do not want the user doing silly things, \n", "such as bringing the partition to a nonstandard form after the initialization. " ] }, { "cell_type": "code", "execution_count": 18, "id": "34665534-fd8b-4182-9676-37368a38ddb6", "metadata": {}, "outputs": [], "source": [ "# Let us create some Young diagrams to use as examples in the text.\n", "lambda1 = sy.YoungDiagram((10, 9, 8, 7, 5, 4, 2, 1))\n", "lambda2 = sy.YoungDiagram((5, 5, 4, 3))\n", "lambda3 = sy.YoungDiagram((3, 3, 2))" ] }, { "cell_type": "code", "execution_count": 19, "id": "a81157a8-c866-4785-9d6f-8d46965bd1f4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "YoungDiagram(_partition=(10, 9, 8, 7, 5, 4, 2, 1))" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1" ] }, { "cell_type": "markdown", "id": "212fc5bb-3f4c-4086-a739-4f02a2c93206", "metadata": {}, "source": [ "### Properties" ] }, { "cell_type": "markdown", "id": "ecf76732-bb18-4fec-a8dd-4482493fa2e7", "metadata": {}, "source": [ "#### Diagram" ] }, { "cell_type": "markdown", "id": "50b9ae3f-c3ab-4896-8907-38ab3c70afe0", "metadata": {}, "source": [ "The graphical representation can be obtained from the getter .diagram" ] }, { "cell_type": "code", "execution_count": 20, "id": "f20a9bd7-a61e-4aef-8ce0-5d24c095cad5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "🎲 \n", "🎲 🎲 \n", "🎲 🎲 🎲 🎲 \n", "🎲 🎲 🎲 🎲 🎲 \n", "🎲 🎲 🎲 🎲 🎲 🎲 🎲 \n", "🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 \n", "🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 \n", "🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 🎲 \n" ] } ], "source": [ "lambda1.draw_diagram(2) # It accepts 4 arguments: 0 (default), 1, 2, 3" ] }, { "cell_type": "markdown", "id": "10d4be91-5165-48fa-a04d-6f7a5fe8b195", "metadata": {}, "source": [ "#### Getters" ] }, { "cell_type": "markdown", "id": "6a4eb535-8caa-40b1-8fef-2949ed44daee", "metadata": {}, "source": [ "The Young diagrams the following getters:\n", "1) partition\n", "2) rows\n", "3) columns\n", "4) boxes" ] }, { "cell_type": "code", "execution_count": 21, "id": "92b41d3e-cc70-4d92-af1d-a213987dff96", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(10, 9, 8, 7, 5, 4, 2, 1)" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.partition # returns the partition as a list or a tuple." ] }, { "cell_type": "code", "execution_count": 12, "id": "6a8a980c-bfa6-4c87-a91e-36295fcd4d77", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda2.rows # returns the number of rows" ] }, { "cell_type": "code", "execution_count": 13, "id": "2544a409-ab5a-4427-b662-18f59541c24d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda3.columns # returns the number of columns" ] }, { "cell_type": "code", "execution_count": 22, "id": "c6596be2-fb37-4a62-9eee-203b5a987232", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "46" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.boxes # returns the number of boxes " ] }, { "cell_type": "markdown", "id": "73af6ae9-314e-4447-a6bb-a527110e899c", "metadata": {}, "source": [ "### Methods" ] }, { "cell_type": "markdown", "id": "86c50202-aeb3-4d51-a7f8-8fb21169fc3f", "metadata": {}, "source": [ "#### Count diagonal" ] }, { "cell_type": "markdown", "id": "75465c6d-0954-4d9b-9000-ec687f728086", "metadata": {}, "source": [ "This method counts the number of boxes in the diagonal of the Young diagram" ] }, { "cell_type": "code", "execution_count": 23, "id": "d806e026-d226-4b74-abf6-95e1cb684a3b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "5" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.count_diagonal() # Retturns the number of boxes in the diagonal" ] }, { "cell_type": "markdown", "id": "4a0b0d52-369a-4492-875b-d321aebdd440", "metadata": {}, "source": [ "#### Frobenius Coordinates" ] }, { "cell_type": "markdown", "id": "6adb1c76-1f9a-4564-9b40-06ebd8776871", "metadata": {}, "source": [ "From these methods and properties, we have also find the Frobenius coordinates for a given partition." ] }, { "cell_type": "code", "execution_count": 24, "id": "237d3bcc-bccc-434a-b72c-2c54dd8ac54f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[[19/2, -15/2], [15/2, -11/2], [11/2, -7/2], [7/2, -5/2], [1/2, -1/2]]" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.frobenius_coordinates()" ] }, { "cell_type": "code", "execution_count": 25, "id": "7676b414-012b-4ef8-84eb-5e3484ba0380", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[[9/2, -7/2], [7/2, -5/2], [3/2, -3/2]]" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda2.frobenius_coordinates()" ] }, { "cell_type": "code", "execution_count": 26, "id": "4c33ad9e-a6f9-4f49-9ce9-b8683b19bee0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[[5/2, -5/2], [3/2, -3/2]]" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda3.frobenius_coordinates()" ] }, { "cell_type": "markdown", "id": "c842c527-a192-4418-a927-9f14e8004910", "metadata": {}, "source": [ "#### Transposed Young Diagram" ] }, { "cell_type": "markdown", "id": "b3bc7ee4-0f59-43ff-b0c3-c95ba56d9da5", "metadata": {}, "source": [ "The method transpose, as the name suggests,returns the transposed (or conjugate) Young diagram as a new object." ] }, { "cell_type": "code", "execution_count": 27, "id": "d48ba9e3-78f4-4504-a2e1-4eda8aa5911e", "metadata": {}, "outputs": [], "source": [ "lambda1_T = lambda1.transpose()" ] }, { "cell_type": "code", "execution_count": 28, "id": "84b12901-b19e-4649-99c4-599871e95efa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(8, 7, 6, 6, 5, 4, 4, 3, 2, 1)" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1_T.partition" ] }, { "cell_type": "code", "execution_count": 31, "id": "43311419-7566-44c6-995d-27e4f3199228", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# And all the getters are also available for the conjugate diagram\n", "lambda1_T.rows" ] }, { "cell_type": "markdown", "id": "a115cb48-634c-461e-beea-927e32976009", "metadata": {}, "source": [ "#### Conjugacy Partition" ] }, { "cell_type": "markdown", "id": "0df1caab-e911-4d8d-94fc-d95382e03b3b", "metadata": {}, "source": [ "It is also useful to represent the partitions in terms of its cycles conjugacy class. For example, \n", "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)$. \n", "\n", "We can get these representations from the method .conjugacy_partition. For a generic partition $\\lambda = (\\lambda_1, \\lambda_2, \\dots, \\lambda_N)$\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\\}$." ] }, { "cell_type": "code", "execution_count": 33, "id": "528d516e-e7a2-464d-bcbf-edee363b2b4c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{1: 1, 2: 1, 3: 0, 4: 1, 5: 1, 6: 0, 7: 1, 8: 1, 9: 1, 10: 1}" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.conjugacy_partition()" ] }, { "cell_type": "code", "execution_count": 34, "id": "88fb2271-06b3-46ce-9df5-860c20287700", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{1: 0, 2: 0, 3: 1, 4: 1, 5: 2}" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda2.conjugacy_partition()" ] }, { "cell_type": "markdown", "id": "ecff9bd6-540b-48cc-ad9c-b6a5dc465b94", "metadata": {}, "source": [ "#### Contains and Interlaces" ] }, { "cell_type": "markdown", "id": "5cbe797e-1423-44d6-a998-dd68124f799b", "metadata": {}, "source": [ "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. " ] }, { "cell_type": "code", "execution_count": 35, "id": "9682730c-3cf3-4ddb-b194-f58b1dff650d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "■ \n", "■ ■ \n", "■ ■ ■ ■ \n", "■ ■ ■ ■ ■ \n", "■ ■ ■ ■ ■ ■ ■ \n", "■ ■ ■ ■ ■ ■ ■ ■ \n", "■ ■ ■ ■ ■ ■ ■ ■ ■ \n", "■ ■ ■ ■ ■ ■ ■ ■ ■ ■ \n" ] } ], "source": [ "lambda1.draw_diagram(0)" ] }, { "cell_type": "code", "execution_count": 36, "id": "a03b0982-c787-40d7-97ef-1be6af02fc81", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "• • • \n", "• • • • \n", "• • • • • \n", "• • • • • \n" ] } ], "source": [ "lambda2.draw_diagram(1)" ] }, { "cell_type": "code", "execution_count": 37, "id": "3ae630e4-22b7-4bc0-94e0-add64161226f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda1.contains(lambda2) # partition lambda1 contains lambda2" ] }, { "cell_type": "code", "execution_count": 38, "id": "88789109-380b-43a7-8a84-9f778eeef76b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "False" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda2.interlaces(lambda1) # partition lambda2 interlaces lambda1" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.2" } }, "nbformat": 4, "nbformat_minor": 5 }