{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "c97e59c4-571a-40a9-aee6-f5c1280371bc", "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": "9742113f-57ab-4b9f-bba5-dbaf26587859", "metadata": {}, "source": [ "# Characters (utils)" ] }, { "cell_type": "markdown", "id": "64980944-f3eb-47a3-9151-e92354be2788", "metadata": {}, "source": [ "One useful function defined in the utils module is the character(young: YoungDiagram , conjugacy: ConjugacyClass), that as the name suggests, gives the character $$\\chi_{\\lambda}(\\vec{k})$$ of the symmetric group $\\mathfrak{S}_N$ in the representation $\\lambda$ and conjugacy class $C(\\vec{k})$. The nice point about the State class is that we can build the character table for any given integer. " ] }, { "cell_type": "code", "execution_count": 3, "id": "894b472b-f52d-457d-91ee-c3a8d737ee1c", "metadata": {}, "outputs": [], "source": [ "# Let's define the function character_table:\n", "def character_table(n):\n", " '''\n", " Gives the table of characters for the level n.\n", " '''\n", " chi = sp.Symbol(f'chi')\n", "\n", " states = sy.State(n)\n", " partitions = states.partition_states()\n", " conjugacy = states.conjugacy_states()\n", " \n", " for a in partitions:\n", " yg = sy.YoungDiagram(a)\n", " display(Latex(r'$\\chi$'), yg.partition)\n", " for b in conjugacy:\n", " cj = sy.ConjugacyClass(b)\n", " if ut.character(yg, cj) >= 0:\n", " print(f\"{4*' '}{b}: {' '}{ut.character(yg, cj)}\")\n", " else:\n", " print(f\"{4*' '}{b}: {ut.character(yg, cj)}\")" ] }, { "cell_type": "code", "execution_count": 6, "id": "7a17c71f-aa93-43e6-b30d-37c64bd03f39", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\chi$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "(1, 1)" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " {1: 2, 2: 0}: 1\n", " {1: 0, 2: 1}: -1\n" ] }, { "data": { "text/latex": [ "$\\chi$" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "(2, 0)" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " {1: 2, 2: 0}: 1\n", " {1: 0, 2: 1}: 1\n" ] } ], "source": [ "n = 2\n", "character_table(n)" ] }, { "cell_type": "code", "execution_count": null, "id": "b0e7afbf-16cb-47fd-b97a-ceec8c5cbe51", "metadata": {}, "outputs": [], "source": [] } ], "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 }