- galois.FieldArray.minimal_poly() Poly
Computes the minimal polynomial of a finite field element \(a\).
Important
This function may only be invoked on a single finite field element (scalar 0-D array).
- Returns¶
For scalar inputs, the minimal polynomial \(m_a(x)\) of \(a\) over \(\mathrm{GF}(p)\).
Notes¶
An element \(a\) of \(\mathrm{GF}(p^m)\) has minimal polynomial \(m_a(x)\) over \(\mathrm{GF}(p)\). The minimal polynomial when evaluated in \(\mathrm{GF}(p^m)\) annihilates \(a\), that is \(m_a(a) = 0\). The minimal polynomial always divides the characteristic polynomial. In prime fields \(\mathrm{GF}(p)\), the minimal polynomial of \(a\) is simply \(m_a(x) = x - a\).
References¶
https://en.wikipedia.org/wiki/Minimal_polynomial_(field_theory)
https://en.wikipedia.org/wiki/Minimal_polynomial_(linear_algebra)
Examples¶
The minimal polynomial of the element \(a\).
In [1]: GF = galois.GF(3**5) In [2]: a = GF.Random(); a Out[2]: GF(231, order=3^5) In [3]: poly = a.minimal_poly(); poly Out[3]: Poly(x^5 + x^4 + x^2 + 2x + 2, GF(3)) # The minimal polynomial annihilates a In [4]: poly(a, field=GF) Out[4]: GF(0, order=3^5) # The minimal polynomial always divides the characteristic polynomial In [5]: divmod(a.characteristic_poly(), poly) Out[5]: (Poly(1, GF(3)), Poly(0, GF(3)))
In [6]: GF = galois.GF(3**5, display="poly") In [7]: a = GF.Random(); a Out[7]: GF(α^4 + α^3 + 2α^2 + 2α + 1, order=3^5) In [8]: poly = a.minimal_poly(); poly Out[8]: Poly(x^5 + 2x + 2, GF(3)) # The minimal polynomial annihilates a In [9]: poly(a, field=GF) Out[9]: GF(0, order=3^5) # The minimal polynomial always divides the characteristic polynomial In [10]: divmod(a.characteristic_poly(), poly) Out[10]: (Poly(1, GF(3)), Poly(0, GF(3)))
In [11]: GF = galois.GF(3**5, display="power") In [12]: a = GF.Random(); a Out[12]: GF(α^47, order=3^5) In [13]: poly = a.minimal_poly(); poly Out[13]: Poly(x^5 + 2x^3 + 2x^2 + x + 1, GF(3)) # The minimal polynomial annihilates a In [14]: poly(a, field=GF) Out[14]: GF(0, order=3^5) # The minimal polynomial always divides the characteristic polynomial In [15]: divmod(a.characteristic_poly(), poly) Out[15]: (Poly(1, GF(3)), Poly(0, GF(3)))