Package sage :: Package rings :: Module finite_field_element :: Class FiniteFieldElement
[show private | hide private]
[frames | no frames]

Type FiniteFieldElement

object --+    
         |    
   Element --+
             |
            FiniteFieldElement


An element of a finite field.

Create elements by first defining the finite field F, then use the notation F(n), for n an integer. or let a = F.gen() and write the element in terms of a.
Method Summary
  __init__(self, parent, value)
Create element of a finite field.
  __abs__(self)
  __add__(self, right)
  __cmp__(self, other)
Compare an element of a finite field with other.
  __div__(self, right)
  __float__(self)
  __int__(self)
  __invert__(self)
EXAMPLES:
  __long__(self)
  __mul__(self, right)
  __neg__(self)
  __pos__(self)
  __pow__(self, right)
  __radd__(self, left)
  __rdiv__(self, left)
  __repr__(self)
  __rmul__(self, left)
  __rsub__(self, left)
  __sub__(self, right)
  charpoly(self)
Returns the characteristic polynomial of this element.
  copy(self)
Return a copy of this element.
  is_square(self)
Returns True if and only if this element is a perfect square.
  lift(self)
If this element lies in a prime finite field, return a lift of this element to an integer.
  norm(self)
Returns the norm of this element, which is the constant term of the characteristic polynomial, i.e., the determinant of left multiplication.
  order(self)
Returns the order of self.
  pari(self)
Return PARI object corresponding to this finite field element.
  polynomial(self)
Elements of a finite field are represented as a polynomial modulo a modulus.
  rational_reconstruction(self)
If the parent field is a prime field, uses rational reconstruction to try to find a lift of this element to the rational numbers.
  trace(self)
Returns the trace of this element.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self, parent, value)
(Constructor)

Create element of a finite field.

EXAMPLES:
>>> k = GF(9)
>>> a = k(11); a
2

>>> a.parent()
Finite field of size 3^2
Overrides:
sage.ext._element.Element.__init__

__cmp__(self, other)
(Comparison operator)

Compare an element of a finite field with other. If other is not an element of a finite field, an attempt is made to coerce it so it is one.

EXAMPLES:
>>> k = GF(3**3); a = k.gen()
>>> a == 1
False

>>> a**0 == 1
True

>>> a == a
True

>>> a < a^2
True

>>> a > a^2
False

__invert__(self)

EXAMPLES:
>>> k = GF(9); a = k.gen()
>>> ~a
a + 1

>>> (a+1)*a
1

charpoly(self)

Returns the characteristic polynomial of this element.

EXAMPLES:
    >> k = GF(3**3)
    >> a = k.gen()
    >> a.charpoly()
    x^3 + 2*x^2 + x + 1
    >> k.modulus()
    x^3 + 2*x^2 + x + 1
    >> b = a^2 + 1
    >> b.charpoly()
    x^3 + x^2 + x + 2

copy(self)

Return a copy of this element.

EXAMPLES:
>>> k = GF(3**3)
>>> a = k(5)
>>> a
2

>>> a.copy()
2

>>> b = a.copy()
>>> a == b
True

>>> a is b
False

>>> a is a
True

is_square(self)

Returns True if and only if this element is a perfect square.

EXAMPLES:
>>> k = GF(3**2)
>>> a = k.gen()
>>> a.is_square()
False

>>> (a**2).is_square()
True

>>> k = GF(2**2)
>>> a = k.gen()
>>> (a**2).is_square()
True

>>> k = GF(17**5); a = k.gen()
>>> (a**2).is_square()
True

>>> a.is_square()
False

lift(self)

If this element lies in a prime finite field, return a lift of this element to an integer.

EXAMPLES:
>>> k = GF(next_prime(10**10))
>>> a = k(17/19)
>>> b = a.lift(); b
7894736858

>>> b.parent()
Integer Ring

norm(self)

Returns the norm of this element, which is the constant term
of the characteristic polynomial, i.e., the determinant of left
multiplication. 

EXAMPLES:
    >> k = GF(3**3); a = k.gen()
    >> b = a**2 + 2
    >> b.charpoly()
    x^3 + x^2 + 2*x + 1
    >> b.trace()
    2
    >> b.norm()
    1

order(self)

Returns the order of self.
Overrides:
sage.ext._element.Element.order

pari(self)

Return PARI object corresponding to this finite field element.

EXAMPLES:
>>> k = GF(3**3)
>>> a = k.gen()
>>> b = a^2 + 2*a + 1
>>> b.pari()
Mod(Mod(1, 3)*a^2 + Mod(2, 3)*a + Mod(1, 3), Mod(1, 3)*a^3 + Mod(2, 3)*a + Mod(1, 3))
Looking at the PARI representation of a finite field element, it's no wonder people find PARI difficult to work with directly. Compare our representation:
>>> b
a^2 + 2*a + 1

>>> b.parent()
Finite field of size 3^3

polynomial(self)

Elements of a finite field are represented as a polynomial modulo a modulus. This functions returns the representating polynomial as an element of the polynomial ring over the prime finite field, with the same variable as the finite field.

EXAMPLES: The default variable is a:
>>> k = GF(3**2)
>>> k.gen().polynomial()
a
The variable can be any string.
>>> k = FiniteField(3**4, "alpha")
>>> a = k.gen()
>>> a.polynomial()
alpha

>>> (a**2 + 1).polynomial()
alpha^2 + 1

>>> (a**2 + 1).polynomial().parent()
Univariate Polynomial Ring in alpha over Finite field of size 3

rational_reconstruction(self)

If the parent field is a prime field, uses rational reconstruction to try to find a lift of this element to the rational numbers.

EXAMPLES:
>>> k = GF(97)
>>> a = k(Q('2/3'))
>>> a
33

>>> a.rational_reconstruction()
2/3

trace(self)

Returns the trace of this element.

EXAMPLES:
    >> k = GF(3**3); a = k.gen()
    >> b = a**2 + 2
    >> b.charpoly()
    x^3 + x^2 + 2*x + 1
    >> b.trace()
    2
    >> b.norm()
    1

Generated by Epydoc 2.1 on Mon Jun 20 15:43:22 2005 http://epydoc.sf.net