minor cleanups in finite-field.2

This commit is contained in:
queue-miscreant 2025-08-03 22:56:15 -05:00
parent 52913ce62d
commit 8d14c5b414

View File

@ -400,7 +400,7 @@ fromIndices ns = columns (\(_, f) r -> f r) (\(c, _) -> Headed c) $
fromIndices' = (singleton (Headed "m") head <>) . fromIndices fromIndices' = (singleton (Headed "m") head <>) . fromIndices
-- Symbolic representation of a power of a companion matrix (in Markdown) -- Symbolic representation of a power of a companion matrix (in Markdown)
compPowSymbolic "" m = "*f*((*C*)^*" ++ m ++ "*^)" compPowSymbolic "" m = "*f*(*C*^*" ++ m ++ "*^)"
compPowSymbolic x m = "*f*((*C*~*" ++ x ++ "*~)^*" ++ m ++ "*^)" compPowSymbolic x m = "*f*((*C*~*" ++ x ++ "*~)^*" ++ m ++ "*^)"
-- Spans of a given color -- Spans of a given color
@ -430,8 +430,9 @@ The polynomial *u* = ~2~31 occurs at positions 3, 6, 9, and 12
It follows that the roots of *u* are cyclic of order 5, so this polynomial is irreducible, It follows that the roots of *u* are cyclic of order 5, so this polynomial is irreducible,
but *not* primitive. but *not* primitive.
Naturally, $\hat U(X)$ can be factored as powers of (*C*~*s*~)^3^. Naturally, *u* (or a polynomial isomorphic to it) can be factored as powers of (*C*~*s*~)^3^.
We can also factor it more naively as powers of *C*~*u*~. Either way, we get the same sequence. We can also factor it more naively as powers of *C*~*u*~.
Either way, we get the same sequence.
:::: {layout-ncol="2" layout-valign="center"} :::: {layout-ncol="2" layout-valign="center"}
::: {} ::: {}
@ -681,7 +682,8 @@ leastDeg2Char3Poly = deg2Char3Polys !! 1
colorDeg3Char3 = colorByEval 3 [(14, "red"), (17, "blue")] colorDeg3Char3 = colorByEval 3 [(14, "red"), (17, "blue")]
markdown $ markdownTable (fromIndices' [1..8]) [ markdown $ markdownTable (fromIndices' [1..8]) [
"":map colorDeg3Char3 (charPolyPows 3 leastDeg2Char3Poly) compPowSymbolic "14" "m":
map colorDeg3Char3 (charPolyPows 3 leastDeg2Char3Poly)
] ]
``` ```
@ -697,15 +699,30 @@ Note that ${}_3 16 \sim 121_x = x^2 + 2x + 1$ and ${}_3 13 \sim 111_x = x^2 + x
both of which have factors over GF(3). both of which have factors over GF(3).
Power Graphs Irreducible Graphs
------------ ------------------
We can study the interplay of primitives, irreducibles, and their powers by converting We can study the interplay of primitives, irreducibles, and their powers by converting
our sequences into (directed) graphs. our sequences into (directed) graphs.
Each node in the graph represents a characteristic polynomial that appears over the field; Each node in the graph will represent an irreducible polynomial over the field.
call the one under consideration *a*. Call the one under consideration *a*.
If the sequence of polynomials generated by *C*~*a*~ contains contains another polynomial *b*, If the sequence of characteristic polynomials generated by powers of *C*~*a*~ contains
then there is an edge from *a* to *b*. contains another polynomial *b*, then there is an edge from *a* to *b*.
```{haskell}
-- Convert a polynomial to the integer representing it in characteristic n
asPolyNum n = evalPoly n . fmap (`mod` n)
irreducibleGraph d n = concatMap (\(x:xs) -> map (x,) xs) polyKinClasses where
-- All irreducible polynomials of degree d in characteristic n
irrsOfDegree' = irrsOfDegree d n
-- Get "kin" polynomials as integers -- all those who appear as characteristic
-- polynomials in the powers of its companion matrix
getKinPolys = map (asPolyNum n . charpoly) . matrixPowersMod n . companion
-- Kin classes corresponding to each irreducible polynomial,
-- which is the first entry
polyKinClasses = map (nub . take (n^d) . getKinPolys) irrsOfDegree'
```
We can do this for every GF(*p*^*m*^). We can do this for every GF(*p*^*m*^).
Let's start with the first few fields of characteristic 2. Let's start with the first few fields of characteristic 2.
@ -728,19 +745,6 @@ Here are a few more of these graphs after doing so, over fields of other charact
--| code-fold: true --| code-fold: true
--| fig-cap: "GF(9)" --| fig-cap: "GF(9)"
-- Convert a polynomial to the integer representing it in characteristic n
asPolyNum n = evalPoly n . fmap (`mod` n)
irreducibleGraph d n = concatMap (\(x:xs) -> map (x,) xs) polyKinClasses where
-- All irreducible polynomials of degree d in characteristic n
irrsOfDegree' = irrsOfDegree d n
-- Get "kin" polynomials as integers -- all those who appear as characteristic
-- polynomials in the powers of its companion matrix
getKinPolys = map (asPolyNum n . charpoly) . matrixPowersMod n . companion
-- Kin classes corresponding to each irreducible polynomial,
-- which is the first entry
polyKinClasses = map (nub . take (n^d) . getKinPolys) irrsOfDegree'
-- Characteristic polynomial of the identity matrix -- Characteristic polynomial of the identity matrix
eyePoly d n = asPolyNum n $ charpoly $ eye d eyePoly d n = asPolyNum n $ charpoly $ eye d
-- Remove edges directed toward the characteristic polynomial of the identity -- Remove edges directed toward the characteristic polynomial of the identity