Finite Fields¶
-
simula.finite_field.finite_field.
GF
¶
-
class
simula.finite_field.finite_field.
FiniteField
(q, gen=None, ideal=None, **kwargs)¶ Finite field operations.
- Parameters
q – a prime power p^n
gen – (optional) a generator of
self
.ideal – (optional) an irreducible polynomial which is used to construct
self
kwargs –
EXAMPLES:
simula : G.<a> = GF(9); G Finite Field of 9 elements defined by the quotient of F_3[a] by the ideal <a^2 + 2a + 2> simula : {0, 1, 2, a + 1, 2a, a, 2a + 2, a + 2, 2a + 1} simula : G(a^3-a^2-a+2) 2 simula : f = G(a+1); f a + 1 simula : f^-1 2a + 2 simula : (2a + 2) * f 1 simula : a*f 2a + 1
-
cardinality
()¶ Returns the cardinality of
self
.
-
characteristic
()¶ Returns the characteristic of
self
.
-
exponential
(prim_elt=None)¶ Returns an exponential representation of
self
.
-
exquo
(poly1, poly2)¶ Exact quotient of
poly1
andpoly2
-
from_ComplexField
(a, K0)¶ Convert a complex element to
dtype
.
-
from_FF_gmpy
(a, K0=None)¶ Convert
ModularInteger(mpz)
todtype
.
-
from_FF_python
(a, K0=None)¶ Convert
ModularInteger(int)
todtype
.
-
from_QQ_gmpy
(a, K0=None)¶ Convert GMPY’s
mpq
todtype
.
-
from_QQ_python
(a, K0=None)¶ Convert Python’s
Fraction
todtype
.
-
from_Rational
(a, K0=None)¶ Convert Python’s
Fraction
todtype
.
-
from_RealField
(a, K0)¶ Convert mpmath’s
mpf
todtype
.
-
from_ZZ_gmpy
(a, K0=None)¶ Convert GMPY’s
mpz
todtype
.
-
from_ZZ_python
(a, K0=None)¶ Convert Python’s
int
todtype
.
-
from_sympy
(a)¶ Convert SymPy’s Element to GF element
-
gen
()¶ Returns the generator of
self
.
-
get_elements
()¶ Returns all elements of
self
.
-
get_field
()¶ Returns a field associated with
self
.
-
get_prime_field
()¶ Returns all elements of the prime sub-field of
self
.
-
get_primitive_element
()¶ Get a primitive element.
-
inv
(pol)¶ Returns the inverse of
pol
if it exists.
-
inverse
(pol)¶ Returns the inverse of
pol
if it exists.
-
is_nth_power
(pol, n)¶ Tests if
pol
is a power ofn
inself
.
-
is_prime_field
()¶ Tests if
self
is a prime field.
-
is_square
(pol)¶ Tests if
pol
is a square inself
.
-
modulus
()¶ Returns the modulus polynomial of
self
.
-
objgen
()¶ Returns
self
and the generator ofself
.
-
order
(pol=None)¶ Returns the order of
self
ifpol=None
otherwise returns the order ofpol
.
-
prime_subfield
()¶ Returns a field associated with
self
.
-
primitive_elements
()¶ Returns all primitive elements of
self
.
-
quadratic_character
(pol)¶ Returns \(\chi(pol)\) which is equal to
1
ifpol
is a nonzero square inself
,-1
ifpol
is not a square inself
and0
otherwise.
-
quo
(poly1, poly2)¶ Quotient of
poly1
andpoly2
-
random_element
()¶ Returns a random element in
self
.
-
sqrt
(a)¶ Returns the square root of
a
if it exists.
-
sub_group_generatedby
(pol)¶ Returns the sub group generated by
self
.
-
to_sympy
(elt)¶ Convert
a
to a sympy object.