-
classmethod galois.Poly.Roots(roots: ArrayLike, multiplicities: Sequence[int] | ndarray | None =
None
, field: type[Array] | None =None
) Self Constructs a monic polynomial over
from its roots.- Parameters:¶
- Returns:¶
The polynomial
.
Notes
The polynomial
with roots with multiplicities iswith degree
.Examples
Construct a polynomial over
from a list of its roots.In [1]: roots = [0, 0, 1] In [2]: f = galois.Poly.Roots(roots); f Out[2]: Poly(x^3 + x^2, GF(2)) # Evaluate the polynomial at its roots In [3]: f(roots) Out[3]: GF([0, 0, 0], order=2)
Construct a polynomial over
from a list of its roots with specific multiplicities.In [4]: GF = galois.GF(3**5) In [5]: roots = [121, 198, 225] In [6]: f = galois.Poly.Roots(roots, multiplicities=[1, 2, 1], field=GF); f Out[6]: Poly(x^4 + 215x^3 + 90x^2 + 183x + 119, GF(3^5)) # Evaluate the polynomial at its roots In [7]: f(roots) Out[7]: GF([0, 0, 0], order=3^5)