diff --git a/_freeze/posts/polycount/sand-1/index/execute-results/html.json b/_freeze/posts/polycount/sand-1/index/execute-results/html.json
index 0cd2581..4e0f3d6 100644
--- a/_freeze/posts/polycount/sand-1/index/execute-results/html.json
+++ b/_freeze/posts/polycount/sand-1/index/execute-results/html.json
@@ -1,8 +1,8 @@
{
- "hash": "8cfa80f3278288771732e2d3e294d217",
+ "hash": "aa1e4b76ce6b05a54c89d9c108f20b48",
"result": {
"engine": "jupyter",
- "markdown": "---\ntitle: \"Counting in 2D, Part 1: Lines, Leaves, and Sand\"\ndescription: |\n An introduction to two-dimensional counting using polynomials of two variables.\nformat:\n html:\n html-math-method: katex\ndate: \"2021-02-23\"\ndate-modified: \"2025-02-20\"\njupyter: python3\ncategories:\n - algebra\n - python\nexecute:\n echo: false\n---\n\n\n\n\n\nPreviously, I've written about positional systems and so-called \"[polynomial counting](../1)\".\nBasically, this generalizes familiar integer bases like two and ten into less familiar irrational ones\n like the golden ratio.\nHowever, all systems I presented have something in common: they all use polynomials of a single variable.\nDoes it make sense to count in two variables?\n\n\nPreliminaries\n-------------\n\nBefore proceeding, I'll summarize some desired characteristics of polynomials which can be\n used as carries in positional systems.\n\nCarry polynomials must be nonpositive when evaluated at 1 (otherwise the digital root of\n an expansion is unbounded).\nMoreover, to make things easier, either:\n\n- All coefficients have the same sign but one, which has a much larger\n magnitude than the rest (and forces the digital root condition)\n - These are *explicit* irrational carries\n- They are monic (have leading coefficient 1) and the remaining coefficients are all negative\n and monotonically increase toward 0 after the second coefficient (0's are allowed anywhere)\n - These are *implicit* irrational carries\n\nIn previous systems, it was discovered that implicit carries can be multiplied,\n typically by cylotomic polynomials, to obtain explicit rules for larger numerals.\n\n\nA Game of Che...ckers\n---------------------\n\n[Conway's checkers](https://en.wikipedia.org/wiki/Conway%27s_Soldiers) is a game played by attempting to\n advance game pieces to the furthest extent beyond a line.\nA piece can only be moved by jumping it horizontally or vertically over others, which removes them from play.\nSquinting hard enough, in one dimension, this is similar to how in phinary, a \"1\" in an\n expansion can jump over an adjacent \"1\" to its left.\n\n$$\n\\begin{array}{}\n \\bullet \\\\ \\hline \\bullet \\\\ \\hline \\vphantom{\\bullet}\n\\end{array} \\huge⤸ \\normalsize\n~\\longrightarrow~\n\\begin{array}{}\n \\vphantom{\\bullet} \\\\ \\hline \\vphantom{\\bullet} \\\\ \\hline \\bullet\n\\end{array}\n\\quad \\iff \\quad\n0\\textcolor{red}{11} = \\textcolor{red}{1}00\n$$\n\nIn fact, it is exactly the same.\nThe best solution of the game relies on a geometric series in *φ*, as seen in\n [this video by Numberphile](https://www.youtube.com/watch?v=Or0uWM9bT5w).\n\n\n### Pairs of Checkers\n\nTo actually take phinary and systems like it from 1D to 2D, we really just need a carry rule that respects the\n second dimension.\nTo do this, we use a new variable *y* and invent a carry rule based on it.\n\nThe smallest way to extend our one-dimensional string of digits is do just introduce a second string.\nBased on this, my intuition was to replace the standard hop with the movement of a knight in chess.\n\n$$\n\\begin{gather*}\n \\begin{array}{c|c}\n \\bullet & \\phantom{\\bullet} \\\\\n \\hline \\bullet \\\\ \\hline \\vphantom{\\bullet}\n \\end{array}\n ~\\longrightarrow~\n \\begin{array}{c|c}\n \\phantom{\\bullet} & \\phantom{\\bullet} \\\\\n \\hline \\\\ \\hline & \\bullet\n \\end{array}\n ~~ \\iff ~~\n \\left. \\begin{array}{}\n 0\\textcolor{red}{11}_x \\\\\n 000_y\n \\end{array} \\right]\n = \\left. \\begin{array}{}\n 000_x \\\\\n \\textcolor{red}{1}00_y\n \\end{array} \\right ] \\\\ \\\\\n y^2 = x + 1,~ x^2 = y + 1\n\\end{gather*}\n$$\n\nThis looks good on the surface, but it turns out that the polynomials aren't sufficiently intertwined.\nSince each variable is a function of the other, they can easily be coaxed into a single polynomial:\n\n$$\ny = x^2 - 1 \\longrightarrow y^2 = (x^2 - 1)^2 = x + 1 \\\\[6pt]\nx^4 - 2x^2 + 1 = x + 1 \\\\\nx^3 - 2x - 1 = 0 \\\\\n(x + 1)(x^2 - x - 1) = 0\n$$\n\nThe same argument applies symmetrically for *y*.\nOne of the resultant polynomials is the minimal polynomial of *φ*, so the prospective\n 2D system reduces back to standard phinary.\n\nThere are additional problems with this \"pairs of strings\" model.\nFor example, terms like *xy* never appear, and there is no way to represent them by just using two strings.\nAlso, both sequences have a ones' place, but should agree that $x^0 = y^0 = 1$.\n\n\nBuilding the Plane\n------------------\n\nIf it is the case that both powers of variables should share the one's digit, then why not\n join the two strings there?\nIn other words, for each variable, we think of a line with a distinguished point for zero.\nWe then match the distinguished points together.\nThus, instead of a point separator between positive and negative powers,\n the radix point is now a pair of lines that share a vertex.\nFrom this pair of lines, according to Euclid, we can make a plane.\n\n$$\n\\begin{array}{|c}\n \\hline\n f & d & a \\\\\n e & b \\\\\n c\n\\end{array}\n\\begin{matrix} ~\\equiv~\n ax^2 + bxy + cy^2 + dx + ey + f, \\\\\n \\text{the general form of a conic}\n\\end{matrix}\n$$\n\nSince the horizontal and vertical correspond with the *x* and *y* appearing in polynomials,\n it may be easy to confuse this with the *x*- and *y*-axes of the typical Cartesian plane.\nThe key differences here are that these are discrete (two-dimensional) strings, rather than a continuous plane,\n and along each point, there exists a cell in which an integer value lives.\n\n\n### An Arithmetical Aside\n\nExpressed in this way, it is very simple to compute the sum of two polynomials.\nJust like in the 1D system, we can align the one's places, add them together term-by-term, then apply carry rules.\nWith luck, this produces a canonical form.\n\nIt should also be possible to multiply two polynomials together.\nIn a single variable, multiplication is a somewhat involved 1D convolution.\nIn two, it is naturally [2D convolution](https://en.wikipedia.org/wiki/Kernel_(image_processing)),\n an operation typically encountered in image processing and signal analysis.\nI won't bother building up an intuition for this, since it won't be relevant to discussion.\n\nEven if multiplication is difficult, division is always harder.\nIn polynomials of a single variable, we can do synthetic (or long) division.\nNotationally, we work in the direction that the digits do not extend (i.e., downward).\nWith 2D numbers, we have digits in both dimensions.\nFortunately, computer algebra systems can divide and factor polynomials of two variables\n reasonably quickly, so this point is moot if we allow ourselves to use one.\n\n\n1, 2, 3, Takeoff\n----------------\n\nWhere should we start in a world of planar numbers?\nWell, we want to assign an integer to a polynomial with extent in both *x* and *y*.\nThe simplest way to do this is by letting $n = x + y$: when the one's place has\n a magnitude of *n*, it flows into *x* and *y*.\n\nIf $n = 1$, then the sum of coefficients is skewed toward the LHS, and the digital root is unbounded.\nWe had a similar restriction in one dimension.\nTherefore, let $n = 2$.\nThe expansions of the powers of 2 are:\n\n$$\n\\begin{matrix}\n &&\\text{Carry:}&\\begin{array}{|c} \\hline\n -2 & 1 \\\\\n 1\n \\end{array}\\\\\n 1 & 2 & ... & 4 & ... & 8 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} &\n \\begin{array}{|c} \\hline\n 0 & 1 \\\\\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 2 \\\\\n 2\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 4 \\\\\n 4\n \\end{array} \\\\ \\\\ &&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 1 \\\\\n 0 & 0 & 1 \\\\\n 1 & 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 0 & 2 \\\\\n 0 & 0 & 2 \\\\\n 2 & 2\n \\end{array} \\\\ \\\\ &&&&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & 0 & 1 & 1 \\\\\n 0 & 1 & 0 & 1 \\\\\n 1 & 1 & 1\n \\end{array}\n\\end{matrix}\n$$\n\nThe final entry of each column is achieved by applying the carry enough times, reducing all digits\n to \"0\"s and \"1\"s.\nIn doing so, the typical binary expansion is visible along first row and column, albeit reversed.\nThis is always the case, since when the carry is restricted to a single dimension (i.e., let $y = 0$),\n we get the 1D binary carry.\nMore visually, there is no mechanism for the carry to disturb the column and row by spreading either left or up.\nI'll call this system *dibinary*, since it is binary across two variables.\n\nAn additional property of this system is that the number of \"1\"s that appear in the expansion is equal\n to the number itself.\nThese two properties make it a sort of hybrid between unary and binary, bridging their\n binary expansion and its [Hamming weight](https://en.wikipedia.org/wiki/Hamming_weight).\n\nThis notation is very heavy, but fortunately lends itself well to visualization.\nEach integer's expansion is more or less an image, so we can arrange each as frames in a video:\n\n\n\n:::: {.row .text-center }\n::: {.column width=\"60%\"}\n{{< video ./count_xy2.mp4 >}}\n:::\n::::\n\nStarting at the expansion of twelve, the terms extend past the first column and row.\nIt instead grows faster along the diagonal, along which larger triangles appear when\n counting to higher and higher integers.\nMeanwhile, lower degrees (toward the upper left) appear to be slightly less predictable.\n\n\n### Higher *n*\n\nBy incrementing *n*, the expansions of numbers shrink exponentially, and simply incrementing is not fast enough.\nFortunately, this is a simple enough system that we can scalar-multiply base expansions, then assiduously apply the carry.\nAscending the powers of *n* in this manner for the carries where *n* = 3 and 4:\n\n\n\n:::: {.row layout-ncol=\"2\"}\n::: {}\n{{< video ./count_xy3.mp4 >}}\n\n$$x + y = 3$$\n:::\n\n::: {}\n{{< video ./count_xy4.mp4 >}}\n\n$$x + y = 4$$\n:::\n::::\n\nYellow corresponds to the highest allowed numeral, $n - 1$.\nIt seems like the lower-right grows much rounder as *n* increases.\nHowever, neither appears to have an emergent pattern as dibinary did.\n\nYou might be familiar with the way hexadecimal is a more compact version of binary.\nFor example,\n\n$$\\textcolor{red}{1}\\textcolor{blue}{2}_{16} = \\textcolor{red}{0001}\\textcolor{blue}{0010}_{2}$$\n\nbecause both one hexadecimal digit and four binary digits range over zero to fifteen.\nConsequently, by grouping group *m* digits of an expansion in base *b*, one can easily convert to base $b^m$.\n\nIf such a procedure still exists in 2D, applying it somehow destroys the pattern in the $n = 2$ case,\n as the quaternary system is very chaotic.\n\n\nCarry Curves\n------------\n\nSince the carry is a polynomial in both *x* and *y*, it lends itself to interpretation as an algebraic curve.\nTaking *x* or *y* to higher powers will dilate expansions along that axis.\n\nThe carry is not the only curve which exists in a system, as each integer is also a polynomial unto itself.\nAdding a constant term will not change anything unless it causes carries to occur.\nStarting at the carry digit, some of the *incremented curves* made by the carry $x + y = 2$ are shown below.\n\n::: {#d66886e3 .cell layout='[[3,3],[2,2,2]]' execution_count=5}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n:::\n\n\nIn each of these figures, the line is the curve which corresponds to the carry polynomial.\nAlong with it, while counting, additional shapes like hyperbolae seem to appear and disappear,\n only to be replaced with higher-order curves.\nThese higher order curves can be difficult to graph, so they show up as thicker lines.\nAt sixty-four, it appears as though the reflection of the carry across the origin\n (the curve $x + y = -2$) \"wants\" to appear.\n\nThe continued presence of the original carry curve in larger integers suggests that\n the points it passes through are important.\nThis curve happens to intersect with the *x* and *y* axes, which we can interpret as the \"base\"\n with respect to a single variable.\nFor dibinary, these are the aforementioned \"typical binary expansions\".\nWe can also evaluate the polynomial at $(x, y) = (1, 1)$, a point on the carry curve,\n to compute its digital root, which is also equal to the integer it represents.\nThis underlies a key difference from the 1D case.\n1D systems are special because the carry can be equated with a base (or bases), which\n is a discrete, zero-dimensional point (one dimension less) on a number line.\nIn higher dimensions, all points on the carry curve (or hypersurface) are \"bases\" we can plug in\n to test that an expansion is valid.\nThis makes naming much harder, since there are no preferred numbers to represent the system,\n like the golden ratio does with phinary.\n\n\nCasting the Line\n----------------\n\nWe may want to extend the \"unary\" property to other carries.\nTo do this, we construct a curve which passes through $(1, 1)$.\n\nLines of the form $(n - 1)x + y = n$ trivially satisfy this relationship.\nFurther, while the digits along the *y* column will be expansions of base *n*, those along *x* will\n be in base $n / (n - 1)$.\n\nFor example, for $n = 3$\n\n$$\n\\begin{matrix}\n &&&\\text{Carry:}&\n \\begin{array}{|c} \\hline\n -3 & 2 \\\\\n 1\n \\end{array}\\\\\n 1 & ... & 3 & ... & 6 & ... & 9 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 2 \\\\\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 4 \\\\\n 2\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 6 \\\\\n 3\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{|c} \\hline\n 0 & 1 & 2 \\\\\n 2 & 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 3 & 2 \\\\\n 3 & 1\n \\end{array} \\\\ \\\\ &&&&&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 1 & 2 \\\\\n 0 & 1 & 0 & 2 \\\\\n 1 & 1 & 1\n \\end{array}\n\\end{matrix}\n$$\n\nThe expansion in the *y* column looks trivially correct, since $y^2 = 9$ when $x = 0$.\nWe can check the base of the expansion of nine (\"2100\") by factoring a polynomial:\n\n::: {#0aef62ff .cell execution_count=6}\n\n::: {.cell-output .cell-output-display .cell-output-markdown}\n$\\displaystyle 2 x^{3} + x^{2} - 9 = \\left(2 x - 3\\right) \\left(x^{2} + 2 x + 3\\right)$\n:::\n:::\n\n\nThe linear polynomial has 3/2 as a root, while the quadratic one has only complex roots.\n\nNaturally, these expansions work symmetrically by considering *y* to have the $n - 1$ coefficient instead of *x*.\nThis transposes the carry (and hence the expansion).\n\n\n### Slanted Counting\n\nFor good measure, let's see what it looks like when we count in the $n = 3$ and $n = 4$ cases.\n\n\n\n:::: {.row layout-ncol=\"2\"}\n::: {}\n{{< video ./count_x2y3.mp4 >}}\n\n$$2x + y = 3$$\n:::\n\n::: {}\n{{< video ./count_x3y4.mp4 >}}\n\n$$3x + y = 4$$\n:::\n::::\n\nThe pattern produced is similar to the one from dibinary.\nHowever, the triangular pattern no longer grows all at once, and instead, the bottom leads the top.\nMeanwhile, the disordered part in the upper left of the expansion appears to grow larger as *n* increases,\n not to mention that it contains many artifacts from smaller colors.\n\nThe slope of the pattern is $1 / (n - 1)$, since this is the ratio of growth between *x* and *y*.\nAs *n* grows, the diagonal pattern gets thinner and takes longer to show up.\nThis is because the size of the alphabet causing expansions to shrink *geometrically*, while the digital\n root is always increasing *arithmetically*.\nThe binary alphabet is the smallest possible, so the minimal shrinkage is in dibinary.\n\n\n### Incremented Curves\n\nBelow are some incremented curves for $n = 3$.\nThese curves show an interesting phenomenon: an extra line is present in in the expansion of six.\nThis line turns into a spike at twelve, then at fifteen, it seems to grow to encompass the point at infinity.\n\n::: {#7233ad25 .cell layout-ncol='2' execution_count=8}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n:::\n\n\nLeaves in the Mirror\n--------------------\n\nAlgebraic curves are not my forte.\nStill, we can very briefly look at some classical examples from the perspective of carries.\n\n\n### Quadratic Curves\n\nUnfortunately, the most common quadratic curves are largely uninteresting.\nBriefly, here are some comments about some the simplest cases:\n\n- Unit circle ($x^2 + y^2 - 1 = 0$) and hyperbola ($\\pm x^2 \\mp y^2 - 1 = 0$)\n - The sum of coefficients is positive, which means that expansions are unbounded.\n - Alternatively, coefficients are of an improper form, since one positive coefficient\n does not outweigh all remaining negative coefficients.\n - The curve as a function in *x* and *y* can be written in simpler terms, i.e., $F(x, y) = G(x^2, y^2)$\n- Hyperbola ($xy \\pm 1 = 0$)\n - The curve is a function of only *xy*, i.e., $F(x, y) = P(xy)$,\n so the curve degenerates to one-dimensional unary.\n- Parabolae ($y = \\pm x^2,~ x = \\pm y^2$)\n - One coefficient does not outweigh the other.\n - The system degenerates to a single dimeension due to the fact that either *y* is a polynomial in *x* or vice versa\n\nOther polynomials in *x* and *y* may produce rotations or dilations of these curves,\n but the key fact is that this interpretation is secondary.\nWhat truly matters is that one cell affects relatively close cells in a certain way.\n\n\n### Higher-Order Curves\n\nAll unit Fermat curves $x^n + y^n = 1$ are not suitable as carries, since their digital root is unbounded.\nScaling up the curve, for example to $x^n + y^n = 2$, will just degenerate back to the previous\n examples with lines, but spaced out by zeros between entries.\n\nThe [folium of Descartes](https://en.wikipedia.org/wiki/Folium_of_Descartes) is another\n classical curve that played a role in the development of calculus, described by the equation:\n\n$$\n\\begin{gather*}\n x^3 + y^3 - 3axy = 0\n \\\\ \\\\\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & -3a \\\\\n 0 & \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nAs written above, the position of the 3*a* term may be confusing.\nAs the negative term in an explicit carry, we must place it atop the digit we are carrying,\n meaning that expansions will propagate toward negative powers of *x* and *y* as well as positive.\nWhile the shape of the curve is different from an ordinary line, the coefficients are arranged\n too similarly; for $a = 2/3$ (so the curve passes through the point $(1, 1)$) incrementing appears as:\n\n:::: {.row layout-ncol=\"2\"}\n\n::: {#a034e9c1 .cell execution_count=9}\n\n::: {.cell-output .cell-output-display .cell-output-markdown}\n\\begin{gather*}2: &\\begin{array}{c|cc}0 & 0 & 0 & 1 \\\\ \\hline 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 \\\\ 1 & 0 & 0 & 0 \\\\ \\end{array}\\\\\\\\ \\\\ 4: &\\begin{array}{cc|cccc}0 & 0 & 0 & 0 & 0 & 0 & 1 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ \\hline 0 & 0 & 0 & 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\\\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ \\end{array}\\\\\\end{gather*}\n:::\n:::\n\n\n{{< video ./count_folium.mp4 >}}\n::::\n\nClearly, this also tends back toward dibinary, but with the yellow digits spaced out more.\n\n\nLaplace's Sandstorm\n-------------------\n\nAs stated previously, polynomials naturally multiply by convolution.\nIn the context of this operation, the discrete 2D Laplacian is frequently used\nWhile commonly presented as a matrix, it has very little to do with the machinery of\n linear algebra which normally empowers matrices.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{gather*}\n \\begin{bmatrix}\n 0 & 1 & 0 \\\\\n 1 & -4 & 1 \\\\\n 0 & 1 & 0\n \\end{bmatrix} ~\\implies~\n \\begin{array}{c|cc}\n & 1 & \\\\ \\hline\n 1 & -4 & 1 \\\\\n & 1\n \\end{array} \\\\ \\\\\n x + x^{-1} + y + y^{-1} - 4 = 0 \\\\\n x + xy^2 + y + yx^2 - 4xy = 0\n\\end{gather*}\n$$\n\n::: {#f66b7676 .cell execution_count=10}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=469}\n:::\n:::\n\n\n:::\n\nFrom the above, it is clear that this is a cubic curve.\nAside from the trivial solution $x = y = 0$ (which obviously also satisfies *x* = *y*),\n the curve made by the carry does not intersect either axis.\nThere is an additional isolated point at (1, 1), implying some is in unary-ness this system.\nIf we make it a carry, then the first few powers of 4 are\n\n$$\n\\begin{matrix}\n 1 & ... & 4 & ... & 16 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} & ... &\n \\begin{array}{c|cc}\n 0 & 1 & 0 \\\\ \\hline\n 1 & 0 & 1 \\\\\n 0 & 1 &\n \\end{array} & ... &\n \\begin{array}{c|cc}\n 0 & 4 & 0 \\\\ \\hline\n 4 & 0 & 4 \\\\\n 0 & 4 &\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{cc|cc}\n & & 1 \\\\\n & 2 & 0 & 2 \\\\ \\hline\n 1 & 0 & 4 & 0 & 1 \\\\\n & 2 & 0 & 2 \\\\\n & & 1\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{cc|cc}\n & & 1 \\\\\n & 2 & 1 & 2 \\\\ \\hline\n 1 & 1 & 0 & 1 & 1 \\\\\n & 2 & 1 & 2 \\\\\n & & 1\n \\end{array}\n\\end{matrix}\n$$\n\nAs the negative (and largest) term, we carry at the \"4\" entry, as shown above.\nTerms progress along lower and higher powers of *x* and *y*.\nHowever, rather than just rightward propagation interfering with downward propagation (and vice versa),\n all directions can interfere with each other.\n\nThis system can be interpreted more naturally as a\n [sandpile](https://en.wikipedia.org/wiki/Abelian_sandpile_model).\nAs a cellular automaton, it is rather popular as a coding challenge\n ([video by The Coding Train](https://www.youtube.com/watch?v=diGjw5tghYU)),\n and when the grid is finite, certain subsets of all possible elements form finite groups under addition\n ([video by Numberphile](https://www.youtube.com/watch?v=1MtEUErz7Gg)).\nThese videos discuss toppling the initial value, but do not point out the analogy to polynomial expansions.\n\n\n\n:::: {.row .text-center }\n::: {.column width=\"60%\"}\n{{< video ./count_laplace.mp4 >}}\n:::\n::::\n\nThe shapes produced by this pattern are well-known, with larger numbers appearing as fractals.\nGenerally, the expansions are enclosed within a circle, with shrinking triangular looking sections.\nThis is eerily similar to the same shrinking triangles which appear in other unary-like carries.\n\n\nClosing\n-------\n\nAll of the 2D carries presented here are explicit carries.\nUnlike phinary, they have no additional rules hidden in mutliples of the carry.\nIt seems to be the case that implicit carries in two variables can be found by\n selecting a cyclotomic polynomial (in *x*, *y*, and $x + y$)\n and computing an explicit carry by multiplying it with another polynomial.\nSome of my investigations into this topic are available [here](../cell2).\n\nI should also mention that my notational inspiration for arranging digits things in\n a 2D array is Norman Wildberger's variable-free approach to\n \"[bipolynumbers](https://www.youtube.com/watch?v=_9FvrO1JTTI)\", a term he uses\n to refer to polynomials of two variables.\n\nJust as learning to count on polynomials in a single variable opens up a world of possibilities,\n learning to count on those in two variables is a perplexing topic that is worth exploring.\n\n",
+ "markdown": "---\ntitle: \"Counting in 2D, Part 1: Lines, Leaves, and Sand\"\ndescription: |\n An introduction to two-dimensional counting using polynomials of two variables.\nformat:\n html:\n html-math-method: katex\ndate: \"2021-02-23\"\ndate-modified: \"2025-02-20\"\njupyter: python3\ncategories:\n - algebra\n - sandpile\n - python\nexecute:\n echo: false\n---\n\n\n\n\n\nPreviously, I've written about positional systems and so-called \"[polynomial counting](../1)\".\nBasically, this generalizes familiar integer bases like two and ten into less familiar irrational ones\n like the golden ratio.\nHowever, all systems I presented have something in common: they all use polynomials of a single variable.\nDoes it make sense to count in two variables?\n\n\nPreliminaries\n-------------\n\nBefore proceeding, I'll summarize some desired characteristics of polynomials which can be\n used as carries in positional systems.\n\nCarry polynomials must be nonpositive when evaluated at 1 (otherwise the digital root of\n an expansion is unbounded).\nMoreover, to make things easier, either:\n\n- All coefficients have the same sign but one, which has a much larger\n magnitude than the rest (and forces the digital root condition)\n - These are *explicit* irrational carries\n- They are monic (have leading coefficient 1) and the remaining coefficients are all negative\n and monotonically increase toward 0 after the second coefficient (0's are allowed anywhere)\n - These are *implicit* irrational carries\n\nIn previous systems, it was discovered that implicit carries can be multiplied,\n typically by cylotomic polynomials, to obtain explicit rules for larger numerals.\n\n\nA Game of Che...ckers\n---------------------\n\n[Conway's checkers](https://en.wikipedia.org/wiki/Conway%27s_Soldiers) is a game played by attempting to\n advance game pieces to the furthest extent beyond a line.\nA piece can only be moved by jumping it horizontally or vertically over others, which removes them from play.\nSquinting hard enough, in one dimension, this is similar to how in phinary, a \"1\" in an\n expansion can jump over an adjacent \"1\" to its left.\n\n$$\n\\begin{array}{}\n \\bullet \\\\ \\hline \\bullet \\\\ \\hline \\vphantom{\\bullet}\n\\end{array} \\huge⤸ \\normalsize\n~\\longrightarrow~\n\\begin{array}{}\n \\vphantom{\\bullet} \\\\ \\hline \\vphantom{\\bullet} \\\\ \\hline \\bullet\n\\end{array}\n\\quad \\iff \\quad\n0\\textcolor{red}{11} = \\textcolor{red}{1}00\n$$\n\nIn fact, it is exactly the same.\nThe best solution of the game relies on a geometric series in *φ*, as seen in\n [this video by Numberphile](https://www.youtube.com/watch?v=Or0uWM9bT5w).\n\n\n### Pairs of Checkers\n\nTo actually take phinary and systems like it from 1D to 2D, we really just need a carry rule that respects the\n second dimension.\nTo do this, we use a new variable *y* and invent a carry rule based on it.\n\nThe smallest way to extend our one-dimensional string of digits is do just introduce a second string.\nBased on this, my intuition was to replace the standard hop with the movement of a knight in chess.\n\n$$\n\\begin{gather*}\n \\begin{array}{c|c}\n \\bullet & \\phantom{\\bullet} \\\\\n \\hline \\bullet \\\\ \\hline \\vphantom{\\bullet}\n \\end{array}\n ~\\longrightarrow~\n \\begin{array}{c|c}\n \\phantom{\\bullet} & \\phantom{\\bullet} \\\\\n \\hline \\\\ \\hline & \\bullet\n \\end{array}\n ~~ \\iff ~~\n \\left. \\begin{array}{}\n 0\\textcolor{red}{11}_x \\\\\n 000_y\n \\end{array} \\right]\n = \\left. \\begin{array}{}\n 000_x \\\\\n \\textcolor{red}{1}00_y\n \\end{array} \\right ] \\\\ \\\\\n y^2 = x + 1,~ x^2 = y + 1\n\\end{gather*}\n$$\n\nThis looks good on the surface, but it turns out that the polynomials aren't sufficiently intertwined.\nSince each variable is a function of the other, they can easily be coaxed into a single polynomial:\n\n$$\ny = x^2 - 1 \\longrightarrow y^2 = (x^2 - 1)^2 = x + 1 \\\\[6pt]\nx^4 - 2x^2 + 1 = x + 1 \\\\\nx^3 - 2x - 1 = 0 \\\\\n(x + 1)(x^2 - x - 1) = 0\n$$\n\nThe same argument applies symmetrically for *y*.\nOne of the resultant polynomials is the minimal polynomial of *φ*, so the prospective\n 2D system reduces back to standard phinary.\n\nThere are additional problems with this \"pairs of strings\" model.\nFor example, terms like *xy* never appear, and there is no way to represent them by just using two strings.\nAlso, both sequences have a ones' place, but should agree that $x^0 = y^0 = 1$.\n\n\nBuilding the Plane\n------------------\n\nIf it is the case that both powers of variables should share the one's digit, then why not\n join the two strings there?\nIn other words, for each variable, we think of a line with a distinguished point for zero.\nWe then match the distinguished points together.\nThus, instead of a point separator between positive and negative powers,\n the radix point is now a pair of lines that share a vertex.\nFrom this pair of lines, according to Euclid, we can make a plane.\n\n$$\n\\begin{array}{|c}\n \\hline\n f & d & a \\\\\n e & b \\\\\n c\n\\end{array}\n\\begin{matrix} ~\\equiv~\n ax^2 + bxy + cy^2 + dx + ey + f, \\\\\n \\text{the general form of a conic}\n\\end{matrix}\n$$\n\nSince the horizontal and vertical correspond with the *x* and *y* appearing in polynomials,\n it may be easy to confuse this with the *x*- and *y*-axes of the typical Cartesian plane.\nThe key differences here are that these are discrete (two-dimensional) strings, rather than a continuous plane,\n and along each point, there exists a cell in which an integer value lives.\n\n\n### An Arithmetical Aside\n\nExpressed in this way, it is very simple to compute the sum of two polynomials.\nJust like in the 1D system, we can align the one's places, add them together term-by-term, then apply carry rules.\nWith luck, this produces a canonical form.\n\nIt should also be possible to multiply two polynomials together.\nIn a single variable, multiplication is a somewhat involved 1D convolution.\nIn two, it is naturally [2D convolution](https://en.wikipedia.org/wiki/Kernel_(image_processing)),\n an operation typically encountered in image processing and signal analysis.\nI won't bother building up an intuition for this, since it won't be relevant to discussion.\n\nEven if multiplication is difficult, division is always harder.\nIn polynomials of a single variable, we can do synthetic (or long) division.\nNotationally, we work in the direction that the digits do not extend (i.e., downward).\nWith 2D numbers, we have digits in both dimensions.\nFortunately, computer algebra systems can divide and factor polynomials of two variables\n reasonably quickly, so this point is moot if we allow ourselves to use one.\n\n\n1, 2, 3, Takeoff\n----------------\n\nWhere should we start in a world of planar numbers?\nWell, we want to assign an integer to a polynomial with extent in both *x* and *y*.\nThe simplest way to do this is by letting $n = x + y$: when the one's place has\n a magnitude of *n*, it flows into *x* and *y*.\n\nIf $n = 1$, then the sum of coefficients is skewed toward the LHS, and the digital root is unbounded.\nWe had a similar restriction in one dimension.\nTherefore, let $n = 2$.\nThe expansions of the powers of 2 are:\n\n$$\n\\begin{matrix}\n &&\\text{Carry:}&\\begin{array}{|c} \\hline\n -2 & 1 \\\\\n 1\n \\end{array}\\\\\n 1 & 2 & ... & 4 & ... & 8 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} &\n \\begin{array}{|c} \\hline\n 0 & 1 \\\\\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 2 \\\\\n 2\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 4 \\\\\n 4\n \\end{array} \\\\ \\\\ &&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 1 \\\\\n 0 & 0 & 1 \\\\\n 1 & 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 0 & 2 \\\\\n 0 & 0 & 2 \\\\\n 2 & 2\n \\end{array} \\\\ \\\\ &&&&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & 0 & 1 & 1 \\\\\n 0 & 1 & 0 & 1 \\\\\n 1 & 1 & 1\n \\end{array}\n\\end{matrix}\n$$\n\nThe final entry of each column is achieved by applying the carry enough times, reducing all digits\n to \"0\"s and \"1\"s.\nIn doing so, the typical binary expansion is visible along first row and column, albeit reversed.\nThis is always the case, since when the carry is restricted to a single dimension (i.e., let $y = 0$),\n we get the 1D binary carry.\nMore visually, there is no mechanism for the carry to disturb the column and row by spreading either left or up.\nI'll call this system *dibinary*, since it is binary across two variables.\n\nAn additional property of this system is that the number of \"1\"s that appear in the expansion is equal\n to the number itself.\nThese two properties make it a sort of hybrid between unary and binary, bridging their\n binary expansion and its [Hamming weight](https://en.wikipedia.org/wiki/Hamming_weight).\n\nThis notation is very heavy, but fortunately lends itself well to visualization.\nEach integer's expansion is more or less an image, so we can arrange each as frames in a video:\n\n\n\n:::: {.row .text-center }\n::: {.column width=\"60%\"}\n{{< video ./count_xy2.mp4 >}}\n:::\n::::\n\nStarting at the expansion of twelve, the terms extend past the first column and row.\nIt instead grows faster along the diagonal, along which larger triangles appear when\n counting to higher and higher integers.\nMeanwhile, lower degrees (toward the upper left) appear to be slightly less predictable.\n\n\n### Higher *n*\n\nBy incrementing *n*, the expansions of numbers shrink exponentially, and simply incrementing is not fast enough.\nFortunately, this is a simple enough system that we can scalar-multiply base expansions, then assiduously apply the carry.\nAscending the powers of *n* in this manner for the carries where *n* = 3 and 4:\n\n\n\n:::: {.row layout-ncol=\"2\"}\n::: {}\n{{< video ./count_xy3.mp4 >}}\n\n$$x + y = 3$$\n:::\n\n::: {}\n{{< video ./count_xy4.mp4 >}}\n\n$$x + y = 4$$\n:::\n::::\n\nYellow corresponds to the highest allowed numeral, $n - 1$.\nIt seems like the lower-right grows much rounder as *n* increases.\nHowever, neither appears to have an emergent pattern as dibinary did.\n\nYou might be familiar with the way hexadecimal is a more compact version of binary.\nFor example,\n\n$$\\textcolor{red}{1}\\textcolor{blue}{2}_{16} = \\textcolor{red}{0001}\\textcolor{blue}{0010}_{2}$$\n\nbecause both one hexadecimal digit and four binary digits range over zero to fifteen.\nConsequently, by grouping group *m* digits of an expansion in base *b*, one can easily convert to base $b^m$.\n\nIf such a procedure still exists in 2D, applying it somehow destroys the pattern in the $n = 2$ case,\n as the quaternary system is very chaotic.\n\n\nCarry Curves\n------------\n\nSince the carry is a polynomial in both *x* and *y*, it lends itself to interpretation as an algebraic curve.\nTaking *x* or *y* to higher powers will dilate expansions along that axis.\n\nThe carry is not the only curve which exists in a system, as each integer is also a polynomial unto itself.\nAdding a constant term will not change anything unless it causes carries to occur.\nStarting at the carry digit, some of the *incremented curves* made by the carry $x + y = 2$ are shown below.\n\n::: {#d66886e3 .cell layout='[[3,3],[2,2,2]]' execution_count=5}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n:::\n\n\nIn each of these figures, the line is the curve which corresponds to the carry polynomial.\nAlong with it, while counting, additional shapes like hyperbolae seem to appear and disappear,\n only to be replaced with higher-order curves.\nThese higher order curves can be difficult to graph, so they show up as thicker lines.\nAt sixty-four, it appears as though the reflection of the carry across the origin\n (the curve $x + y = -2$) \"wants\" to appear.\n\nThe continued presence of the original carry curve in larger integers suggests that\n the points it passes through are important.\nThis curve happens to intersect with the *x* and *y* axes, which we can interpret as the \"base\"\n with respect to a single variable.\nFor dibinary, these are the aforementioned \"typical binary expansions\".\nWe can also evaluate the polynomial at $(x, y) = (1, 1)$, a point on the carry curve,\n to compute its digital root, which is also equal to the integer it represents.\nThis underlies a key difference from the 1D case.\n1D systems are special because the carry can be equated with a base (or bases), which\n is a discrete, zero-dimensional point (one dimension less) on a number line.\nIn higher dimensions, all points on the carry curve (or hypersurface) are \"bases\" we can plug in\n to test that an expansion is valid.\nThis makes naming much harder, since there are no preferred numbers to represent the system,\n like the golden ratio does with phinary.\n\n\nCasting the Line\n----------------\n\nWe may want to extend the \"unary\" property to other carries.\nTo do this, we construct a curve which passes through $(1, 1)$.\n\nLines of the form $(n - 1)x + y = n$ trivially satisfy this relationship.\nFurther, while the digits along the *y* column will be expansions of base *n*, those along *x* will\n be in base $n / (n - 1)$.\n\nFor example, for $n = 3$\n\n$$\n\\begin{matrix}\n &&&\\text{Carry:}&\n \\begin{array}{|c} \\hline\n -3 & 2 \\\\\n 1\n \\end{array}\\\\\n 1 & ... & 3 & ... & 6 & ... & 9 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 2 \\\\\n 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 4 \\\\\n 2\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 6 \\\\\n 3\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{|c} \\hline\n 0 & 1 & 2 \\\\\n 2 & 1\n \\end{array} & ... &\n \\begin{array}{|c} \\hline\n 0 & 3 & 2 \\\\\n 3 & 1\n \\end{array} \\\\ \\\\ &&&&&&\n \\begin{array}{|c} \\hline\n 0 & 0 & 1 & 2 \\\\\n 0 & 1 & 0 & 2 \\\\\n 1 & 1 & 1\n \\end{array}\n\\end{matrix}\n$$\n\nThe expansion in the *y* column looks trivially correct, since $y^2 = 9$ when $x = 0$.\nWe can check the base of the expansion of nine (\"2100\") by factoring a polynomial:\n\n::: {#0aef62ff .cell execution_count=6}\n\n::: {.cell-output .cell-output-display .cell-output-markdown}\n$\\displaystyle 2 x^{3} + x^{2} - 9 = \\left(2 x - 3\\right) \\left(x^{2} + 2 x + 3\\right)$\n:::\n:::\n\n\nThe linear polynomial has 3/2 as a root, while the quadratic one has only complex roots.\n\nNaturally, these expansions work symmetrically by considering *y* to have the $n - 1$ coefficient instead of *x*.\nThis transposes the carry (and hence the expansion).\n\n\n### Slanted Counting\n\nFor good measure, let's see what it looks like when we count in the $n = 3$ and $n = 4$ cases.\n\n\n\n:::: {.row layout-ncol=\"2\"}\n::: {}\n{{< video ./count_x2y3.mp4 >}}\n\n$$2x + y = 3$$\n:::\n\n::: {}\n{{< video ./count_x3y4.mp4 >}}\n\n$$3x + y = 4$$\n:::\n::::\n\nThe pattern produced is similar to the one from dibinary.\nHowever, the triangular pattern no longer grows all at once, and instead, the bottom leads the top.\nMeanwhile, the disordered part in the upper left of the expansion appears to grow larger as *n* increases,\n not to mention that it contains many artifacts from smaller colors.\n\nThe slope of the pattern is $1 / (n - 1)$, since this is the ratio of growth between *x* and *y*.\nAs *n* grows, the diagonal pattern gets thinner and takes longer to show up.\nThis is because the size of the alphabet causing expansions to shrink *geometrically*, while the digital\n root is always increasing *arithmetically*.\nThe binary alphabet is the smallest possible, so the minimal shrinkage is in dibinary.\n\n\n### Incremented Curves\n\nBelow are some incremented curves for $n = 3$.\nThese curves show an interesting phenomenon: an extra line is present in in the expansion of six.\nThis line turns into a spike at twelve, then at fifteen, it seems to grow to encompass the point at infinity.\n\n::: {#7233ad25 .cell layout-ncol='2' execution_count=8}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n\n::: {.cell-output .cell-output-display}\n{width=662 height=470}\n:::\n:::\n\n\nLeaves in the Mirror\n--------------------\n\nAlgebraic curves are not my forte.\nStill, we can very briefly look at some classical examples from the perspective of carries.\n\n\n### Quadratic Curves\n\nUnfortunately, the most common quadratic curves are largely uninteresting.\nBriefly, here are some comments about some the simplest cases:\n\n- Unit circle ($x^2 + y^2 - 1 = 0$) and hyperbola ($\\pm x^2 \\mp y^2 - 1 = 0$)\n - The sum of coefficients is positive, which means that expansions are unbounded.\n - Alternatively, coefficients are of an improper form, since one positive coefficient\n does not outweigh all remaining negative coefficients.\n - The curve as a function in *x* and *y* can be written in simpler terms, i.e., $F(x, y) = G(x^2, y^2)$\n- Hyperbola ($xy \\pm 1 = 0$)\n - The curve is a function of only *xy*, i.e., $F(x, y) = P(xy)$,\n so the curve degenerates to one-dimensional unary.\n- Parabolae ($y = \\pm x^2,~ x = \\pm y^2$)\n - One coefficient does not outweigh the other.\n - The system degenerates to a single dimeension due to the fact that either *y* is a polynomial in *x* or vice versa\n\nOther polynomials in *x* and *y* may produce rotations or dilations of these curves,\n but the key fact is that this interpretation is secondary.\nWhat truly matters is that one cell affects relatively close cells in a certain way.\n\n\n### Higher-Order Curves\n\nAll unit Fermat curves $x^n + y^n = 1$ are not suitable as carries, since their digital root is unbounded.\nScaling up the curve, for example to $x^n + y^n = 2$, will just degenerate back to the previous\n examples with lines, but spaced out by zeros between entries.\n\nThe [folium of Descartes](https://en.wikipedia.org/wiki/Folium_of_Descartes) is another\n classical curve that played a role in the development of calculus, described by the equation:\n\n$$\n\\begin{gather*}\n x^3 + y^3 - 3axy = 0\n \\\\ \\\\\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & -3a \\\\\n 0 & \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nAs written above, the position of the 3*a* term may be confusing.\nAs the negative term in an explicit carry, we must place it atop the digit we are carrying,\n meaning that expansions will propagate toward negative powers of *x* and *y* as well as positive.\nWhile the shape of the curve is different from an ordinary line, the coefficients are arranged\n too similarly; for $a = 2/3$ (so the curve passes through the point $(1, 1)$) incrementing appears as:\n\n:::: {.row layout-ncol=\"2\"}\n\n::: {#a034e9c1 .cell execution_count=9}\n\n::: {.cell-output .cell-output-display .cell-output-markdown}\n\\begin{gather*}2: &\\begin{array}{c|cc}0 & 0 & 0 & 1 \\\\ \\hline 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 \\\\ 1 & 0 & 0 & 0 \\\\ \\end{array}\\\\\\\\ \\\\ 4: &\\begin{array}{cc|cccc}0 & 0 & 0 & 0 & 0 & 0 & 1 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ \\hline 0 & 0 & 0 & 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\\\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\ \\end{array}\\\\\\end{gather*}\n:::\n:::\n\n\n{{< video ./count_folium.mp4 >}}\n::::\n\nClearly, this also tends back toward dibinary, but with the yellow digits spaced out more.\n\n\nLaplace's Sandstorm\n-------------------\n\nAs stated previously, polynomials naturally multiply by convolution.\nIn the context of this operation, the discrete 2D Laplacian is frequently used\nWhile commonly presented as a matrix, it has very little to do with the machinery of\n linear algebra which normally empowers matrices.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{gather*}\n \\begin{bmatrix}\n 0 & 1 & 0 \\\\\n 1 & -4 & 1 \\\\\n 0 & 1 & 0\n \\end{bmatrix} ~\\implies~\n \\begin{array}{c|cc}\n & 1 & \\\\ \\hline\n 1 & -4 & 1 \\\\\n & 1\n \\end{array} \\\\ \\\\\n x + x^{-1} + y + y^{-1} - 4 = 0 \\\\\n x + xy^2 + y + yx^2 - 4xy = 0\n\\end{gather*}\n$$\n\n::: {#f66b7676 .cell execution_count=10}\n\n::: {.cell-output .cell-output-display}\n{width=662 height=469}\n:::\n:::\n\n\n:::\n\nFrom the above, it is clear that this is a cubic curve.\nAside from the trivial solution $x = y = 0$ (which obviously also satisfies *x* = *y*),\n the curve made by the carry does not intersect either axis.\nThere is an additional isolated point at (1, 1), implying some is in unary-ness this system.\nIf we make it a carry, then the first few powers of 4 are\n\n$$\n\\begin{matrix}\n 1 & ... & 4 & ... & 16 \\\\\n \\begin{array}{|c} \\hline\n 1\n \\end{array} & ... &\n \\begin{array}{c|cc}\n 0 & 1 & 0 \\\\ \\hline\n 1 & 0 & 1 \\\\\n 0 & 1 &\n \\end{array} & ... &\n \\begin{array}{c|cc}\n 0 & 4 & 0 \\\\ \\hline\n 4 & 0 & 4 \\\\\n 0 & 4 &\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{cc|cc}\n & & 1 \\\\\n & 2 & 0 & 2 \\\\ \\hline\n 1 & 0 & 4 & 0 & 1 \\\\\n & 2 & 0 & 2 \\\\\n & & 1\n \\end{array} \\\\ \\\\ &&&&\n \\begin{array}{cc|cc}\n & & 1 \\\\\n & 2 & 1 & 2 \\\\ \\hline\n 1 & 1 & 0 & 1 & 1 \\\\\n & 2 & 1 & 2 \\\\\n & & 1\n \\end{array}\n\\end{matrix}\n$$\n\nAs the negative (and largest) term, we carry at the \"4\" entry, as shown above.\nTerms progress along lower and higher powers of *x* and *y*.\nHowever, rather than just rightward propagation interfering with downward propagation (and vice versa),\n all directions can interfere with each other.\n\nThis system can be interpreted more naturally as a\n [sandpile](https://en.wikipedia.org/wiki/Abelian_sandpile_model).\nAs a cellular automaton, it is rather popular as a coding challenge\n ([video by The Coding Train](https://www.youtube.com/watch?v=diGjw5tghYU)),\n and when the grid is finite, certain subsets of all possible elements form finite groups under addition\n ([video by Numberphile](https://www.youtube.com/watch?v=1MtEUErz7Gg)).\nThese videos discuss toppling the initial value, but do not point out the analogy to polynomial expansions.\n\n\n\n:::: {.row .text-center }\n::: {.column width=\"60%\"}\n{{< video ./count_laplace.mp4 >}}\n:::\n::::\n\nThe shapes produced by this pattern are well-known, with larger numbers appearing as fractals.\nGenerally, the expansions are enclosed within a circle, with shrinking triangular looking sections.\nThis is eerily similar to the same shrinking triangles which appear in other unary-like carries.\n\n\nClosing\n-------\n\nAll of the 2D carries presented here are explicit carries.\nUnlike phinary, they have no additional rules hidden in mutliples of the carry.\nIt seems to be the case that implicit carries in two variables can be found by\n selecting a cyclotomic polynomial (in *x*, *y*, and $x + y$)\n and computing an explicit carry by multiplying it with another polynomial.\nSome of my investigations into this topic are available [here](../cell2).\n\nI should also mention that my notational inspiration for arranging digits things in\n a 2D array is Norman Wildberger's variable-free approach to\n \"[bipolynumbers](https://www.youtube.com/watch?v=_9FvrO1JTTI)\", a term he uses\n to refer to polynomials of two variables.\n\nJust as learning to count on polynomials in a single variable opens up a world of possibilities,\n learning to count on those in two variables is a perplexing topic that is worth exploring.\n\n",
"supporting": [
"index_files"
],
diff --git a/_freeze/posts/polycount/sand-2/index/execute-results/html.json b/_freeze/posts/polycount/sand-2/index/execute-results/html.json
index d367d46..aaa67d6 100644
--- a/_freeze/posts/polycount/sand-2/index/execute-results/html.json
+++ b/_freeze/posts/polycount/sand-2/index/execute-results/html.json
@@ -1,16 +1,12 @@
{
- "hash": "0bcc4b142e90ea1913bb3db934dc2a51",
+ "hash": "aedf4d163403b2bc105f164dc4636db9",
"result": {
"engine": "jupyter",
- "markdown": "---\ntitle: \"Counting in 2D 2: Reorienting Polynomials\"\ndraft: true\nformat:\n html:\n html-math-method: katex\ndate: \"2021-03-07\"\ndate-modified: \"2025-02-23\"\njupyter: python3\ncategories:\n - algebra\n - python\nexecute:\n echo: false\n---\n\n\n\n[Previously](../cell1), I explored some very basic 2D counting systems, which turned out to include sandpiles.\nAs the name suggests, these planar numbers require a discrete grid of numbers to contain them.\nWhat follows is a deeper investigation into this natural extension of positional systems.\n\n\nDirection of Propagation\n------------------------\n\nGiven a carry (expressed as a polynomial in two variables or a grid) and an increasing sequence of integers,\n the expansions of the sequence will appear to propagate in a certain direction.\nRecall that from the last post, we know that $x + y = 2$ and a certain case of\n the folium of Descartes will make similar patterns:\n\n$$\n\\begin{gather*}\n & ~ & \\text{Folium} \\\\\n x + y - 2 & ~ &\n x^3 + y^3 - 2xy \\\\\n \\begin{array}{|c} \\hline\n \\bar{2} & 1 \\vphantom{2^{2^2}} \\\\\n 1\n \\end{array} & ~ &\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{2} \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nThe general direction in which we carry can be understood as the directions from the negative term of the carry\n (hereafter *pseudo-base*) to the other terms.\nThese can interpreted vectors extending from the pseudo-base to every other term.\nThe simplest way to get these vectors is by placing the pseudo-base at the constant position\n and reading off the exponent of the other terms.\n\n$$\n\\begin{gather*}\n \\begin{array}{|c} \\hline\n \\bar{2} & \\textcolor{red}{1} \\vphantom{2^{2^2}} \\\\\n \\textcolor{blue}{1}\n \\end{array} & ~ &\n \\begin{array}{c|cc}\n 0 & 0 & 0 & \\textcolor{red}{1} \\\\ \\hline\n 0 & \\bar{2} \\vphantom{2^{2^2}} \\\\\n 0 \\\\\n \\textcolor{blue}{1}\n \\end{array} \\\\\n \\begin{matrix}\n \\textcolor{red}{ x^1 y^0 } \\implies \\langle 1, 0 \\rangle \\\\\n \\textcolor{blue}{ x^0 y^1 } \\implies \\langle 0, 1 \\rangle\n \\end{matrix}\n & ~ &\n \\begin{matrix}\n \\textcolor{red}{ x^2 y^{-1} } \\implies \\langle 2, -1 \\rangle \\\\\n \\textcolor{blue}{ x^{-1} y^2 } \\implies \\langle -1, 2 \\rangle\n \\end{matrix}\n\\end{gather*}\n$$\n\nIt is clear that as we count, the expansions can extend only in a linear combination of these vectors.\nHowever, they cannot propagate in the reverse direction, as there is no sense of \"backwards\".\n\n\n### Balancing Act\n\nWe can naively balance the carry by adding additional carry digits.\nTo do this, we just need to double the pseudo-base and add reflections each vector in it.\nEquivalently, this adds the carry with the carry where we have replaced *x* and *y* with their reciprocals.\n\nIf we balance the left carry, it yields the Laplacian.\nBut what about the right?\nUnsurprisingly, it just stretches the expansions along the different \"basis\" vectors.\n\n::: {layout-ncol=\"2\"}\n$$\n\\textcolor{red}{ x^{-2} y^{1} } + x^{-1} y^{2} + \\textcolor{blue}{ x^{1} y^{-2} } + x^{2} y^{-1} - 4 \\\\\n\\begin{array}{cc|ccc}\n & & & \\textcolor{blue}{1} \\\\\n & & 0 & 0 & 1 \\\\ \\hline\n & 0 & \\bar{4} & 0 \\vphantom{2^{2^2}} \\\\\n \\textcolor{red}{1} & 0 & 0 \\\\\n & 1\n\\end{array} \\\\\n\\text{Added Vectors:} \\\\\n\\begin{matrix}\n \\textcolor{red}{\n \\langle -2, 1 \\rangle\n } \\\\\n \\textcolor{blue}{\n \\langle 1, -2 \\rangle\n }\n\\end{matrix}\n$$\n\n::: {#1a344523 .cell execution_count=2}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\n\n### Half-Balanced\n\nThe Laplacian carry is remarkably balanced, but it provokes the question of what the expansions\n look like if there are only three directions to propagate.\nThe intuition from above says that it should span a half-plane,\n up from the quarter-plane that $x + y = 2$ spans.\n\n::: {layout-ncol=\"2\"}\n$$\n\\textcolor{red}{ x^{-1} } + x^1 + y^1 - 3 \\\\\n\\begin{array}{c|cc} \\hline\n \\textcolor{red}{1} & \\bar{3} & 1 \\vphantom{2^{2^2}} \\\\\n 0 & 1 & 0\n\\end{array} \\\\\n\\text{Added Vector:} \\\\\n\\begin{matrix}\n \\textcolor{red}{\n \\langle -1, 0 \\rangle\n }\n\\end{matrix}\n$$\n\n::: {#07b96ab2 .cell execution_count=3}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\nFortunately, this is the case.\n\n\n### 2D Carry Types\n\nBased on the extent of the vectors, in general there appear to be four classes:\n\n1. The degenerate one-dimensional case\n - The carry is equivalent to the product of a polynomial in a single variable and any power *x* and/or *y*.\n2. Quarter-planes, like $x + y = 2$\n - Arise when the inverses of the vectors are inaccessible.\n3. Half-planes, like the above \"semi-\"Laplacian\n - Arise when two vectors are collinear and point in opposite directions,\n but every other vector is either on one side of this line or are also collinear.\n4. Full planes, like the Laplacian\n - Arise when the inverses of both vectors are accessible.\n\nQuarter-plane is a bit of a misnomer.\nTechnically, the fraction of the plane spanned is between 0 and 1/2 noninclusive\n (as these bounds correspond to the previous and next cases respectively).\nFor example, $x + y = 2$ actually to a quarter-plane, as the first row/column\n (which contain binary expansions) are unbounded.\nHowever, the Folium encompasses slightly more of the plane, or...\n\n$$\n\\frac{1}{2\\pi}\\arccos \\left (\n \\frac{\\langle 2, -1 \\rangle \\cdot \\langle -1, 2 \\rangle}\n {\\| \\langle 2, -1 \\rangle \\| \\| \\langle -1, 2 \\rangle \\|}\n\\right)\n= \\frac{1}{2\\pi} \\arccos \\left ( -\\frac 4 5 \\right )\n\\approx 0.397584\n$$\n\n...about 39% of the plane.\nThis is still smaller than the half-plane case.\n\n\nHunting for Implicitness\n------------------------\n\nWith these categories in mind, I would now like to shift focus.\nAll systems discussed thus far have been explicit and irreducible, meaning they are\n not derived from any \"simpler\" implicit rules.\nDo such rules exist, and cam we find any?\n\nAs mentioned previously, in the 1D case, we form explicit carries from implicit ones by\n multiplying the latter by cyclotomic polynomials.\nIt would be convenient if the same were true in two dimensions -- we generate an explicit 2D carry from\n the product of some input polynomial and a cyclotomic polynomial in x and y.\nHowever, I would like to leverage the visual representation used previously,\n since working with coefficients is linear, unintuitive, and most importantly, annoying.\n\n\n\n\nAbove is a screenshot of (my admittedly low-effort) attempt to ameliorate these shortcomings.\nThe left image is clickable, with the coefficients incrementing with left clicks and decrementing with right.\nThe text box controls the second multiplicand in the center image by selecting a cyclotomic polynomial\n and evaluating it with a particular expression.\nThe right image is the product.\n\nIt could obviously be improved by showing the coefficients in the picture and using color to only indicate sign.\nHowever, there is a benefit to hiding coefficients behind solid colors.\nFor instance, I don't need to recognize numerals to pinpoint what the product should look like.\n\n\n### Degenerate Expressions\n\nI have chosen to evaluate the right term (center image) at $x + y$ for a reason.\nChoosing *x* or *y* on their own is a poor decision because they change nothing from the one dimensional case.\nPut another way, when arranged in a grid, the coefficients are all collinear.\nAt first blush, *xy* seems like a decent pick, but it has the exact same problem;\n the line simply extends along the diagonal instead.\n$x/y$ has the same problem, but it is instead collinear along the anti-diagonals.\nWe allow negative exponents for the same reason we can carry at any location in an expansion\n\n::: {#fd74bb7e .cell execution_count=4}\n\n::: {.cell-output .cell-output-display}\n{width=512 height=469}\n:::\n:::\n\n\nIt should go without saying that these are all degenerate, and can only span a line.\nOn the other hand, expressions like the sum of *x* and *y* form triangles, 2D shapes\n from which it is possible to build our goal polynomial.\nSince $x + y$ is symmetric in *x* and *y*, it is expected that the products have a similar sense of symmetry.\n\n\nFirst Results\n-------------\n\n\n\nThe first explicit product I was able to find is above.\nIt can be decomposed as the folium of Descartes, but with an extra term to the upper-left of the pseudo-base.\nThe implicit carry (the left multiplicand) describes the rearrangement of coefficients\n in a backwards L-shape to and from a sparser upside-down L-shape.\nSince the coefficients of this factor sum to zero, it passes through $(1, 1)$.\n\n$$\n\\begin{gather*}\n \\text{Folium} & ~ & \\text{New carry} \\\\\n x^3 + y^3 - 2xy & ~ &\n x^3 + y^3 + 1 - 3xy \\\\\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{2} \\\\\n 0 \\\\\n 1\n \\end{array} & ~ &\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\n\n### Cousin Systems\n\nMy first thought upon seeing this carry was to see what makes counting in this system different\n from its \"neighbors\".\nBy this, I mean moving the $x^3$ and $y^3$ terms further inward and outward.\n\n$$\n\\begin{gather*}\n x + y + 1 - 3xy &\n x^2 + y^2 + 1 - 3xy \\\\\n \\begin{array}{|c} \\hline\n 1 & 1 \\\\\n 1 & \\bar{3} \\\\\n \\end{array} &\n \\begin{array}{|c} \\hline\n 1 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 1\n \\end{array} \\\\\n \\textcolor{red} {x^3 + y^3 + 1 - 3xy} &\n x^4 + y^4 + 1 - 3xy \\\\\n \\textcolor{red} {\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 1\n \\end{array}\n } &\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nAll polynomials besides the one under consideration (highlighted in red) are irreducible.\nThis means that these carries hide no implicit rules, and are as fundamental as the Laplacian or $x + y = 2$.\n\nAnalyzing the carry vectors, it is clear that the pattern produced by each should be different:\n\n$$\n\\begin{gather*}\n x^{-1} y^{0} + x^{-1} y^{-1} + x^{0} y^{-1} - 3 &\n x^{-1} y^{1} + x^{-1} y^{-1} + x^{1} y^{-1} - 3 \\\\\n \\begin{matrix}\n \\langle -1, 0 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 0, -1 \\rangle\n \\end{matrix} &\n \\begin{matrix}\n \\langle -1, 1 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 1, -1 \\rangle\n \\end{matrix} \\\\\n x^{-1} y^{2} + x^{-1} y^{-1} + x^{2} y^{-1} - 3 &\n x^{-1} y^{3} + x^{-1} y^{-1} + x^{3} y^{-1} - 3 \\\\\n \\begin{matrix}\n \\langle -1, 2 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 2, -1 \\rangle\n \\end{matrix} &\n \\begin{matrix}\n \\langle -1, 3 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 3, -1 \\rangle\n \\end{matrix} \\\\\n\\end{gather*}\n$$\n\nThe vectors in the top-left carry contain only negative numbers, so it will tend toward\n the quarter-plane case like $x + y = 2$.\nIn the top-right carry, all vectors are equidistant and meet at right (and straight) angles.\nThis means that it is a 45° rotation of the altered Laplacian, which spans a half-plane.\nThe remaining two should both propagate into the full plane. Is this reflected in the counting videos?\n\n::: {}\n\n::: {#81ce8e2b .cell execution_count=5}\n\n::: {.cell-output .cell-output-display execution_count=5}\n```{=html}\n\n```\n:::\n:::\n\n\nCounting in each of the $x^n + y^n + \\ldots$ systems\n:::\n\nIndeed it is.\nHowever, while the discovered carry remarkably remains centered, the final one tends more toward\n propagating to the lower right.\nIt has somehow exceeded a threshold that the centered one has not.\n\nIncidentally, the L-shapes in the implicit carry (which I noted can be interchanged) never turn up,\n and the \"initial rule\" is useless.\nPhinary, the simplest implicit case in one dimension, still requires the initial rule to go\n from the expansion of 2 (10.01) to 3 (100.01).\n\n\nIsosceles Rotations\n-------------------\n\nOne of the similar carries is a rotation of a pattern we were already familiar with,\n like the folium was to $x + y = 2$\nDoes this mean we can rotate the centered pattern?\nIf so, is will the carry polynomial still be factorable?\n\nNaively, the following carry might look similar...\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & & \\textcolor{red}{1} \\\\\n & & \\bar{3} \\\\\n \\textcolor{green}{1} & & & & \\textcolor{blue}{1}\n \\end{array} \\\\\n \\begin{matrix}\n \\textcolor{red}{\\langle 0,-1 \\rangle} \\\\\n \\textcolor{green}{\\langle -2,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 2,1 \\rangle} \\\\\n \\text{Angle to top} \\approx 116°\n\\end{matrix}\n$$\n\n::: {#29e1bff4 .cell execution_count=6}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\nBut there are only even numbers in the first component of each vector\nTherefore, the carry below will produce the same pattern.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & \\textcolor{red}{1} \\\\\n & \\bar{3} \\\\ \\textcolor{green}{1}\n && \\textcolor{blue}{1}\n\\end{array} \\\\\n\\begin{matrix}\n \\textcolor{red}{\\langle 0,-1 \\rangle} \\\\\n \\textcolor{green}{\\langle -1,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 1,1 \\rangle} \\\\\n \\text{Angle to top} = 135°\n\\end{matrix}\n$$\n\n::: {#43fb037d .cell execution_count=7}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\nNeither of these are similar to the original.\nFor comparison, the largest angle in the nonrotated case is ~108°.\nIn fact, the shape is much closer to the similar orientation with $x^4 + y^4 + \\ldots$ terms.\n\n\n### Checking Magnitudes\n\nMeasuring these quantities as angles is a bit of a lie.\nSince all of these triangles are isosceles, two of the vectors have equal magnitude.\nFurther, each can be characterized by the ratio between them and the final vector's magnitude.\nThe previous two triangles have ratio:\n\n$$\n\\\\\n\\frac{m_1}{n_1} =\n\\frac{\\| \\langle -2, -1 \\rangle \\|}{\\| \\langle 0, -1 \\rangle \\|} =\n\\frac{\\sqrt 5}{1} =\n\\sqrt 5\n\\\\\n\\frac{m_2}{n_2} =\n\\frac{\\| \\langle -1, -1 \\rangle \\|}{\\| \\langle 0, -1 \\rangle \\|} =\n\\frac{\\sqrt 2}{1} =\n\\sqrt 2\n$$\n\nThe triangle we are trying to rotate has ratio:\n\n$$\n\\frac{m}{n} =\n\\frac{\\| \\langle 2, -1 \\rangle \\|}{\\| \\langle -1, -1 \\rangle \\|} =\n\\frac{\\sqrt 5}{\\sqrt 2} =\n\\frac{\\sqrt {10}}{2}\n$$\n\nObviously, one cannot express $\\sqrt 10$ from only one of $\\sqrt 2$ or $\\sqrt 5$.\nFortunately, this suggests the rotation:\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{gather*}\n \\begin{array}{|c} \\hline\n & & & \\textcolor{red}{\\bar{1}} \\\\\n \\\\\n & & & \\bar{3} \\\\\n \\textcolor{green}{1} & & & & & & \\textcolor{blue}{1}\n \\end{array} ~~\n \\begin{matrix}\n \\textcolor{red}{\\langle 0,-2 \\rangle} \\\\\n \\textcolor{green}{\\langle -3,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 3,1 \\rangle} \\\\\n \\end{matrix} \\\\\n \\frac{\\| \\langle -3, 1 \\rangle \\|}{\\| \\langle 0, -2 \\rangle \\|}\n = \\frac{\\sqrt {10}}{2} \\\\\n\\end{gather*}\n$$\n\n::: {#f451f6cd .cell execution_count=8}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\nThe counting video looks very promising, but can the polynomial factored?\nFortunately, yes.\n\n$$\n\\begin{gather*}\n x^{6} y^{3} + x^{3} + y^{3} - 3 x^{3} y^{2} &=&\n (x^{4} y^{2} - x^{3} y - x^{2} y^{2} + x^{2} - x y + y^{2}) \\\\\n && (x^2 y + x + y ) \\\\\n \\begin{array}{|c} \\hline\n & & & 1 \\\\\n \\\\\n & & & \\bar{3} \\\\\n 1 & & & & & & \\bar{1}\n \\end{array} &=&\n \\begin{array}{|c} \\hline\n & & 1 & \\\\\n & \\bar{1} & & \\bar{1} & \\\\\n 1 & & \\bar{1} & & 1 \\\\\n \\end{array} ~~\\cdot~~\n \\begin{array}{|c} \\hline\n & 1 & \\\\\n 1 & & 1\n \\end{array} \\\\\n & & (x y^{2} + x + y ) = \\Phi_2 \\left ( \\frac{y}{x} + xy \\right ) x\n\\end{gather*}\n$$\n\nAs noted, the the rightmost polynomial can still be expressed from $\\Phi_2$.\n\nAll powers of *x* in the product are multiples of 3.\nWe can divide these out to produce a similar carry, as we did before.\nDoing so preserves the shape of counting, but destroys the factorization, as the result is irreducible.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & \\textcolor{red}{1} & \\\\\n \\\\\n & \\bar{3} & \\\\\n \\textcolor{green}{1} & & \\textcolor{blue}{1}\n\\end{array} ~~\n\\begin{matrix}\n \\textcolor{red}{\\langle 0,2 \\rangle} \\\\\n \\textcolor{green}{\\langle -1,-1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 1,-1 \\rangle} \\\\\n\\end{matrix} \\\\\n\\frac{| \\langle -1, -1 \\rangle |}{| \\langle 0,2 \\rangle |}\n = \\frac{\\sqrt 2}{2}\n$$\n\n::: {#c8752e1f .cell execution_count=9}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n\n```\n:::\n:::\n\n\n:::\n\nAll of these similar systems is share something in common: the pseudo-base is located at\n the centroid of the triangle formed by the remaining digits.\nThis is most obvious from the fact that the sum of all three vectors equals $\\vec 0$ in all three cases.\nThe \"threshold we exceeded\" when comparing the unrotated system's neighbors was the centroid transitioning\n between being closer to the upper point or the lower two points.\n\nThe position of the centroid is unchanged so long as the lower two points have the same midpoint as above.\nTherefore, all triangular barycentric carries should share this similar pattern.\n\n\nClosing\n-------\n\nCarries intrinsically possess a few invariants.\nFor one, they must apply at any location in an expansion, a form of translational symmetry.\nNo matter if we multiply or divide by *x* or *y*, the polynomial retains its general appearance,\n as well as whether or not it is irreducible.\nThe above method shows that rotational symmetry also exists for polynomials beyond interchanging *x* and *y*.\n\nCarries seem to possess a symmetry which polynomials do not: the ability to contract and expand bases,\n meaning that in some sense, $P(x) \\sim P(x^k)$ for any *k*.\nThis preserves the counting system despite expansions and contractions which pay no regard for reducibility.\nThis is also the reason that systems like base-$\\sqrt 2$ are so uninteresting:\n for integers, it's just spaced out binary.\n\nThree questions that immediately come to mind are:\n\n- Not all integers can be written as the sum of two squares.\n Are there any (reducible) polynomials which have no nontrivial rotation?\n - The [Brahmagupta-Fibonacci](https://en.wikipedia.org/wiki/Brahmagupta%E2%80%93Fibonacci_identity) identity\n implies that such numbers are closed under multiplication.\n This means that it is always possible to reorient the triangle in the method shown above.\n- After compacting the counting system, can reducibility be recovered for other scaling factors\n than the one started with?\n What about from an irrational scaling (as by a rotation)?\n - I am not equipped to answer this.\n- Some geometry is impossible in the 2D square lattice -- for example, it contains no equilateral triangles.\n Equilateral triangles do however exist in the 3D square lattice.\n Are there 2D systems which *must* be embedded in 3D dimensions, or can they always be rotated and reduced?\n - Again, I am not equipped to answer this.\n\nRegardless, it is pleasing that the exponents in polynomials can easily be interpreted as\n the components of vectors.\nThe primary geometrical approach to such objects is to plot the curve or surface containing points which\n (at least approximately) satisfies the equation.\nHere however, basic coordinate geometry exists without needing to define evaluation.\nMoreover, geometry, linear algebra, and polynomial number theory all at once have a role to play in\n the story of these bizarre fractal patterns.\n\n",
+ "markdown": "---\ntitle: \"Counting in 2D, Part 2: Reorienting Polynomials\"\ndescription: |\n Geometric properties of certain 2D systems and attempts to classify them.\nformat:\n html:\n html-math-method: katex\ndate: \"2021-03-07\"\ndate-modified: \"2025-02-23\"\njupyter: python3\ncategories:\n - algebra\n - geometry\n - sandpile\n - python\nexecute:\n echo: false\n---\n\n\n\n\n\n[Previously](../cell1), I explored some very basic 2D counting systems, which turned out to include sandpiles.\nAs the name suggests, these planar numbers require a discrete grid of numbers to contain them.\nWhat follows is a deeper investigation into this natural extension of positional systems.\n\n\nDirection of Propagation\n------------------------\n\nGiven a carry (expressed as a polynomial in two variables or a grid) and an increasing sequence of integers,\n the expansions of the sequence will appear to propagate in a certain direction.\nRecall that from the last post, we know that $x + y = 2$ and a certain case of\n the folium of Descartes will make similar patterns:\n\n$$\n\\begin{gather*}\n & ~ & \\text{Folium} \\\\\n x + y - 2 & ~ &\n x^3 + y^3 - 2xy \\\\\n \\begin{array}{|c} \\hline\n \\bar{2} & 1 \\vphantom{2^{2^2}} \\\\\n 1\n \\end{array} & ~ &\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{2} \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nThe general direction in which we carry can be understood as the directions from the negative term of the carry\n (hereafter *pseudo-base*) to the other terms.\nThese can interpreted vectors extending from the pseudo-base to every other term.\nThe simplest way to get these vectors is by placing the pseudo-base at the constant position\n and reading off the exponent of the other terms.\n\n$$\n\\begin{gather*}\n \\begin{array}{|c} \\hline\n \\bar{2} & \\textcolor{red}{1} \\vphantom{2^{2^2}} \\\\\n \\textcolor{blue}{1}\n \\end{array} & ~ &\n \\begin{array}{c|cc}\n 0 & 0 & 0 & \\textcolor{red}{1} \\\\ \\hline\n 0 & \\bar{2} \\vphantom{2^{2^2}} \\\\\n 0 \\\\\n \\textcolor{blue}{1}\n \\end{array} \\\\\n \\begin{matrix}\n \\textcolor{red}{ x^1 y^0 } \\implies \\langle 1, 0 \\rangle \\\\\n \\textcolor{blue}{ x^0 y^1 } \\implies \\langle 0, 1 \\rangle\n \\end{matrix}\n & ~ &\n \\begin{matrix}\n \\textcolor{red}{ x^2 y^{-1} } \\implies \\langle 2, -1 \\rangle \\\\\n \\textcolor{blue}{ x^{-1} y^2 } \\implies \\langle -1, 2 \\rangle\n \\end{matrix}\n\\end{gather*}\n$$\n\nIt is clear that as we count, the expansions can extend only in a linear combination of these vectors.\nHowever, they cannot propagate in the reverse direction, as there is no sense of \"backwards\".\n\n\n### Balancing Act\n\nWe can naively balance the carry by adding additional carry digits.\nTo do this, we just need to double the pseudo-base and add reflections each vector in it.\nEquivalently, this adds the carry with the carry where we have replaced *x* and *y* with their reciprocals.\n\nIf we balance the left carry, it yields the Laplacian.\nBut what about the right?\nUnsurprisingly, it just stretches the expansions along the different \"basis\" vectors.\n\n::: {layout-ncol=\"2\"}\n$$\n\\textcolor{red}{ x^{-2} y^{1} } + x^{-1} y^{2} + \\textcolor{blue}{ x^{1} y^{-2} } + x^{2} y^{-1} - 4 \\\\\n\\begin{array}{cc|ccc}\n & & & \\textcolor{blue}{1} \\\\\n & & 0 & 0 & 1 \\\\ \\hline\n & 0 & \\bar{4} & 0 \\vphantom{2^{2^2}} \\\\\n \\textcolor{red}{1} & 0 & 0 \\\\\n & 1\n\\end{array} \\\\\n\\text{Added Vectors:} \\\\\n\\begin{matrix}\n \\textcolor{red}{\n \\langle -2, 1 \\rangle\n } \\\\\n \\textcolor{blue}{\n \\langle 1, -2 \\rangle\n }\n\\end{matrix}\n$$\n\n\n\n{{< video ./count_balanced_folium.mp4 >}}\n:::\n\n\n### Half-Balanced\n\nThe Laplacian carry is remarkably balanced, but it provokes the question of what the expansions\n look like if there are only three directions to propagate.\nThe intuition from above says that it should span a half-plane,\n up from the quarter-plane that $x + y = 2$ spans.\n\n::: {layout-ncol=\"2\"}\n$$\n\\textcolor{red}{ x^{-1} } + x^1 + y^1 - 3 \\\\\n\\begin{array}{c|cc} \\hline\n \\textcolor{red}{1} & \\bar{3} & 1 \\vphantom{2^{2^2}} \\\\\n 0 & 1 & 0\n\\end{array} \\\\\n\\text{Added Vector:} \\\\\n\\begin{matrix}\n \\textcolor{red}{\n \\langle -1, 0 \\rangle\n }\n\\end{matrix}\n$$\n\n\n\n{{< video ./count_half_laplacian.mp4 >}}\n:::\n\nFortunately, this is the case.\n\n\n### 2D Carry Types\n\nBased on the extent of the vectors, in general there appear to be four classes:\n\n1. The degenerate one-dimensional case\n - The carry is equivalent to the product of a polynomial in a single variable and any power *x* and/or *y*.\n2. Quarter-planes, like $x + y = 2$\n - Arise when the inverses of the vectors are inaccessible.\n3. Half-planes, like the above \"semi-\"Laplacian\n - Arise when two vectors are collinear and point in opposite directions,\n but every other vector is either on one side of this line or are also collinear.\n4. Full planes, like the Laplacian\n - Arise when the inverses of both vectors are accessible.\n\nQuarter-plane is a bit of a misnomer.\nTechnically, the fraction of the plane spanned is between 0 and 1/2 noninclusive\n (as these bounds correspond to the previous and next cases respectively).\nFor example, $x + y = 2$ actually to a quarter-plane, as the first row/column\n (which contain binary expansions) are unbounded.\nHowever, the Folium encompasses slightly more of the plane, or...\n\n$$\n\\frac{1}{2\\pi}\\arccos \\left (\n \\frac{\\langle 2, -1 \\rangle \\cdot \\langle -1, 2 \\rangle}\n {\\| \\langle 2, -1 \\rangle \\| \\| \\langle -1, 2 \\rangle \\|}\n\\right)\n= \\frac{1}{2\\pi} \\arccos \\left ( -\\frac 4 5 \\right )\n\\approx 0.397584\n$$\n\n...about 39% of the plane.\nThis is still smaller than the half-plane case.\n\n\nHunting for Implicitness\n------------------------\n\nWith these categories in mind, I would now like to shift focus.\nAll systems discussed thus far have been explicit and irreducible, meaning they are\n not derived from any \"simpler\" implicit rules.\nDo such rules exist, and cam we find any?\n\nAs mentioned previously, in the 1D case, we form explicit carries from implicit ones by\n multiplying the latter by cyclotomic polynomials.\nIt would be convenient if the same were true in two dimensions -- we generate an explicit 2D carry from\n the product of some input polynomial and a cyclotomic polynomial in x and y.\nHowever, I would like to leverage the visual representation used previously,\n since working with coefficients is linear, unintuitive, and most importantly, annoying.\n\n\n\n\nAbove is a screenshot of (my admittedly low-effort) attempt to ameliorate these shortcomings.\nThe left image is clickable, with the coefficients incrementing with left clicks and decrementing with right.\nThe text box controls the second multiplicand in the center image by selecting a cyclotomic polynomial\n and evaluating it with a particular expression.\nThe right image is the product.\n\nIt could obviously be improved by showing the coefficients in the picture and using color to only indicate sign.\nHowever, there is a benefit to hiding coefficients behind solid colors.\nFor instance, I don't need to recognize numerals to pinpoint what the product should look like.\n\n\n### Degenerate Expressions\n\nI have chosen to evaluate the right term (center image) at $x + y$ for a reason.\nChoosing *x* or *y* on their own is a poor decision because they change nothing from the one dimensional case.\nPut another way, when arranged in a grid, the coefficients are all collinear.\nAt first blush, *xy* seems like a decent pick, but it has the exact same problem;\n the line simply extends along the diagonal instead.\n$x/y$ has the same problem, but it is instead collinear along the anti-diagonals.\nWe allow negative exponents for the same reason we can carry at any location in an expansion\n\n::: {#f5ee7f1a .cell execution_count=5}\n\n::: {.cell-output .cell-output-display}\n{width=512 height=469}\n:::\n:::\n\n\nIt should go without saying that these are all degenerate, and can only span a line.\nOn the other hand, expressions like the sum of *x* and *y* form triangles, 2D shapes\n from which it is possible to build our goal polynomial.\nSince $x + y$ is symmetric in *x* and *y*, it is expected that the products have a similar sense of symmetry.\n\n\nFirst Results\n-------------\n\n\n\nThe first explicit product I was able to find is above.\nIt can be decomposed as the folium of Descartes, but with an extra term to the upper-left of the pseudo-base.\nThe implicit carry (the left multiplicand) describes the rearrangement of coefficients\n in a backwards L-shape to and from a sparser upside-down L-shape.\nSince the coefficients of this factor sum to zero, it passes through $(1, 1)$.\n\n$$\n\\begin{gather*}\n \\text{Folium} & ~ & \\text{New carry} \\\\\n x^3 + y^3 - 2xy & ~ &\n x^3 + y^3 + 1 - 3xy \\\\\n \\begin{array}{|c} \\hline\n 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{2} \\\\\n 0 \\\\\n 1\n \\end{array} & ~ &\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\n\n### Cousin Systems\n\nMy first thought upon seeing this carry was to see what makes counting in this system different\n from its \"neighbors\".\nBy this, I mean moving the $x^3$ and $y^3$ terms further inward and outward.\n\n$$\n\\begin{gather*}\n x + y + 1 - 3xy &\n x^2 + y^2 + 1 - 3xy \\\\\n \\begin{array}{|c} \\hline\n 1 & 1 \\\\\n 1 & \\bar{3} \\\\\n \\end{array} &\n \\begin{array}{|c} \\hline\n 1 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 1\n \\end{array} \\\\\n \\textcolor{red} {x^3 + y^3 + 1 - 3xy} &\n x^4 + y^4 + 1 - 3xy \\\\\n \\textcolor{red} {\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 1\n \\end{array}\n } &\n \\begin{array}{|c} \\hline\n 1 & 0 & 0 & 0 & 1 \\\\\n 0 & \\bar{3} \\\\\n 0 \\\\\n 0 \\\\\n 1\n \\end{array}\n\\end{gather*}\n$$\n\nAll polynomials besides the one under consideration (highlighted in red) are irreducible.\nThis means that these carries hide no implicit rules, and are as fundamental as the Laplacian or $x + y = 2$.\n\nAnalyzing the carry vectors, it is clear that the pattern produced by each should be different:\n\n$$\n\\begin{gather*}\n x^{-1} y^{0} + x^{-1} y^{-1} + x^{0} y^{-1} - 3 &\n x^{-1} y^{1} + x^{-1} y^{-1} + x^{1} y^{-1} - 3 \\\\\n \\begin{matrix}\n \\langle -1, 0 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 0, -1 \\rangle\n \\end{matrix} &\n \\begin{matrix}\n \\langle -1, 1 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 1, -1 \\rangle\n \\end{matrix} \\\\\n x^{-1} y^{2} + x^{-1} y^{-1} + x^{2} y^{-1} - 3 &\n x^{-1} y^{3} + x^{-1} y^{-1} + x^{3} y^{-1} - 3 \\\\\n \\begin{matrix}\n \\langle -1, 2 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 2, -1 \\rangle\n \\end{matrix} &\n \\begin{matrix}\n \\langle -1, 3 \\rangle \\\\\n \\langle -1, -1 \\rangle \\\\\n \\langle 3, -1 \\rangle\n \\end{matrix} \\\\\n\\end{gather*}\n$$\n\nThe vectors in the top-left carry contain only negative numbers, so it will tend toward\n the quarter-plane case like $x + y = 2$.\nIn the top-right carry, all vectors are equidistant and meet at right (and straight) angles.\nThis means that it is a 45° rotation of the altered Laplacian, which spans a half-plane.\nThe remaining two should both propagate into the full plane. Is this reflected in the counting videos?\n\n::: {}\n\n\n\n{{< video ./count_triangle_carries.mp4 >}}\n\nCounting in each of the $x^n + y^n + \\ldots$ systems\n:::\n\nIndeed it is.\nHowever, while the discovered carry remarkably remains centered, the final one tends more toward\n propagating to the lower right.\nIt has somehow exceeded a threshold that the centered one has not.\n\nIncidentally, the L-shapes in the implicit carry (which I noted can be interchanged) never turn up,\n and the \"initial rule\" is useless.\nPhinary, the simplest implicit case in one dimension, still requires the initial rule to go\n from the expansion of two (10.01) to three (100.01).\n\n\nIsosceles Rotations\n-------------------\n\nOne of the similar carries is a rotation of a pattern we were already familiar with,\n like the folium was to $x + y = 2$\nDoes this mean we can rotate the centered pattern?\nIf so, is will the carry polynomial still be factorable?\n\nNaively, the following carry might look similar...\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & & \\textcolor{red}{1} \\\\\n & & \\bar{3} \\\\\n \\textcolor{green}{1} & & & & \\textcolor{blue}{1}\n \\end{array} \\\\\n \\begin{matrix}\n \\textcolor{red}{\\langle 0,-1 \\rangle} \\\\\n \\textcolor{green}{\\langle -2,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 2,1 \\rangle} \\\\\n \\text{Angle to top} \\approx 116°\n\\end{matrix}\n$$\n\n\n\n{{< video ./count_bad_rotated_triangle.mp4 >}}\n:::\n\nBut there are only even numbers in the first component of each vector.\nTherefore, the carry below will produce the same pattern.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & \\textcolor{red}{1} \\\\\n & \\bar{3} \\\\ \\textcolor{green}{1}\n && \\textcolor{blue}{1}\n\\end{array} \\\\\n\\begin{matrix}\n \\textcolor{red}{\\langle 0,-1 \\rangle} \\\\\n \\textcolor{green}{\\langle -1,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 1,1 \\rangle} \\\\\n \\text{Angle to top} = 135°\n\\end{matrix}\n$$\n\n\n\n{{< video ./count_bad_rotated_triangle_reduced.mp4 >}}\n:::\n\nNeither of these are similar to the original.\nFor comparison, the largest angle in the nonrotated case is ~108°.\nIn fact, the shape is much closer to the similar orientation with $x^4 + y^4 + \\ldots$ terms.\n\n\n### Checking Magnitudes\n\nMeasuring these quantities as angles is a bit of a lie.\nSince all of these triangles are isosceles, two of the vectors have equal magnitude.\nFurther, each can be characterized by the ratio between them and the final vector's magnitude.\nThe previous two triangles have ratio:\n\n$$\n\\\\\n\\frac{m_1}{n_1} =\n\\frac{\\| \\langle -2, -1 \\rangle \\|}{\\| \\langle 0, -1 \\rangle \\|} =\n\\frac{\\sqrt 5}{1} =\n\\sqrt 5\n\\\\\n\\frac{m_2}{n_2} =\n\\frac{\\| \\langle -1, -1 \\rangle \\|}{\\| \\langle 0, -1 \\rangle \\|} =\n\\frac{\\sqrt 2}{1} =\n\\sqrt 2\n$$\n\nThe triangle we are trying to rotate has ratio:\n\n$$\n\\frac{m}{n} =\n\\frac{\\| \\langle 2, -1 \\rangle \\|}{\\| \\langle -1, -1 \\rangle \\|} =\n\\frac{\\sqrt 5}{\\sqrt 2} =\n\\frac{\\sqrt {10}}{2}\n$$\n\nObviously, one cannot express $\\sqrt 10$ from only one of $\\sqrt 2$ or $\\sqrt 5$.\nFortunately, this suggests the rotation:\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{gather*}\n \\begin{array}{|c} \\hline\n & & & \\textcolor{red}{\\bar{1}} \\\\\n \\\\\n & & & \\bar{3} \\\\\n \\textcolor{green}{1} & & & & & & \\textcolor{blue}{1}\n \\end{array} ~~\n \\begin{matrix}\n \\textcolor{red}{\\langle 0,-2 \\rangle} \\\\\n \\textcolor{green}{\\langle -3,1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 3,1 \\rangle} \\\\\n \\end{matrix} \\\\\n \\frac{\\| \\langle -3, 1 \\rangle \\|}{\\| \\langle 0, -2 \\rangle \\|}\n = \\frac{\\sqrt {10}}{2} \\\\\n\\end{gather*}\n$$\n\n\n\n{{< video ./count_good_rotated_triangle.mp4 >}}\n:::\n\nThe counting video looks very promising, but can the polynomial factored?\nFortunately, yes.\n\n$$\n\\begin{gather*}\n x^{6} y^{3} + x^{3} + y^{3} - 3 x^{3} y^{2} &=&\n (x^{4} y^{2} - x^{3} y - x^{2} y^{2} + x^{2} - x y + y^{2}) \\\\\n && (x^2 y + x + y ) \\\\\n \\begin{array}{|c} \\hline\n & & & 1 \\\\\n \\\\\n & & & \\bar{3} \\\\\n 1 & & & & & & \\bar{1}\n \\end{array} &=&\n \\begin{array}{|c} \\hline\n & & 1 & \\\\\n & \\bar{1} & & \\bar{1} & \\\\\n 1 & & \\bar{1} & & 1 \\\\\n \\end{array} ~~\\cdot~~\n \\begin{array}{|c} \\hline\n & 1 & \\\\\n 1 & & 1\n \\end{array} \\\\\n & & (x y^{2} + x + y ) = \\Phi_2 \\left ( \\frac{y}{x} + xy \\right ) x\n\\end{gather*}\n$$\n\nAs noted, the the rightmost polynomial can still be expressed from $\\Phi_2$.\n\nAll powers of *x* in the product are multiples of 3.\nWe can divide these out to produce a similar carry, as we did before.\nDoing so preserves the shape of counting, but destroys the factorization, as the result is irreducible.\n\n::: {layout-ncol=\"2\"}\n$$\n\\begin{array}{|c} \\hline\n & \\textcolor{red}{1} & \\\\\n \\\\\n & \\bar{3} & \\\\\n \\textcolor{green}{1} & & \\textcolor{blue}{1}\n\\end{array} ~~\n\\begin{matrix}\n \\textcolor{red}{\\langle 0,2 \\rangle} \\\\\n \\textcolor{green}{\\langle -1,-1 \\rangle} \\\\\n \\textcolor{blue}{\\langle 1,-1 \\rangle} \\\\\n\\end{matrix} \\\\\n\\frac{| \\langle -1, -1 \\rangle |}{| \\langle 0,2 \\rangle |}\n = \\frac{\\sqrt 2}{2}\n$$\n\n\n\n{{< video ./count_good_rotated_triangle_reduced.mp4 >}}\n:::\n\nAll of these similar systems is share something in common: the pseudo-base is located at\n the centroid of the triangle formed by the remaining digits.\nThis is most obvious from the fact that the sum of all three vectors equals $\\vec 0$ in all three cases.\nThe \"threshold we exceeded\" when comparing the unrotated system's neighbors was the centroid transitioning\n between being closer to the upper point or the lower two points.\n\nThe position of the centroid is unchanged so long as the lower two points have the same midpoint as above.\nTherefore, all triangular barycentric carries should share this similar pattern.\n\n\nClosing\n-------\n\nCarries intrinsically possess a few invariants.\nFor one, they must apply at any location in an expansion, a form of translational symmetry.\nNo matter if we multiply or divide by *x* or *y*, the polynomial retains its general appearance,\n as well as whether or not it is irreducible.\nThe above method shows that rotational symmetry also exists for polynomials beyond interchanging *x* and *y*.\n\nFor integers, carries possess a symmetry which polynomials do not: the ability to contract and expand bases,\n meaning that in some sense, $P(x) \\sim P(x^k)$ for any *k*.\nThis preserves the counting system despite expansions and contractions which pay no regard for reducibility.\nThis is also the reason that systems like base-$\\sqrt 2$ are so uninteresting:\n for integers, it just amounts to spaced-out binary.\n\nThree questions that immediately come to mind are:\n\n- Not all integers can be written as the sum of two squares.\n Are there any (reducible) polynomials which have no nontrivial rotation?\n - The [Brahmagupta-Fibonacci](https://en.wikipedia.org/wiki/Brahmagupta%E2%80%93Fibonacci_identity) identity\n implies that such numbers are closed under multiplication.\n This means that it is always possible to reorient the triangle in the method shown above.\n- After compacting the counting system, can reducibility be recovered for other scaling factors\n than the one started with?\n What about from an irrational scaling (as by a rotation)?\n - I am not equipped to answer this.\n- Some geometry is impossible in the 2D square lattice -- for example, it contains no equilateral triangles.\n Equilateral triangles do however exist in the 3D square lattice.\n Are there 2D systems which *must* be embedded in 3D dimensions, or can they always be rotated and reduced?\n - Again, I am not equipped to answer this.\n\nRegardless, it is pleasing that the exponents in polynomials can easily be interpreted as\n the components of vectors.\nThe primary geometrical approach to such objects is to plot the curve or surface containing points which\n (at least approximately) satisfies the equation.\nHere however, basic coordinate geometry exists without needing to define evaluation.\nMoreover, geometry, linear algebra, and polynomial number theory all at once have a role to play in\n the story of these bizarre fractal patterns.\n\n",
"supporting": [
"index_files"
],
"filters": [],
- "includes": {
- "include-in-header": [
- "\n\n\n"
- ]
- }
+ "includes": {}
}
}
\ No newline at end of file
diff --git a/posts/polycount/sand-1/index.qmd b/posts/polycount/sand-1/index.qmd
index 81dacc4..542aabd 100644
--- a/posts/polycount/sand-1/index.qmd
+++ b/posts/polycount/sand-1/index.qmd
@@ -10,6 +10,7 @@ date-modified: "2025-02-20"
jupyter: python3
categories:
- algebra
+ - sandpile
- python
execute:
echo: false
diff --git a/posts/polycount/sand-2/index.qmd b/posts/polycount/sand-2/index.qmd
index cc3b165..4fd6ceb 100644
--- a/posts/polycount/sand-2/index.qmd
+++ b/posts/polycount/sand-2/index.qmd
@@ -1,6 +1,7 @@
---
-title: "Counting in 2D 2: Reorienting Polynomials"
-draft: true
+title: "Counting in 2D, Part 2: Reorienting Polynomials"
+description: |
+ Geometric properties of certain 2D systems and attempts to classify them.
format:
html:
html-math-method: katex
@@ -9,15 +10,28 @@ date-modified: "2025-02-23"
jupyter: python3
categories:
- algebra
+ - geometry
+ - sandpile
- python
execute:
echo: false
---
+
+
```{python}
from pathlib import Path
-from IPython.display import Video, display
from matplotlib import pyplot as plt
import numpy as np
@@ -139,11 +153,9 @@ if not Path("./count_balanced_folium.mp4").exists():
).save("count_balanced_folium.mp4")
except ValueError:
pass
-
-display(
- Video("./count_balanced_folium.mp4"),
-)
```
+
+{{< video ./count_balanced_folium.mp4 >}}
:::
@@ -183,11 +195,9 @@ if not Path("./count_half_laplacian.mp4").exists():
).save("count_half_laplacian.mp4")
except ValueError:
pass
-
-display(
- Video("./count_half_laplacian.mp4"),
-)
```
+
+{{< video ./count_half_laplacian.mp4 >}}
:::
Fortunately, this is the case.
@@ -477,9 +487,8 @@ if not Path("./count_triangle_carries.mp4").exists():
).save("./count_triangle_carries.mp4")
except ValueError:
pass
-
-Video("./count_triangle_carries.mp4")
```
+{{< video ./count_triangle_carries.mp4 >}}
Counting in each of the $x^n + y^n + \ldots$ systems
:::
@@ -492,7 +501,7 @@ It has somehow exceeded a threshold that the centered one has not.
Incidentally, the L-shapes in the implicit carry (which I noted can be interchanged) never turn up,
and the "initial rule" is useless.
Phinary, the simplest implicit case in one dimension, still requires the initial rule to go
- from the expansion of 2 (10.01) to 3 (100.01).
+ from the expansion of two (10.01) to three (100.01).
Isosceles Rotations
@@ -536,13 +545,12 @@ if not Path("./count_bad_rotated_triangle.mp4").exists():
except ValueError:
pass
-display(
- Video("./count_bad_rotated_triangle.mp4"),
-)
```
+
+{{< video ./count_bad_rotated_triangle.mp4 >}}
:::
-But there are only even numbers in the first component of each vector
+But there are only even numbers in the first component of each vector.
Therefore, the carry below will produce the same pattern.
::: {layout-ncol="2"}
@@ -575,11 +583,9 @@ if not Path("./count_bad_rotated_triangle_reduced.mp4").exists():
).save("./count_bad_rotated_triangle_reduced.mp4")
except ValueError:
pass
-
-display(
- Video("./count_bad_rotated_triangle_reduced.mp4"),
-)
```
+
+{{< video ./count_bad_rotated_triangle_reduced.mp4 >}}
:::
Neither of these are similar to the original.
@@ -654,11 +660,9 @@ if not Path("./count_good_rotated_triangle.mp4").exists():
).save("./count_good_rotated_triangle.mp4")
except ValueError:
pass
-
-display(
- Video("./count_good_rotated_triangle.mp4"),
-)
```
+
+{{< video ./count_good_rotated_triangle.mp4 >}}
:::
The counting video looks very promising, but can the polynomial factored?
@@ -727,11 +731,9 @@ if not Path("./count_good_rotated_triangle_reduced.mp4").exists():
).save("./count_good_rotated_triangle_reduced.mp4")
except ValueError:
pass
-
-display(
- Video("./count_good_rotated_triangle_reduced.mp4"),
-)
```
+
+{{< video ./count_good_rotated_triangle_reduced.mp4 >}}
:::
All of these similar systems is share something in common: the pseudo-base is located at
@@ -753,11 +755,11 @@ No matter if we multiply or divide by *x* or *y*, the polynomial retains its gen
as well as whether or not it is irreducible.
The above method shows that rotational symmetry also exists for polynomials beyond interchanging *x* and *y*.
-Carries seem to possess a symmetry which polynomials do not: the ability to contract and expand bases,
+For integers, carries possess a symmetry which polynomials do not: the ability to contract and expand bases,
meaning that in some sense, $P(x) \sim P(x^k)$ for any *k*.
This preserves the counting system despite expansions and contractions which pay no regard for reducibility.
This is also the reason that systems like base-$\sqrt 2$ are so uninteresting:
- for integers, it's just spaced out binary.
+ for integers, it just amounts to spaced-out binary.
Three questions that immediately come to mind are: