Home | Trees | Index | Help |
|
---|
Package sage :: Package rings :: Module finite_field_element :: Class 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 | |
---|---|
Create element of a finite field. | |
__abs__(self)
| |
__add__(self,
right)
| |
Compare an element of a finite field with other. | |
__div__(self,
right)
| |
__float__(self)
| |
__int__(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)
| |
Returns the characteristic polynomial of this element. | |
Return a copy of this element. | |
Returns True if and only if this element is a perfect square. | |
If this element lies in a prime finite field, return a lift of this element to an integer. | |
Returns the norm of this element, which is the constant term of the characteristic polynomial, i.e., the determinant of left multiplication. | |
Returns the order of self. | |
Return PARI object corresponding to this finite field element. | |
Elements of a finite field are represented as a polynomial modulo a modulus. | |
If the parent field is a prime field, uses rational reconstruction to try to find a lift of this element to the rational numbers. | |
Returns the trace of this element. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Method Details |
---|
__init__(self,
parent,
value)
|
__cmp__(self,
other)
|
__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.
|
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() aThe 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 |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon May 9 17:57:02 2005 | http://epydoc.sf.net |