Finite Fields

simula.finite_field.finite_field.GF

alias of simula.finite_field.finite_field.FiniteField

class simula.finite_field.finite_field.FiniteField(q, gen=None, ideal=None, **kwargs)

Finite field operations.

Paramètres
  • 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 and poly2

from_ComplexField(a, K0)

Convert a complex element to dtype.

from_FF_gmpy(a, K0=None)

Convert ModularInteger(mpz) to dtype.

from_FF_python(a, K0=None)

Convert ModularInteger(int) to dtype.

from_QQ_gmpy(a, K0=None)

Convert GMPY’s mpq to dtype.

from_QQ_python(a, K0=None)

Convert Python’s Fraction to dtype.

from_Rational(a, K0=None)

Convert Python’s Fraction to dtype.

from_RealField(a, K0)

Convert mpmath’s mpf to dtype.

from_ZZ_gmpy(a, K0=None)

Convert GMPY’s mpz to dtype.

from_ZZ_python(a, K0=None)

Convert Python’s int to dtype.

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 of n in self.

is_prime_field()

Tests if self is a prime field.

is_square(pol)

Tests if pol is a square in self.

modulus()

Returns the modulus polynomial of self.

objgen()

Returns self and the generator of self.

order(pol=None)

Returns the order of self if pol=None otherwise returns the order of pol.

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 if pol is a nonzero square in self, -1 if pol is not a square in self and 0 otherwise.

quo(poly1, poly2)

Quotient of poly1 and poly2

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.