galois.conway_poly

galois.conway_poly(characteristic, degree)

Returns the Conway polynomial \(C_{p,m}(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

A Conway polynomial is a an irreducible and primitive polynomial over \(\mathrm{GF}(p)\) that provides a standard representation of \(\mathrm{GF}(p^m)\) as a splitting field of \(C_{p,m}(x)\). Conway polynomials provide compatability between fields and their subfields, and hence are the common way to represent extension fields.

The Conway polynomial \(C_{p,m}(x)\) is defined as the lexicographically-minimal monic primitive polynomial of degree \(m\) over \(\mathrm{GF}(p)\) that is compatible with all \(C_{p,n}(x)\) for \(n\) dividing \(m\).

This function uses Frank Luebeck’s Conway polynomial database for fast lookup, not construction.

Parameters
  • characteristic (int) – The prime characteristic \(p\) of the field \(\mathrm{GF}(p)\).

  • degree (int) – The degree \(m\) of the Conway polynomial and degree of the extension field \(\mathrm{GF}(p^m)\).

Returns

The degree-\(m\) Conway polynomial \(C_{p,m}(x)\) over \(\mathrm{GF}(p)\).

Return type

galois.Poly

Raises

LookupError – If the Conway polynomial \(C_{p,m}(x)\) is not found in Frank Luebeck’s database.

Examples

In [1]: galois.conway_poly(2, 100)
Out[1]: Poly(x^100 + x^57 + x^56 + x^55 + x^52 + x^48 + x^47 + x^46 + x^45 + x^44 + x^43 + x^41 + x^37 + x^36 + x^35 + x^34 + x^31 + x^30 + x^27 + x^25 + x^24 + x^22 + x^20 + x^19 + x^16 + x^15 + x^11 + x^9 + x^8 + x^6 + x^5 + x^3 + 1, GF(2))

In [2]: galois.conway_poly(7, 13)
Out[2]: Poly(x^13 + 6x^2 + 4, GF(7))

Notice primitive_poly() returns the lexicographically-minimal primitive polynomial, where conway_poly() returns the lexicographically-minimal primitive polynomial that is consistent with smaller Conway polynomials.

In [3]: galois.primitive_poly(7, 10)
Out[3]: Poly(x^10 + 5x^2 + x + 5, GF(7))

In [4]: galois.conway_poly(7, 10)
Out[4]: Poly(x^10 + x^6 + x^5 + 4x^4 + x^3 + 2x^2 + 3x + 3, GF(7))