{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The flour-beetle model\n", "\n", "In this notebook we are going to work out the way of using the package `dalgebra` to the model depicted in [the Flour-Beetle model](https://www.math.arizona.edu/~cushing/Global%20Stability%20JDEA96.pdf). This model try to understand the evolution of a population of beetles inside the flour, were we count in a discrete way the number of larvae $L_t$, pupal $P_t$ and adult $A_t$ population with the following equations:\n", "\n", "$$\\left\\{\\begin{array}{ll}\n", " L_{t+1} & = b A_{t} e^{-c_{ea}A_t - c_{el}L_t},\\\\\n", " P_{t+1} & = (1 - \\mu_l)L_t,\\\\\n", " A_{t+1} & = P_t e^{-c_{pa}A_t} + (1-\\mu_a)A_t.\n", "\\end{array}\\right.$$\n", "\n", "In this model we have two types of parameters: the $c$ family ($c_{ea}, c_{el}$ and $c_{pa}$), which appears in the exponents of the exponential functions involved; the parameter $b$ as a multiplier on how the adults put more eggs and the $\\mu$ parameters ($\\mu_l$ and $\\mu_a$), that appear in the $(1-\\mu)$ expressions throughout the linear relations between variables.\n", "\n", "In total, we get 6 parameters. The natural question of identifiability arises in this case for different output variables.\n", "\n", "However, we have a crucial issue in this model: the exponential functions. They appear in 2 out of 3 equations and involve 3 out of the 6 parameters. How we represent these exponential will be crucial to understand how to model this system into the `dalgebra` package." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}]\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}]$" ], "text/plain": [ "Multivariate Polynomial Ring in c_ea, c_el, c_pa, b, mu_l, mu_a over Rational Field" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sys; sys.path.insert(0, \"..\") # dalgebra is here\n", "%display latex\n", "from dalgebra import * \n", "R. = QQ[]; R # ring for the parameters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Removing the exponentials\n", "\n", "The first idea to remove the exponentials is to substitute them by a new variable and see how this variables behaves. Let do so by:\n", "$$X_t^{(1)} = \\exp\\left(-c_{ea}A_t - c_{el}L_t\\right),$$\n", "$$X_t^{(2)} = \\exp\\left(-c_{pa}A_t\\right).$$\n", "\n", "If we try to apply the shift operator $t \\mapsto t+1$ and use the equations for $A_t$ and $L_t$ we do not get anything good since some double exponentials start appearing. This is why we will (_formally_) consider a new operator: the derivative w.r.t. $t$. We will assume that this operators commutes with the shift we already have.\n", "\n", "Using this derivation, we obtain the following equations:\n", "\n", "$$X_t^{(1)'} = -(c_{ea}A_t' + c_{el}L_t') X_t^{(1)}.$$\n", "$$X_t^{(2)'} = -c_{pa}A_t'X_t^{(2)}.$$\n", "\n", "Thanks to this equations, we can eliminate the exponentials that appear in the original system but, at the same time, we will have to work on a difference-differential ring $(R, \\sigma, \\partial)$, which \"complicates\" the extension of the system we need to take to guarantee we can eliminate variables.\n", "\n", "If we compute the necessary derivatives of our original system we obtain the following system:\n", "$$\\left\\{\\begin{array}{ll}\n", " L_{t+1}' & = \\left(b A_{t} X_t^{(1)}\\right)' = \\left(bA_t' - A_t(c_{ea}A_t' + c_{el}L_t')\\right)X_t^{(1)} = \n", " \\displaystyle\\frac{bL_{t+1}A_t' - c_{ea}L_{t+1}A_tA_t' - c_{el}L_{t+1}L_t'A_t}{bA_t}\\\\\n", " P_{t+1} & = (1 - \\mu_l)L_t,\\\\\n", " A_{t+1}' & = \\left(P_t X_t^{(2)} + (1-\\mu_a)A_t\\right)' = \\left(P_t'-c_{pa}A_t'\\right)X_t^{(2)} + (1-\\mu_a)A_t' =\n", " \\displaystyle\\frac{(P_t'- c_{pa}A_t')(A_{t+1} - (1-\\mu_a)A_t)}{P_t} + (1-\\mu_a)A_t'\n", "\\end{array}\\right.$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Removing the variable $L_t$\n", "\n", "The variable $P_t$ is the only variable we did not need to differentiate to remove exponentials. Moreover, its equation is so simple we can compute things like:\n", "\n", "$$P_{t+k+1}^{(n)} = (1-\\mu_l)L_{t+k}^{(n)}.$$\n", "\n", "This allows us to remove completely the variable $L_t$ in the system, since we can always represent it in terms of the $P_t$, obtaining the new system:\n", "\n", "$$\\left\\{\\begin{array}{ll}\n", " P_{t+2}' & = \\displaystyle\\frac{(1-\\mu_l)(bP_{t+2}A_t' - c_{ea}P_{t+2}A_tA_t' - c_{el}P_{t+2}P_{t+1}'A_t)}{bA_t}\\\\\n", " A_{t+1}' & = \\displaystyle\\frac{(P_t'- c_{pa}A_t')(A_{t+1} - (1-\\mu_a)A_t)}{P_t} + (1-\\mu_a)A_t'\n", "\\end{array}\\right.$$\n", "\n", "At this point we have 2 equations with 2 functions and 2 operators. We can then consider when, for example, is $A_t$ a nice output variable (i.e., whether $P_t$ can be eliminated from the system)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. Setting up the system in `dalgebra`\n", "\n", "Now it is a good moment for trying to put the system into the package `dalgebra`. In the current version of the code, we are not allow to have a difference-differential ring. So we will need to do it in two steps, defining more variables for the shifts of the $A_t$ and $P_t$ and then trying to get the differential structure behind. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\}\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\}$" ], "text/plain": [ "Ring of operator polynomials in (A, P) over Ring [[Multivariate Polynomial Ring in c_ea, c_el, c_pa, b, mu_l, mu_a over Rational Field], (0, Id)]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "DSR = DifferenceRing(DifferentialRing(R, lambda p : 0),R.Hom(R).one()) # we create the differential structure around these parameters\n", "D. = RWOPolynomialRing(DSR); D" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\ \n", "\\end{array}\\right.\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\ \n", "\\end{array}\\right.$" ], "text/plain": [ "System over [Ring of operator polynomials in (A, P) over Ring [[Multivariate Polynomial Ring in c_ea, c_el, c_pa, b, mu_l, mu_a over Rational Field], (0, Id)]] with variables [(A_*,)]:\n", "{\n", "\t(c_ea*mu_l - c_ea)*A_1_0*A_0_0*P_0_2 + (c_el*mu_l - c_el)*A_0_0*P_1_1*P_0_2 + (-b*mu_l + b)*A_1_0*P_0_2 + (-b)*A_0_0*P_1_2 == 0\n", "\t-A_1_1*P_0_0 + (-c_pa)*A_1_0^2 + (-c_pa*mu_a + c_pa)*A_1_0*A_0_0 + A_1_0*P_1_0 + (-mu_a + 1)*A_1_0*P_0_0 + (mu_a - 1)*A_0_0*P_1_0 == 0\n", "}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system = RWOSystem([\n", "(1-mu_l)*(b*P[0,2]*A[1,0] - c_ea*P[0,2]*A[0,0]*A[1,0] - c_el*P[0,2]*P[1,1]*A[0,0]) - b*A[0,0]*P[1,2],\n", "(P[1,0]-c_pa*A[1,0])*(A[1,0]-(1-mu_a)*A[0,0]) + (1-mu_a)*A[1,0]*P[0,0] - P[0,0]*A[1,1]\n", "], variables=[A])\n", "system" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "We couldn't eliminate the As. Trying to eliminate the Ps...\n", "We couldn't eliminate the Ps either.\n" ] } ], "source": [ "try:\n", " system.diff_resultant(operation = 0, alg_res=\"macaulay\") # w.r.t. derivation\n", "except TypeError:\n", " print(\"We couldn't eliminate the As. Trying to eliminate the Ps...\")\n", " try:\n", " system.change_variables([P]).diff_resultant(operation = 0, alg_res=\"macaulay\") # w.r.t. derivation\n", " except TypeError:\n", " print(\"We couldn't eliminate the Ps either.\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle 7\\)" ], "text/latex": [ "$\\displaystyle 7$" ], "text/plain": [ "7" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(system.extend_by_operation([2,2,2], operation=0).algebraic_variables())" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "\\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)}^{2} P_{(0, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(1, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 2)} P_{(1, 1)} + \\left(-b \\mu_{l} + b\\right) A_{(2, 0)} P_{(0, 2)} + \\left(-b \\mu_{l}\\right) A_{(1, 0)} P_{(1, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(2, 2)} & = 0 \\\\\n", "\\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(3, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(3 c_{\\mathit{ea}} \\mu_{l} - 3 c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(1, 0)} P_{(0, 2)} + \\left(2 c_{\\mathit{ea}} \\mu_{l} - 2 c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(0, 0)} P_{(1, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(2, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(2 c_{\\mathit{ea}} \\mu_{l} - 2 c_{\\mathit{ea}}\\right) A_{(1, 0)}^{2} P_{(1, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(2, 2)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(2, 1)} P_{(0, 2)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(1, 2)} P_{(1, 1)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(3, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 2)} P_{(1, 1)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 1)} P_{(1, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(3, 0)} P_{(0, 2)} + \\left(-2 b \\mu_{l} + b\\right) A_{(2, 0)} P_{(1, 2)} + \\left(-b \\mu_{l} - b\\right) A_{(1, 0)} P_{(2, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(3, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\\n", "-A_{(2, 1)} P_{(0, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(0, 0)} + 1 A_{(2, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(2, 0)} P_{(0, 0)} - A_{(1, 1)} P_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + 1 A_{(1, 0)} P_{(2, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(2, 0)} & = 0 \\\\\n", "-A_{(3, 1)} P_{(0, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(3, 0)} A_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(3, 0)} A_{(0, 0)} + 1 A_{(3, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(3, 0)} P_{(0, 0)} + \\left(-2\\right) A_{(2, 1)} P_{(1, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(2, 0)}^{2} + \\left(-3 c_{\\mathit{pa}} \\mu_{a} + 3 c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(1, 0)} + 2 A_{(2, 0)} P_{(2, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(2, 0)} P_{(1, 0)} - A_{(1, 1)} P_{(2, 0)} + 1 A_{(1, 0)} P_{(3, 0)} + \\left(\\mu_{a} - 1\\right) A_{(1, 0)} P_{(2, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(3, 0)} & = 0 \\\\ \n", "\\end{array}\\right.\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "\\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)}^{2} P_{(0, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(1, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 2)} P_{(1, 1)} + \\left(-b \\mu_{l} + b\\right) A_{(2, 0)} P_{(0, 2)} + \\left(-b \\mu_{l}\\right) A_{(1, 0)} P_{(1, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(2, 2)} & = 0 \\\\\n", "\\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(3, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(3 c_{\\mathit{ea}} \\mu_{l} - 3 c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(1, 0)} P_{(0, 2)} + \\left(2 c_{\\mathit{ea}} \\mu_{l} - 2 c_{\\mathit{ea}}\\right) A_{(2, 0)} A_{(0, 0)} P_{(1, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(2, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(2 c_{\\mathit{ea}} \\mu_{l} - 2 c_{\\mathit{ea}}\\right) A_{(1, 0)}^{2} P_{(1, 2)} + \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(2, 2)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(2, 1)} P_{(0, 2)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(1, 0)} P_{(1, 2)} P_{(1, 1)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(3, 1)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 2)} P_{(1, 1)} + \\left(2 c_{\\mathit{el}} \\mu_{l} - 2 c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(2, 1)} P_{(1, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(3, 0)} P_{(0, 2)} + \\left(-2 b \\mu_{l} + b\\right) A_{(2, 0)} P_{(1, 2)} + \\left(-b \\mu_{l} - b\\right) A_{(1, 0)} P_{(2, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(3, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\\n", "-A_{(2, 1)} P_{(0, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(0, 0)} + 1 A_{(2, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(2, 0)} P_{(0, 0)} - A_{(1, 1)} P_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + 1 A_{(1, 0)} P_{(2, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(2, 0)} & = 0 \\\\\n", "-A_{(3, 1)} P_{(0, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(3, 0)} A_{(1, 0)} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(3, 0)} A_{(0, 0)} + 1 A_{(3, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(3, 0)} P_{(0, 0)} + \\left(-2\\right) A_{(2, 1)} P_{(1, 0)} + \\left(-2 c_{\\mathit{pa}}\\right) A_{(2, 0)}^{2} + \\left(-3 c_{\\mathit{pa}} \\mu_{a} + 3 c_{\\mathit{pa}}\\right) A_{(2, 0)} A_{(1, 0)} + 2 A_{(2, 0)} P_{(2, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(2, 0)} P_{(1, 0)} - A_{(1, 1)} P_{(2, 0)} + 1 A_{(1, 0)} P_{(3, 0)} + \\left(\\mu_{a} - 1\\right) A_{(1, 0)} P_{(2, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(3, 0)} & = 0 \\\\ \n", "\\end{array}\\right.$" ], "text/plain": [ "System over [Ring of operator polynomials in (A, P) over Ring [[Multivariate Polynomial Ring in c_ea, c_el, c_pa, b, mu_l, mu_a over Rational Field], (0, Id)]] with variables [(A_*,)]:\n", "{\n", "\t(c_ea*mu_l - c_ea)*A_(1, 0)*A_(0, 0)*P_(0, 2) + (c_el*mu_l - c_el)*A_(0, 0)*P_(1, 1)*P_(0, 2) + (-b*mu_l + b)*A_(1, 0)*P_(0, 2) + (-b)*A_(0, 0)*P_(1, 2) == 0\n", "\t(c_ea*mu_l - c_ea)*A_(2, 0)*A_(0, 0)*P_(0, 2) + (c_ea*mu_l - c_ea)*A_(1, 0)^2*P_(0, 2) + (c_ea*mu_l - c_ea)*A_(1, 0)*A_(0, 0)*P_(1, 2) + (c_el*mu_l - c_el)*A_(1, 0)*P_(1, 1)*P_(0, 2) + (c_el*mu_l - c_el)*A_(0, 0)*P_(2, 1)*P_(0, 2) + (c_el*mu_l - c_el)*A_(0, 0)*P_(1, 2)*P_(1, 1) + (-b*mu_l + b)*A_(2, 0)*P_(0, 2) + (-b*mu_l)*A_(1, 0)*P_(1, 2) + (-b)*A_(0, 0)*P_(2, 2) == 0\n", "\t(c_ea*mu_l - c_ea)*A_(3, 0)*A_(0, 0)*P_(0, 2) + (3*c_ea*mu_l - 3*c_ea)*A_(2, 0)*A_(1, 0)*P_(0, 2) + (2*c_ea*mu_l - 2*c_ea)*A_(2, 0)*A_(0, 0)*P_(1, 2) + (c_el*mu_l - c_el)*A_(2, 0)*P_(1, 1)*P_(0, 2) + (2*c_ea*mu_l - 2*c_ea)*A_(1, 0)^2*P_(1, 2) + (c_ea*mu_l - c_ea)*A_(1, 0)*A_(0, 0)*P_(2, 2) + (2*c_el*mu_l - 2*c_el)*A_(1, 0)*P_(2, 1)*P_(0, 2) + (2*c_el*mu_l - 2*c_el)*A_(1, 0)*P_(1, 2)*P_(1, 1) + (c_el*mu_l - c_el)*A_(0, 0)*P_(3, 1)*P_(0, 2) + (c_el*mu_l - c_el)*A_(0, 0)*P_(2, 2)*P_(1, 1) + (2*c_el*mu_l - 2*c_el)*A_(0, 0)*P_(2, 1)*P_(1, 2) + (-b*mu_l + b)*A_(3, 0)*P_(0, 2) + (-2*b*mu_l + b)*A_(2, 0)*P_(1, 2) + (-b*mu_l - b)*A_(1, 0)*P_(2, 2) + (-b)*A_(0, 0)*P_(3, 2) == 0\n", "\t-A_(1, 1)*P_(0, 0) + (-c_pa)*A_(1, 0)^2 + (-c_pa*mu_a + c_pa)*A_(1, 0)*A_(0, 0) + A_(1, 0)*P_(1, 0) + (-mu_a + 1)*A_(1, 0)*P_(0, 0) + (mu_a - 1)*A_(0, 0)*P_(1, 0) == 0\n", "\t-A_(2, 1)*P_(0, 0) + (-2*c_pa)*A_(2, 0)*A_(1, 0) + (-c_pa*mu_a + c_pa)*A_(2, 0)*A_(0, 0) + A_(2, 0)*P_(1, 0) + (-mu_a + 1)*A_(2, 0)*P_(0, 0) - A_(1, 1)*P_(1, 0) + (-c_pa*mu_a + c_pa)*A_(1, 0)^2 + A_(1, 0)*P_(2, 0) + (mu_a - 1)*A_(0, 0)*P_(2, 0) == 0\n", "\t-A_(3, 1)*P_(0, 0) + (-2*c_pa)*A_(3, 0)*A_(1, 0) + (-c_pa*mu_a + c_pa)*A_(3, 0)*A_(0, 0) + A_(3, 0)*P_(1, 0) + (-mu_a + 1)*A_(3, 0)*P_(0, 0) + (-2)*A_(2, 1)*P_(1, 0) + (-2*c_pa)*A_(2, 0)^2 + (-3*c_pa*mu_a + 3*c_pa)*A_(2, 0)*A_(1, 0) + 2*A_(2, 0)*P_(2, 0) + (-mu_a + 1)*A_(2, 0)*P_(1, 0) - A_(1, 1)*P_(2, 0) + A_(1, 0)*P_(3, 0) + (mu_a - 1)*A_(1, 0)*P_(2, 0) + (mu_a - 1)*A_(0, 0)*P_(3, 0) == 0\n", "}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_system = system.extend_by_operation([2,2,2], operation=0)\n", "new_system" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\ \n", "\\end{array}\\right.\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{System over } \\left(\\Bold{Q}[c_{\\mathit{ea}}, c_{\\mathit{el}}, c_{\\mathit{pa}}, b, \\mu_{l}, \\mu_{a}], \\left(0, \\text{id}\\right)\\right) \\{ A, P \\} \\text{ with variables } A_{\\ast} :\n", "\n", " \\left\\{\\begin{array}{ll} \\left(c_{\\mathit{ea}} \\mu_{l} - c_{\\mathit{ea}}\\right) A_{(1, 0)} A_{(0, 0)} P_{(0, 2)} + \\left(c_{\\mathit{el}} \\mu_{l} - c_{\\mathit{el}}\\right) A_{(0, 0)} P_{(1, 1)} P_{(0, 2)} + \\left(-b \\mu_{l} + b\\right) A_{(1, 0)} P_{(0, 2)} + \\left(-b\\right) A_{(0, 0)} P_{(1, 2)} & = 0 \\\\\n", "-A_{(1, 1)} P_{(0, 0)} + \\left(-c_{\\mathit{pa}}\\right) A_{(1, 0)}^{2} + \\left(-c_{\\mathit{pa}} \\mu_{a} + c_{\\mathit{pa}}\\right) A_{(1, 0)} A_{(0, 0)} + 1 A_{(1, 0)} P_{(1, 0)} + \\left(-\\mu_{a} + 1\\right) A_{(1, 0)} P_{(0, 0)} + \\left(\\mu_{a} - 1\\right) A_{(0, 0)} P_{(1, 0)} & = 0 \\\\ \n", "\\end{array}\\right.$" ], "text/plain": [ "System over [Ring of operator polynomials in (A, P) over Ring [[Multivariate Polynomial Ring in c_ea, c_el, c_pa, b, mu_l, mu_a over Rational Field], (0, Id)]] with variables [(A_*,)]:\n", "{\n", "\t(c_ea*mu_l - c_ea)*A_(1, 0)*A_(0, 0)*P_(0, 2) + (c_el*mu_l - c_el)*A_(0, 0)*P_(1, 1)*P_(0, 2) + (-b*mu_l + b)*A_(1, 0)*P_(0, 2) + (-b)*A_(0, 0)*P_(1, 2) == 0\n", "\t-A_(1, 1)*P_(0, 0) + (-c_pa)*A_(1, 0)^2 + (-c_pa*mu_a + c_pa)*A_(1, 0)*A_(0, 0) + A_(1, 0)*P_(1, 0) + (-mu_a + 1)*A_(1, 0)*P_(0, 0) + (mu_a - 1)*A_(0, 0)*P_(1, 0) == 0\n", "}" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "system" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.7", "language": "sage", "name": "sagemath" }, "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.10.5" } }, "nbformat": 4, "nbformat_minor": 4 }