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
selfkwargs –
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
poly1andpoly2
-
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
mpqtodtype.
-
from_QQ_python(a, K0=None)¶ Convert Python’s
Fractiontodtype.
-
from_Rational(a, K0=None)¶ Convert Python’s
Fractiontodtype.
-
from_RealField(a, K0)¶ Convert mpmath’s
mpftodtype.
-
from_ZZ_gmpy(a, K0=None)¶ Convert GMPY’s
mpztodtype.
-
from_ZZ_python(a, K0=None)¶ Convert Python’s
inttodtype.
-
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
polif it exists.
-
inverse(pol)¶ Returns the inverse of
polif it exists.
-
is_nth_power(pol, n)¶ Tests if
polis a power ofninself.
-
is_prime_field()¶ Tests if
selfis a prime field.
-
is_square(pol)¶ Tests if
polis a square inself.
-
modulus()¶ Returns the modulus polynomial of
self.
-
objgen()¶ Returns
selfand the generator ofself.
-
order(pol=None)¶ Returns the order of
selfifpol=Noneotherwise 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
1ifpolis a nonzero square inself,-1ifpolis not a square inselfand0otherwise.
-
quo(poly1, poly2)¶ Quotient of
poly1andpoly2
-
random_element()¶ Returns a random element in
self.
-
sqrt(a)¶ Returns the square root of
aif it exists.
-
sub_group_generatedby(pol)¶ Returns the sub group generated by
self.
-
to_sympy(elt)¶ Convert
ato a sympy object.