166 lines
6.1 KiB
Plaintext
166 lines
6.1 KiB
Plaintext
---
|
|
title: "Polynomial Counting 4, Addendum"
|
|
description: |
|
|
Complex embeddings of irrational -adic expansions.
|
|
format:
|
|
html:
|
|
html-math-method: katex
|
|
date: "2021-02-09"
|
|
date-modified: "2025-02-12"
|
|
categories:
|
|
- algebra
|
|
- python
|
|
execute:
|
|
eval: false
|
|
---
|
|
|
|
|
|
After converting my original [Two 2's post](../), I found myself much more pleased after making the
|
|
diagrams it more reproducible.
|
|
However, I noticed some things which required further examination.
|
|
|
|
|
|
Balanced vs. Binary *κ*-adics
|
|
-----------------------------
|
|
|
|
In the parent post, it was discussed that the integer four has a non-repeating expansion
|
|
when expressed as an *κ*-adic integer.
|
|
It followed in multiple ways from the repeating expansion of the integer two in the balanced ternary alphabet.
|
|
A more unusual consequence of this is that despite the initial choice of alphabet,
|
|
[negative numerals could be cleared](../#all-positive)
|
|
from the expansion by using an extra-greedy borrow.
|
|
|
|
These choices actually only differ in only one significant way: the choice of integer division function.
|
|
In Haskell, there exists both `quotRem` and `divMod`, with the two disagreeing on negative remainders:
|
|
|
|
::: {.row layout-ncol="2"}
|
|
```{haskell}
|
|
quotRem (-27) 5
|
|
```
|
|
|
|
```{haskell}
|
|
divMod (-27) 5
|
|
```
|
|
:::
|
|
|
|
We can factor our choice out of our two digit-wide carry function by presenting it as an argument:
|
|
|
|
```{haskell}
|
|
-- Widened carry of a particular repeated amount
|
|
-- i.e., for carry qr 2, the carry is 22 = 100
|
|
carry2' qr b = carry' []
|
|
where carry' zs (x:y:z:xs)
|
|
| q == 0 = carry' (x:zs) (y:z:xs) -- try carrying at a higher place value
|
|
| otherwise = foldl (flip (:)) ys zs -- carry here
|
|
where ys = r : y-x+r : z+q : xs
|
|
(q, r) = x `qr` b
|
|
```
|
|
|
|
Finally, let's show the iterates of applying this function to "4".
|
|
We happen to know the root for $\langle 2, 2|$ is $\sqrt 3 + 1$, so using an approximation,
|
|
we can check that we get a roughly constant value by evaluating at each step.
|
|
|
|
```{haskell}
|
|
{-| layout-ncol: 2 -}
|
|
{-| code-fold: true -}
|
|
|
|
import IHaskell.Display
|
|
|
|
-- Horner evaluation on polynomials of ascending powers
|
|
hornerEval x = foldr (\c a -> a * x + c) 0
|
|
-- Pair a polynomial with its evaluation at x
|
|
pairEval x = (,) <*> hornerEval x . map fromIntegral
|
|
|
|
-- Directly expand the integer `n`, using the `carry` showing each step for `count` steps
|
|
expandSteps count carry n = take count $ iterate carry $ n:replicate count 0
|
|
|
|
cendree4QuotRem10Steps = map (pairEval (sqrt 3 + 1)) $ expandSteps 10 (carry2' quotRem 2) 4
|
|
cendree4DivMod10Steps = map (pairEval (sqrt 3 + 1)) $ expandSteps 10 (carry2' divMod 2) 4
|
|
|
|
markdown "`quotRem`"
|
|
markdown "`divMod`"
|
|
putStrLn . unlines . map show $ cendreeQuotRem10Steps
|
|
putStrLn . unlines . map show $ cendreeDivMod10Steps
|
|
```
|
|
|
|
And fortunately, regardless of which function we pick, the iterates are all roughly four.
|
|
Note that since `quotRem` allows negative remainders, implementing the carry with it causes
|
|
negative numbers to show up in our expansions.
|
|
Conversely, negative numbers *cannot* show up if we use `divMod`.
|
|
|
|
|
|
### Chaos before Four
|
|
|
|
Recall the series for two in the *κ*-adics:
|
|
|
|
$$
|
|
2 = ...1\bar{1}1\bar{1}1\bar{1}100_{\kappa}
|
|
$$
|
|
|
|
Since the `divMod` implementation clears negative numbers from expansions, we can try using it on this series.
|
|
The result is another chaotic series:
|
|
|
|
```{haskell}
|
|
cendree2DivModCycleExpansion = take 11 $ iterate (carry2' divMod 2) $ take 15 $ 0:0:cycle [1,-1]
|
|
putStrLn . unlines . map show $ cendree2DivModCycleExpansion
|
|
```
|
|
|
|
We get the same series if we expand 2 directly (which we can also use to check its validity):
|
|
|
|
```{haskell}
|
|
cendree2DivMod15Steps = map (pairEval (sqrt 3 + 1)) $ expandSteps 15 (carry2' divMod 2) 2
|
|
putStrLn . unlines . map show $ cendree2DivMod15Steps
|
|
```
|
|
|
|
We can *also* use this to get a series for negative one, a number which has a terminating expansion
|
|
in the balanced alphabet.
|
|
|
|
```{haskell}
|
|
cendreeNeg1DivMod15Steps = map (pairEval (sqrt 3 + 1)) $ expandSteps 15 (carry2' divMod 2) (-1)
|
|
putStrLn . unlines . map show $ cendreeNeg1DivMod15Steps
|
|
```
|
|
|
|
The most natural property of negative one should be that if we add one to it, we get zero.
|
|
If we take the last iterate of this, increment the zeroth place value, and apply the carry,
|
|
we find that everything clears properly.
|
|
|
|
```{haskell}
|
|
cendree0FromNeg1DivMod = (\(x:xs) -> (x + 1):xs) $ snd $ last cendreeNeg1DivMod15Steps
|
|
cendree0IncrementSteps = map (pairEval (sqrt 3 + 1)) $ take 15 $ iterate (carry2' divMod 2) cendree0FromNeg1DivMod
|
|
|
|
putStrLn . unlines . map show $ cendree0IncrementSteps
|
|
```
|
|
|
|
Naturally, it should be possible to use the the expansions of negative one and two in tandem on any
|
|
series in the balanced alphabet to convert it to the binary alphabet.
|
|
Actually demonstrating this and proving it is left as an exercise.
|
|
|
|
|
|
Are these really -adic?
|
|
-----------------------
|
|
|
|
Perhaps it is still unconvincing that expanding the integers in this way gives something that is
|
|
indeed related to *p*-adics.
|
|
The Wikipedia article on the [*p*-adic valuation](https://en.wikipedia.org/wiki/P-adic_valuation)
|
|
contains [a figure](https://commons.wikimedia.org/wiki/File:2adic12480.svg) whose description
|
|
provides a way to map *p*-adics into the complex numbers[^1].
|
|
The gist is to construct a Fourier series over truncations of numbers.
|
|
Each term of the series is weighted by a geometrically decreasing coefficient *c*.
|
|
|
|
$$
|
|
[...d_2 d_1 d_0]_p \mapsto e^{2\pi i [d_0] / p}
|
|
+ c e^{2\pi i [d_1 d_0] / p^2}
|
|
+ c^2 e^{2\pi i [d_2 d_1 d_0] / p^2}
|
|
+ ... \\
|
|
f(d; p) = \sum_{n = 0}^N c^n e^{2\pi i \cdot [d_{n:0}] / p^{n + 1}}
|
|
$$
|
|
|
|
Assuming the first term dominates, one way of interpreting this is that we place numbers
|
|
around the unit circle according to their one's place.
|
|
Then, we offset each by smaller circles, each centered on the last, using more and more digits.
|
|
This produces a fractal pattern that looks like a wheel with *p* spokes.
|
|
At each point on where the spokes meet the rim, there is another wheel with *p* spokes, ad infinitum.
|
|
|
|
[^1]: Taken from the paper "Fractal geometry for images of continuous embeddings of p-adic
|
|
numbers and solenoids into Euclidean spaces" (DOI: 10.1007/BF02073866).
|