diff --git a/polycount/1/index.qmd b/polycount/1/index.qmd index 708d6c5..aaf2507 100644 --- a/polycount/1/index.qmd +++ b/polycount/1/index.qmd @@ -1,5 +1,7 @@ --- title: "Polynomial Counting 1: A primer" +description: | + An exploration into generalizations of positional number systems to irrational numbers. format: html: html-math-method: katex @@ -15,8 +17,10 @@ categories: The single most common method of representing numbers in the modern world is in *positional numeral system*. Despite being taught in early grade school, it is the result of millennia of mathematical thought. -The decimal system we use today assigns integers to *expansions* consisting several symbols called *numerals* next to each other. -Each numeral is positioned at a *place value*, which has a value ten times greater than its neighbor to the right and a tenth as much of its neighbor to the left. +The decimal system we use today assigns integers to *expansions* consisting several symbols called + *numerals* next to each other. +Each numeral is positioned at a *place value*, which has a value ten times greater than its neighbor + to the right and a tenth as much of its neighbor to the left. Due to place values sharing a constant ratio of ten, the system is called *decimal*. $$ @@ -34,13 +38,17 @@ $$ On the difference between "1, 2, 3, and 4" and "one, two, three, and four" -For clarity, I distinguish between numerals, such as 1, 2, 3, and 4, and numbers, such as one, two, three, and four. -When discussing different systems from decimal, it is easy to write things like "base 2" rather than "base two". -The former leverages a distinguished symbol for the number two existing, which while at times useful, leads to confusion between the symbol and the underlying number. +For clarity, I distinguish between numerals, such as "1", "2", "3", and "4", and numbers, + such as "one", "two", "three", and "four". +When discussing different systems from decimal, it's easy to write things like "base 2" rather than "base two". +The former leverages a distinguished symbol for the number two existing, which while at times useful, + leads to confusion between the symbol and the underlying number. -When referring to its value, I'll tend to write out a number's English name, rather than how it would be written in decimal. -Conversely, when I want to refer to the symbols themselves, I will enclose them in quotes; for example, "0" refers to the symbol 0. +When referring to its value, I'll tend to write out a number's English name, rather than + how it would be written in decimal. +Conversely, when I want to refer to the symbols themselves, I will enclose them in quotes; + for example, "0" refers to the symbol 0. @@ -49,30 +57,42 @@ A Brief History As mentioned, this practice is millenia old. -Arguably, the oldest common ancestor was used by the Babylonians (circa eighteenth century BC), who instead used a sexagesimal (base sixty) system. -It lacked a "decimal point" (more properly a sexagesimal point, *fractional separator*, or *radix point*), meaning that a representation could equally as well refer to thirty (30) or one-half (1/2), or one hundred and eight thousand (108000), since all these numbers differ by a power of sixty (60). -This system lacked a "0" symbol to represent an empty place value, opting instead to simply skip them. +Arguably, the oldest common ancestor was used by the Babylonians (circa eighteenth century BC), + who instead used a sexagesimal (base sixty) system. +It lacked a "decimal point" (more properly a sexagesimal point, *fractional separator*, or *radix point*). +This meant that a representation could equally as well refer to thirty (30) or one-half (1/2 = 30×60^-1^), + or one hundred and eight thousand (108000 = 30×60^2^ ) in the same way we might consider + five (5), one-half (1/2 = 5×10^-1^), and five-hundred (500 = 5×10^2^) to be similar in decimal. +It also lacked a "0" symbol to represent an empty place value; instead, empty place values were simply skipped. Thus, the onus was on the arithmetician to properly align digits, maintain spacing, and correctly interpret results. -Despite these limitations, it was robust enough to develop basic trigonometry and [approximate the square root of 2](https://en.wikipedia.org/wiki/YBC_7289). +Despite these limitations, it was robust enough to develop basic trigonometry and + [approximate the square root of 2](https://en.wikipedia.org/wiki/YBC_7289). -Later, Indian mathematics developed its own place value system -- this time in the familiar base ten -- at least by the time of Aryabhata (4th century AD). It introduced the empty "0" symbol that the Babylonian system lacked. +Later, Indian mathematics developed its own place value system -- this time in the familiar base ten -- + at least by the time of Aryabhata (4th century AD). +It introduced the empty "0" symbol that the Babylonian system lacked. Eventually, this system made its way to Europe by means of the Arabs. The 16th century Dutch engineer Simon Stevin was one of the first individuals to introduce a "decimal point". -Though modern notation differs slightly from his, it introduced (or perhaps re-introduced) a means of adding and multiplying numbers between integers. +Though modern notation differs slightly from his, it introduced (or perhaps re-introduced) a means of adding + and multiplying numbers between integers. Needless to say, it has become so popular as to become one of the most predominant ways to express numbers. -Later thought realized bases other than ten were possible; for example, [binary](https://en.wikipedia.org/wiki/Binary_number) (base two) due in part to Leibniz. +Later thought realized bases other than ten were possible; for example, + [binary](https://en.wikipedia.org/wiki/Binary_number) (base two) due in part to Leibniz. Stranger yet are non-integral bases, for example the complex base $2i$ due to Knuth. However, I find bases which rely on *irrational* numbers to be the most interesting. Staying Golden -------------- -The [*golden ratio*](https://en.wikipedia.org/wiki/Golden_ratio), a number with many apocryphal attributions, was a favorite of Greek mathematics. +The [*golden ratio*](https://en.wikipedia.org/wiki/Golden_ratio), a number with many apocryphal attributions, + was a favorite of Greek mathematics. As such, it was originally recognized in the context of geometry, long before the development of algebra. -It is constructed by dividing a line segment such that the ratio between the longer and shorter sub-segments is the same as the ratio between original segment and the longer sub-segment. +It is constructed by dividing a line segment such that the ratio between the longer and shorter sub-segments + is the same as the ratio between original segment and the longer sub-segment. -Phrased in modern algebraic language, the golden ratio *φ* is the unique positive root of the polynomial $x^2 - x - 1$, expressed as $\frac{1 + \sqrt 5}{2} \approx 1.618…$. +Phrased in modern algebraic language, the golden ratio *φ* is the unique positive root of the polynomial + $x^2 - x - 1$, expressed as $\frac{1 + \sqrt 5}{2} \approx 1.618…$. Despite its name, this number is ir**ratio**nal, since it cannot be represented as a **ratio** of integers. Furthermore, raising it to any integral power does not produce an integer (left as an exercise to the reader). @@ -147,6 +167,8 @@ def beta_expand_greedy( As a demonstration, this algorithm, when run on a decimal number gives the same value: ```{python} +#| code-fold: true + def as_digits(digits: dict[int, int]) -> str: '''Convert a dictionary from `beta_expand_greedy` to a sequence of digits''' return "".join( @@ -168,20 +190,24 @@ There are three problems with this. For numbers smaller than the tolerance, it is outright wrong. Due to the nature of the approximation, the result can also appear in an unexpected form: ```{python} + #| code-fold: true + phi = (5**0.5 + 1) / 2 print("Expected:", "10100.0101") print("Got: ", as_digits(beta_expand_greedy(10, phi))) ``` 2. It relies on a transcendental function, the logarithm. - - One may approximate this by repeated division, but in general, it is practical to use a floating-point function. + - One may approximate this by repeated division, but in general, it is practical to use a + floating-point function. 3. The arguments `x` and `b` are given as floating-point numbers. However, if `p` is always positive, we can instead use integer arithmetic, which is more precise. Generally, we need some form of fractional arithmetic. Modern FPUs are make the last two items somewhat trivial, but they necessarily make the calculation approximate. -Fortunately for phinary, there is a direct method which remedies all these issues and produces exact results without floating-point operations. +Fortunately for phinary, there is a direct method which remedies all these issues and produces exact + results without floating-point operations. ### Deriving Expansions @@ -210,7 +236,8 @@ $$ $$ This shows a connection between polynomials and positional notation which is not at all obvious. -The second lines leverage positional notation in lieu of a symbol; their interpretation is exactly the same as the first line. +The second lines leverage positional notation in lieu of a symbol; their interpretation is + exactly the same as the first line. When we multiply or divide by ten in decimal (or two in binary), we shift the digits left or right. Likewise, we may multiply or divide by *φ* on either side of the equation. @@ -237,8 +264,10 @@ $$ $$ Since this relationship holds for any adjacent place values, it is analogous to "carrying" in base ten. -In decimal, we care if a single place value exceeds ten and increment the next place value (once for each multiple of ten). -In phinary, we care if there are two "1"s in adjacent place values, and can remove such occurrences by doing the same. +In decimal, we care if a single place value exceeds ten and increment the next place value + (once for each multiple of ten). +In phinary, we care if there are two "1"s in adjacent place values, and can remove such occurrences + by doing the same. More generally, we can look at expansions not restricted to the symbols "0" and "1" and do similarly @@ -266,7 +295,8 @@ In phinary, we have two carry rules, which we repeat until we cannot: 1. Express "011" as "100" 2. Express "0200" as "1001" -Aggressively applying these rules results in the same expansion as found in the [canonical table](#canonical-phinary-table). +Aggressively applying these rules results in the same expansion as found in the + [canonical table](#canonical-phinary-table). For example, the expansion of three is clearly $$ @@ -298,7 +328,8 @@ print(phi**4 + phi**2 - (4 * phi + 3)) ### The Other Root -As a quadratic, the polynomial $x^2 - x - 1$ has two roots: $\varphi$ and its conjugate $\varphi^* = -\varphi^{-1}$. +As a quadratic, the polynomial $x^2 - x - 1$ has two roots: $\varphi$ and its conjugate + $\varphi^* = -\varphi^{-1}$. This implies that each phinary string can be interpreted by either root. $$ @@ -312,7 +343,8 @@ $$ \end{align*} $$ -To make the calculation easier, we can un-expand the postive part to make cancellation with the negative part easier. +To make the calculation easier, we can un-expand the postive part to make cancellation with the + negative part easier. This is the same as borrowing when doing typical subtraction. $$ @@ -336,19 +368,25 @@ And we breathe a sigh of relief since the expansion we get is the same we starte This is perhaps one of the reasons phinary expansions seem so verbose. As an aside, since $-\varphi^{-1}$ is negative, its powers alternate between positive and negative. -Also, since its magnitude is less than one, place values to the right of the radix point are larger than one, the inverse of what one is used to with base ten. +Also, since its magnitude is less than one, place values to the right of the radix point are larger than one, + the inverse of what one is used to with base ten. Fibonacci and Zeckendorf ------------------------ -Instead of assigning place values to powers of the base, we can instead imagine a situation where the place values correspond to the values of a sequence, in particular the Fibonacci numbers. -Phi also turns up when discussing this sequence, or more generally, sequences generated by the recurrence $a_{n+1} = a_n + a_{n-1}$. -This bears a striking resemblance the the polynomial mentioned above, with cursory examination by [generating functions](https://en.wikipedia.org/wiki/Generating_function) revealing the connection. +Instead of assigning place values to powers of the base, we can instead imagine a situation where the + place values correspond to the values of a sequence, in particular the Fibonacci numbers. +Phi also turns up when discussing this sequence, or more generally, sequences generated by the recurrence + $a_{n+1} = a_n + a_{n-1}$. +This bears a striking resemblance the the polynomial mentioned above, with cursory examination by + [generating functions](https://en.wikipedia.org/wiki/Generating_function) revealing the connection. Fibonacci numbers are all integers, so sums of them can only express integers. -If we assign place values to unique Fibonacci numbers (one is "1" and not "10"), we can imagine a similar algorithm to the one presented earlier. -That is, we can derive an expansion for a number by subtracting out the largest Fibonacci number less than it (possibly multiple times) and repeating with the remainder. +If we assign place values to unique Fibonacci numbers (one is "1" and not "10"), we can imagine a + similar algorithm to the one presented earlier. +That is, we can derive an expansion for a number by subtracting out the largest Fibonacci number less than it + (possibly multiple times) and repeating with the remainder. Expansions of the integers up to 10 are: :::: {.row .text-center width="50%"} @@ -374,10 +412,12 @@ Expansions of the integers up to 10 are: These are known as *Zeckendorf expansions*. These representations seem very similar to the phinary strings above. -Not only that, but this sequence is also the sequence of all binary strings that do not contain two consecutive "1"s ([OEIS A014417](https://oeis.org/A014417)). +Not only that, but this sequence is also the sequence of all binary strings that do not contain two consecutive + "1"s ([OEIS A014417](https://oeis.org/A014417)). This representation is exactly as arbitrary as preferring the greedy phinary representation; instead, this is the "greedy series expansion" of an integer in the Fibonacci numbers. + ### Expanding Two, Again Because of the relationship between phi and the Fibonacci numbers, we have the familiar relation @@ -385,7 +425,7 @@ Because of the relationship between phi and the Fibonacci numbers, we have the f $$ \begin{align*} 2 F_n &= F_{n+1} + F_{n-2} \\ - 0200_{Z} &= 1001_{Z} + 0200_\text{Zeck} &= 1001_\text{Zeck} \end{align*} $$ @@ -422,7 +462,8 @@ How "canonical" can "canonical" really be? Rather than answering these questions or giving proofs, I think it's best to lay some ground rules. Using the above examples, I define two genera of positional number systems: -- A *fractional* number system is one where the place values are determined by the powers of the root of a polynomial with integer coefficients. +- A *fractional* number system is one where the place values are determined by the powers of the + root of a polynomial with integer coefficients. The "fraction" in fractional comes allowing negative powers of our base. Therefore, we can represent rational numbers and use a fractional separator. - Naturally, the decimal system currently in use fits in here, corresponding to the polynomial $x - 10$. @@ -431,10 +472,12 @@ Using the above examples, I define two genera of positional number systems: - An *integral* number system is one where the place values are given by a strictly increasing integral sequence. It can express only integers and there is no fractional separator. - - As an example, the geometric series produced from an integer (e.g.: 1, 2, 4, 8, …), corresponds to a typical system without support for fractions. + - As an example, the geometric series produced from an integer (e.g.: 1, 2, 4, 8, …), corresponds to + a typical system without support for fractions. - The already-discussed the Fibonacci base fits here as well. - In fact, since linear recurrence relations correspond to polynomials, this extends to a correspondence between integral and fractional systems. + In fact, since linear recurrence relations correspond to polynomials, this extends to a correspondence + between integral and fractional systems. - Other sequences are also valid, like the square numbers. In the "square number base" we know the digital root (of canonical expansions) never exceeds 4 due to @@ -446,30 +489,38 @@ Using the above examples, I define two genera of positional number systems: A positional number system not only has place values, but a *numeral alphabet*. In standard decimal, there are ten distinct symbols including "0": {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. The choice of symbols is arbitrary - (it can vary [with](https://en.wikipedia.org/wiki/Eastern_Arabic_numerals) [language](https://en.wikipedia.org/wiki/Chinese_numerals)), + (it can vary + [with](https://en.wikipedia.org/wiki/Eastern_Arabic_numerals) + [language](https://en.wikipedia.org/wiki/Chinese_numerals)), but each has a *weight*, the integer quantity assigned to them. -In the modern Western world, [Hindu-Arabic numerals](https://en.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system) are standard and distinct from alphabetic characters, - so the distinction between "weight" and "symbol" can be ignored by using them conventionally for the first ten whole numbers. +In the modern Western world, + [Hindu-Arabic numerals](https://en.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system) are standard + and distinct from alphabetic characters, so the distinction between "weight" and "symbol" can be ignored + by using them conventionally for the first ten whole numbers. Subsets of this alphabet include the binary alphabet, {0, 1}, and the ternary alphabet, {0, 1, 2}. -A *minimal alphabet* for a number system is an alphabet of the smallest size which can still represent every integer. +A *minimal alphabet* for a number system is an alphabet of the smallest size which can still represent + every integer. It is most convenient to consider an alphabet of integers from 0 up to a particular value, even though it may be true that minimal alphabets might exist which "skip" over certain weights. -It is often useful to be able to borrow a symbol of a certain weight, even if it would not be present in a minimal alphabet - (for example, using "2" when it is convenient to do so, as above). - In this manner, it is also possible to interpret the representation of a number in one base in another arbitrary base. +It is often useful to be able to borrow a symbol of a certain weight, even if it would not be present + in a minimal alphabet (for example, using "2" when it is convenient to do so, as above). +In this manner, it is also possible to interpret the representation of a number in one base + in another arbitrary base. *Balanced alphabets* also exist, which contain negative numeral weights. -For example, the balanced ternary alphabet consists of the weights of $\{-1, 0, 1\}$. +For example, the balanced ternary alphabet consists of the weights of {-1, 0, 1}. Powers of 3 always determine the place values in ternary, but expansions change to suit the alphabet. To conserve horizontal space, I'll use the symbols $\bar{1}$ and "T" to signify -1. ### Canonicity -Finding the *canonical expansion* of a number should be as simple as incrementing the 0th place value and aggressively applying the carry. -For fractional systems, this amounts to adding one the 1's digit, and for integral ones, adding it to the rightmost. +Finding the *canonical expansion* of a number should be as simple as incrementing the 0th place value + and aggressively applying the carry. +For fractional systems, this amounts to adding one the 1's digit, and for integral ones, + adding it to the rightmost. Note that irrational systems have at least *two* carry rules. In phinary, these are the "011" = "100" rule, and the "0200" = "1001" rule. @@ -477,15 +528,24 @@ In phinary, these are the "011" = "100" rule, and the "0200" = "1001" rule. ### Questions About the Above Rules -One may take several exceptions with these definitions and the restrictions they impose, to which I will offer a brief dismissal: +One may take several exceptions with these definitions and the restrictions they impose, + to which I will offer a brief dismissal: +
+ #### Why limit alphabet weights to integers? + Integers and integer arithmetic are fundamental systems with very straightforward addition and multiplication. Adding more complex rules by introducing fractions or polynomial roots creates unnecessary complications. +
+ +
+ #### Why prefer weights of integers from 0 to n? + Alphabets are best kept inductive -- either a weight is the largest possible or its successor is also a weight. If we start with a negative weight, this includes balanced alphabets. @@ -498,9 +558,13 @@ The inductive base case, the binary alphabet, is fairly important for two reason - Expansions can always be padded with 0s to produce other valid expansions. - If "1" does not exist in the alphabet, it should be derivable in some way from other symbols like "2" and "3". +
+
+ #### Do we prefer monic polynomials? + The recurrence relation corresponding to a non-monic polynomials must cycle mod the leading term. The simplest (only?) examples are just geometric series; in other words, normal integral systems. @@ -514,17 +578,25 @@ $$ Incidentally, 3 is a root of $2x^2 - 5x - 3$. Fermat's little theorem is likely a component in proving this generally. +
+
+ #### Why exclude transcendentals from fractional systems? + Convergent series like $\exp{x}$ require coefficients which shrink quickly, far below a magnitude of 1. This conflicts with our expectation of counting polynomials to be integral polynomials. -This is disappointing, since relatively simple (in terms of continued fractions, combinatorics, etc) transcendental like $e$ relies on a series in rationals. +This is disappointing, since relatively simple transcendental like $e$ + (simple in terms of continued fractions, combinatorics, etc) relies on a series in rationals. +
Closing ------- -With these restrictions in mind, I wrote a simple Haskell library to help explore these systems (found [here](https://github.com/queue-miscreant/GenBase)). -The [next post](../2) will discuss quadratic polynomials with larger coefficients than 1, and problems not discussed with higher expansions. +With these restrictions in mind, I wrote a simple Haskell library to help explore these systems + (found [here](https://github.com/queue-miscreant/GenBase)). +The [next post](../2) will discuss quadratic polynomials with larger coefficients than 1, and problems + not discussed with higher expansions. diff --git a/polycount/2/index.qmd b/polycount/2/index.qmd index f538211..6629ca4 100644 --- a/polycount/2/index.qmd +++ b/polycount/2/index.qmd @@ -1,5 +1,7 @@ --- title: "Polynomial Counting 2: Binary and beyond" +description: | + Continuing to explore irrational counting systems and discovering problems with certain polynomials. format: html: html-math-method: katex @@ -13,7 +15,8 @@ categories: This post assumes you have read [the one prior](../1), which introduces generalized polynomial counting. Before I start, I'd like to introduce some shorthand. -Since we prefer (monic) polynomials which may correspond to linear recurrences, it is useful to use an ordered tuple of their coefficients. +Since we prefer (monic) polynomials which may correspond to linear recurrences, it is useful to use + an ordered tuple of their coefficients. $$ \begin{gather*} @@ -32,17 +35,22 @@ In the future, I'll refer to these tuples as "carries" for simplicity. The Silver Ratio ---------------- -The golden ratio is actually the first member of a sequence of [*metallic ratios*](https://en.wikipedia.org/wiki/Metallic_ratio). +The golden ratio is actually the first member of a sequence of + [*metallic ratios*](https://en.wikipedia.org/wiki/Metallic_ratio). They are the roots of the polynomials $x^2 - nx - 1$ or $\langle n, 1|$ in the newly-introduced notation. The next member ($n$ = 2) is termed the *silver ratio*. Its value is $\delta_s = 1 + \sqrt 2 \approx 2.414...$ -Like the the golden ratio corresponds to the Fibonacci numbers, the silver ratio corresponds to the *Pell numbers* ([OEIS A000129](http://oeis.org/A000129)). -The Pell numbers begin $0, 1$ like the Fibonacci numbers, but instead have the recurrence $a_{n+1} = 2a_n + a_{n-1}$. +Like the the golden ratio corresponds to the Fibonacci numbers, the silver ratio corresponds to the + *Pell numbers* ([OEIS A000129](http://oeis.org/A000129)). +The Pell numbers begin $0, 1$ like the Fibonacci numbers, but instead have the recurrence + $a_{n+1} = 2a_n + a_{n-1}$. The sequence continues as $2, 5, 12, 29...$ -With this relationship in mind, we can construct the (fractional) silver ratio system and the (integral) Pell number system. -$\delta_s$ is bounded above by the integer 3, which is also the smallest integer strictly greater than the coefficients in $\langle 2, 1|$. +With this relationship in mind, we can construct the (fractional) silver ratio system and the (integral) + Pell number system. +$\delta_s$ is bounded above by the integer 3, which is also the smallest integer strictly + greater than the coefficients in $\langle 2, 1|$. Therefore, it would make sense to derive the expansion of 3 in the same way as the golden ratio expansion of 2: $$ @@ -89,7 +97,8 @@ $$ \end{align} $$ -We prefer expansions to allow (2) rather than (1) since any expansion can be padded by the symbol "0" on either sideindefinitely. +We prefer expansions to allow (2) rather than (1) since any expansion can be padded by the symbol "0" + on either sideindefinitely. Also, a standard conversion of the string "2" results in $10.\bar{1}$, which resembles (2). :::: {.row .text-center width="50%"} @@ -183,7 +192,8 @@ The integral base is not so fortunate, and still requires the extra symbol "2": ::: :::: -Numbers which include a 2 in their integral expansion seem to align with the sequence [OEIS 003158](http://oeis.org/A003158). +Numbers which include a 2 in their integral expansion seem to align with the sequence + [OEIS 003158](http://oeis.org/A003158). Adding a Negative @@ -191,7 +201,8 @@ Adding a Negative Another simple modification to the Pell numbers is the recurrence $\langle 2,\bar{1}|$. The sequence produced from $0, 1$ is $2, 3, 4, 5...$, which are just the natural numbers. -Since 2 still bounds (the absolute values of) the numbers in the recurrence, the binary alphabet still makes sense. +Since 2 still bounds (the absolute values of) the numbers in the recurrence, the binary alphabet + still makes sense. Consider two expansions of 2 as below: $$ @@ -203,7 +214,8 @@ $$ $$ In all of these expansions, the sum of the digits (or digital root) is 2. -This is similar to the degenerate "positional" system of unary, where the magnitude of the number is just its length in tally marks. +This is similar to the degenerate "positional" system of unary, where the magnitude of the number + is just its length in tally marks. The empty string signifies 0, "1" signifies 1, "11" signifies 2, and so on. Expansions in unary and in the naturals are as follows: @@ -234,7 +246,8 @@ $20 = 101$ is equivalent to the equation $2x = (x + 1) + (x - 1)$. ### Worse than Unary? -Looking at the polynomial $\langle 2, -1|$ a little closer, this is clearly the polynomial $x^2 - 2x + 1 = (x - 1)^2$. +Looking at the polynomial $\langle 2, -1|$ a little closer, this is clearly the polynomial + $x^2 - 2x + 1 = (x - 1)^2$. This polynomial only has one as a root. The Jacobsthal carry also had one as a root in its polynomial, so maybe is the source of the odd behavior. @@ -256,12 +269,14 @@ While a well-defined counting system *can* arise from carries with negative numb Conjecture of Validity ---------------------- -After the experimentation in this article, I can now make claims about whether or not a polynomial is "valid" for counting. +After the experimentation in this article, I can now make claims about whether or not a polynomial is + "valid" for counting. ### Positive Carries -Systems like those based on the golden ($\langle 1,1 |$) and silver ratios ($\langle 2,1|$) have carries with "nice" coefficients. +Systems like those based on the golden ($\langle 1,1 |$) and silver ratios ($\langle 2,1|$) have carries + with "nice" coefficients. To ensure that situations like the Jacobsthal base ($\langle 1, 2|$) do not occur, I prefer carries which are irreducible and of the form @@ -288,24 +303,30 @@ Due to the generation of a secondary rule, I choose to call these carries *impli Importantly for the valid bases, there is only a single negative term among all the positive terms. It describes the way in which a particular numeral "flows" into adjacent place values. -Reducible polynomials like the Jacobsthal one must have two integer roots, meaning that expansions have to conform to both bases simultaneously. +Reducible polynomials like the Jacobsthal one must have two integer roots, meaning that expansions + have to conform to both bases simultaneously. Quadratic polynomials like this have the form: $(x - m)(x - n) = x^2 - (m+n)x + mn$, with $m$ and $n$ integers. -The constant term is a product, so it grows faster than a sum and fortunately these kinds of polynomials are rare (with the restriction given). +The constant term is a product, so it grows faster than a sum; + consquently, these kinds of polynomials are rare (with the restriction given). ### Negative Terms -The (valid) strings produced before by multiplying $x - 1$ into the carry have only one term with opposite sign from the rest. +The (valid) strings produced before by multiplying $x - 1$ into the carry have only one term with + opposite sign from the rest. Therefore, we might dream up carries with a single positive term among all of the negatives. Like "2" in phinary, this positive term is the largest weight which can appear in the alphabet. -One must take special care with the sum of terms in the carry. $\langle 2,\bar{1}|$ is valid, but $\langle 1,\bar{1}|$ is not. +One must take special care with the sum of terms in the carry. $\langle 2,\bar{1}|$ is valid, but + $\langle 1,\bar{1}|$ is not. The sum of the entries in the former is 1, while sum of the latter's is 0. Both of these are actually off by one due due to the highest term of the monic polynomial. The *true* digital roots are 0 and -1 respectively. -The latter implies that the digital root of an expansion is unbounded, and this can be seen with $\langle 1, \bar{1}|$. +The latter implies that the digital root of an expansion is unbounded, and this can be seen with + $\langle 1, \bar{1}|$. -In other words, the single positive term must be at least 1 greater than the negative of the sum of the remaining terms. +In other words, the single positive term must be at least 1 greater than the negative of the sum + of the remaining terms. $$ \begin{gather*} @@ -315,11 +336,12 @@ $$ \end{gather*} $$ -Since these carries directly describe the rule for expanding the largest numeral, I refer to these carries as *explicit*. +Since these carries directly describe the rule for expanding the largest numeral, I refer to these + carries as *explicit*. In fact, the carry polynomials in these systems need not be monic. -The only restriction is that all terms but one have the same sign, and that the remaining term dominates the rest - (meaning the polynomial has a negative value when evaluated at 1). +The only restriction is that all terms but one have the same sign, and that the remaining term + dominates the rest (meaning the polynomial has a negative value when evaluated at 1). This is a complicated matter which I will not be delving into. @@ -327,7 +349,8 @@ Closing ------- Polynomials with roots with magnitude 1 (but are not equal to 1) are a bit tricky to deal with. -Again with regards to $\langle 1,2|$, the expansion for 2 was only achieved after assuming an infinite application of carries converged. +Again with regards to $\langle 1,2|$, the expansion for 2 was only achieved after assuming an infinite + application of carries converged. Enough has been said about $\langle 1, \bar{1}|$ to disqualify it. This polynomial belongs to a family called [cyclotomic polynomials](https://en.wikipedia.org/wiki/Cyclotomic_polynomial), diff --git a/polycount/3/index.qmd b/polycount/3/index.qmd index 8a9991b..375ae72 100644 --- a/polycount/3/index.qmd +++ b/polycount/3/index.qmd @@ -1,5 +1,7 @@ --- title: "Polynomial Counting 3: The third degree" +description: | + Interesting results on simple irrational counting systems involving only zero and one. format: html: html-math-method: katex @@ -11,20 +13,26 @@ categories: - phinary - binary - python +execute: + code-fold: true --- ```{python} #| echo: false from IPython.display import Markdown -from sympy import latex from tabulate import tabulate + +import sympy +from sympy.abc import x + import matplotlib.pyplot as plt color = lambda c, text: f"{text}" ``` -This post assumes you have read the [first](../1) post, which introduces generalized positional counting, and the [second](../2), which restricts the focus and specifies the general aim. +This post assumes you have read the [first](../1) post, which introduces generalized positional counting, + and the [second](../2), which restricts the focus and specifies the general aim. Thus far, the systems have been based on quadratic polynomials and two-term linear recurrences, or more directly, carries of width two. @@ -35,11 +43,13 @@ With that in mind, let's go back to things closer to phinary and Fibonacci. Tribonacci and Beyond --------------------- -The *Tribonacci numbers* ([OEIS A000073](http://oeis.org/A000073)) come from elongating the Fibonacci recurrence to 3 terms. +The *Tribonacci numbers* ([OEIS A000073](http://oeis.org/A000073)) come from elongating the + Fibonacci recurrence to 3 terms. In other words, this is the carry/recurrence $\langle 1,1,1|$. -The Tribonacci numbers are seeded with two zeros followed by a single one; thus, the sequence begins $0, 0, 1, 1, 2, 4, 7, 13,\dots$ -The *Tribonacci constant* is the limiting ratio of these numbers (i.e., the positive real root of $x^3 - x^2 - x - 1$) with approximate value - $T = 1.8393\dots$ +The Tribonacci numbers are seeded with two zeros followed by a single one; + thus, the sequence begins $0, 0, 1, 1, 2, 4, 7, 13,\dots$ +The *Tribonacci constant* is the limiting ratio of these numbers + (i.e., the positive real root of $x^3 - x^2 - x - 1$) with approximate value $T = 1.8393\dots$ The number two bounds both this number and the terms in the recurrence, so its expansion can be deduced: @@ -390,12 +400,10 @@ While the width-two spacing is a irreducible polynomial like its predecessors, the width-three one can be factored ```{python} -from sympy.abc import x - def spacing(width): return x**(width + 2) - x**(width + 1) - 1 -spacing(3).factor() +sympy.Eq(spacing(3), spacing(3).factor()) ``` This also means that despite $\rho$ and $\psi$ being cubic roots, @@ -469,12 +477,14 @@ The width-three spacing is not fundamental, since it can be factored. We can collect reducible spacings into a table: ```{python} +#| echo: false + is_irreducible = lambda p: len(p.factor().as_ordered_factors()) == 1 display = lambda x: color("green", "Yes") if x else color("red", "No") Markdown(tabulate( zip(*( - [["*n*", "Irreducible?"]] + [["*n*-spacing", "Irreducible?"]] + [[ str(i), display(is_irreducible(spacing(i))) ] for i in range(20)] )) )) @@ -596,13 +606,13 @@ repeating_pair = lambda n: (x**n * (x**2 - x - 1) + x + 1).expand().factor() Markdown(tabulate( zip(*( - [["*n*", "Irreducible?"]] + [["*n*-repeat", "Irreducible?"]] + [[ str(i), display(is_irreducible(repeating_pair(i))) ] for i in range(1, 10)] )) )) ``` -For $n$ = 5, the polynomial factors as the product of $\langle 1, 0, 0, 1|$ and $\langle 0, 1, 1|$. +For $n = 5$, the polynomial factors as the product of $\langle 1, 0, 0, 1|$ and $\langle 0, 1, 1|$. The second factor should come as no surprise since we know directly that $0.11_\rho = 10_\rho$ and we already evaluated $10_{\rho} = 1.\underline{00001}_\rho$ @@ -610,6 +620,7 @@ Checking more $n$, this polynomial actually seems to be the only reducible one f ```{python} #| freeze: true +#| code-fold: false all(is_irreducible(repeating_pair(i)) for i in range(10, 100)) ``` diff --git a/polycount/4/index.qmd b/polycount/4/index.qmd index e2e9e4d..eabcdc2 100644 --- a/polycount/4/index.qmd +++ b/polycount/4/index.qmd @@ -1,5 +1,7 @@ --- title: "Polynomial Counting 4: Two 2's" +description: | + Using irrational fractional counting systems to generate chaotic behavior. format: html: html-math-method: katex diff --git a/polycount/5/index.qmd b/polycount/5/index.qmd index 72461d1..414ea4d 100644 --- a/polycount/5/index.qmd +++ b/polycount/5/index.qmd @@ -1,5 +1,7 @@ --- title: "Polynomial Counting 5: Pentamerous multiplication" +description: | + Arithmetic in non-geometric integral systems and surprisingly regular errors therein. format: html: html-math-method: katex @@ -8,7 +10,7 @@ date-modified: "2025-02-12" jupyter: python3 categories: - algebra - - haskell + - python ---