galois.Poly.is_square_free() bool

Determines whether the polynomial \(f(x)\) over \(\mathrm{GF}(q)\) is square-free.

Returns

True if the polynomial is square-free.

Important

This is a method, not a property, to indicate this test is computationally expensive.

Notes

A square-free polynomial \(f(x)\) has no irreducible factors with multiplicity greater than one. Therefore, its canonical factorization is

\[f(x) = \prod_{i=1}^{k} g_i(x)^{e_i} = \prod_{i=1}^{k} g_i(x) .\]

Examples

Generate irreducible polynomials over \(\mathrm{GF}(3)\).

In [1]: GF = galois.GF(3)

In [2]: f1 = galois.irreducible_poly(3, 3); f1
Out[2]: Poly(x^3 + 2x + 1, GF(3))

In [3]: f2 = galois.irreducible_poly(3, 4); f2
Out[3]: Poly(x^4 + x + 2, GF(3))

Determine if composite polynomials are square-free over \(\mathrm{GF}(3)\).

In [4]: (f1 * f2).is_square_free()
Out[4]: True

In [5]: (f1**2 * f2).is_square_free()
Out[5]: False