{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "53aab533-e7f5-4cb4-a36f-a0f790749bf8", "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": "c9b4fe6d-94db-48a6-927e-d2be77cc898d", "metadata": {}, "source": [ "# Class: MonomialPolynomial" ] }, { "cell_type": "markdown", "id": "6a6512c7-6b3d-45cb-b673-9e7582de69aa", "metadata": {}, "source": [ "Now we turn our attention to the Monomial Symmetric Polynomials. In terms of implementation, they are defined via inheritance of the Hall-Littlewood defined below, but since they are more fundamental than the Hall-Littlewood polynomials, let us treat them here.\n", "\n", "In terms of construction, we follow the logic of the previous classes." ] }, { "cell_type": "code", "execution_count": 2, "id": "d6c48364-ee22-431c-b47a-59f8bac1aded", "metadata": {}, "outputs": [], "source": [ "# We first define the partition and the Young diagram\n", "part = (3,2)\n", "yg = sy.YoungDiagram(part)" ] }, { "cell_type": "code", "execution_count": 3, "id": "b2c854c3-e149-4076-bc79-57c12051ebac", "metadata": {}, "outputs": [], "source": [ "# Then we call the class from the Young Diagram\n", "mp = sy.MonomialPolynomial(yg)" ] }, { "cell_type": "code", "execution_count": 4, "id": "abba6a0b-d224-468e-a52b-0b1b4cacfcf6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(x1, x2)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Next we build the x coordinates\n", "n = 2\n", "x = ut.create_x_coord(n)\n", "x" ] }, { "cell_type": "code", "execution_count": 5, "id": "f92cc030-0994-4ebc-bdc5-3b86a7831256", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle x_{1}^{3} x_{2}^{2} + x_{1}^{2} x_{2}^{3}$" ], "text/plain": [ "x1**3*x2**2 + x1**2*x2**3" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The explicit expression is (factor and expand are sympy methods\n", "mp.explicit(x).factor().expand()" ] }, { "cell_type": "code", "execution_count": 6, "id": "c67a5d31-6f10-4d99-8f8a-c404b95af8a8", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\operatorname{Poly}{\\left( x_{1}^{3}x_{2}^{2} + x_{1}^{2}x_{2}^{3}, x_{1}, x_{2}, domain=\\mathbb{Q} \\right)}$" ], "text/plain": [ "Poly(x1**3*x2**2 + x1**2*x2**3, x1, x2, domain='QQ')" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The explicit expression is (factor and expand are sympy methods\n", "mp.explicit(x, True)" ] }, { "cell_type": "code", "execution_count": 7, "id": "cafc14d5-9aa6-4765-9d12-1314652f7728", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(x1,)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Next we build the x coordinates with n < len(part)\n", "n = 1\n", "x = ut.create_x_coord(n)\n", "x" ] }, { "cell_type": "code", "execution_count": 8, "id": "a495a5be-01a4-417b-aea4-9b0dab425725", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mp.explicit(x)" ] }, { "cell_type": "code", "execution_count": 9, "id": "93a81b8f-5461-4cb0-b6fc-951aa1d39f30", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(x1, x2, x3)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Next we build the x coordinates with n > len(part)\n", "n = 3\n", "x = ut.create_x_coord(n)\n", "x" ] }, { "cell_type": "code", "execution_count": 10, "id": "e96b2b62-d17d-41f1-a4b7-bda08b6833d6", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle x_{1}^{3} x_{2}^{2} + x_{1}^{3} x_{3}^{2} + x_{1}^{2} x_{2}^{3} + x_{1}^{2} x_{3}^{3} + x_{2}^{3} x_{3}^{2} + x_{2}^{2} x_{3}^{3}$" ], "text/plain": [ "x1**3*x2**2 + x1**3*x3**2 + x1**2*x2**3 + x1**2*x3**3 + x2**3*x3**2 + x2**2*x3**3" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mp.explicit(x)" ] }, { "cell_type": "markdown", "id": "3a612b0c-63d0-4bd0-9e10-47404d430462", "metadata": {}, "source": [ "We also have a getter for the partition associated to a given Monomial Symmetric Polynomial." ] }, { "cell_type": "code", "execution_count": 11, "id": "087a2f31-9d6c-46f2-a561-556e54cbf556", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(3, 2)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mp.partition" ] }, { "cell_type": "code", "execution_count": null, "id": "a01f7a03-cceb-42fe-88c0-602f4c0767bd", "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 }