Type NumberFieldElement
object
--+
|
Element
--+
|
NumberFieldElement
An element of a number field.
EXAMPLES: The following examples illustrate creation of elements of
number fields, and some basic arithmetic.
First we define a polynomial over Q.
>>> from rational_field import RationalField
>>> from polynomial_ring import PolynomialRing
>>> from number_field import NumberField
>>> x = PolynomialRing(RationalField()).gen()
>>> f = x**2 + 1
Next we use f to define the number field.
>>> K = NumberField(f, "a"); K
Number Field with defining polynomial x^2 + 1
>>> a = K.gen()
>>> a**2
-1
>>> (a+1)**2
2*a
>>> a**2
-1
>>> z = K(5); 1/z
1/5
We create a cube root of 2.
>>> K = NumberField(x**3 - 2, "b")
>>> b = K.gen()
>>> b**3
2
>>> (b**2 + b + 1)**3
12*b^2 + 15*b + 19
Method Summary |
|
__init__(self,
parent,
f)
|
|
__add__(self,
other)
|
|
__cmp__(self,
other)
|
|
__div__(self,
other)
|
|
__int__(self)
|
|
__invert__(self)
|
|
__long__(self)
|
|
__mul__ (self,
other)
Returns the product of self and other as elements of a number field. |
|
__neg__(self)
|
|
__pow__(self,
right)
|
|
__radd__(self,
left)
|
|
__rdiv__(self,
left)
|
|
__repr__(self)
|
|
__rmul__(self,
left)
|
|
__rsub__(self,
left)
|
|
__sub__(self,
other)
|
|
charpoly(self)
|
|
list(self)
|
|
matrix (self)
The matrix of left multiplication by the element on the power basis 1,
x, x^2, ..., x^(d-1) for the number field. |
|
minpoly(self)
|
|
norm(self)
|
|
order(self)
|
|
pari (self,
var)
Return PARI representation of self. |
|
polynomial(self)
|
|
trace(self)
|
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) |
__mul__(self,
other)
Returns the product of self and other as elements of a number field.
NOTES: In LiDIA, they build a multiplication table for the
number field, so it's not necessary to reduce modulo the
defining polynomial every time:
src/number_fields/algebraic_num/order.cc: compute_table
-
|
matrix(self)
The matrix of left multiplication by the element on the power basis
1, x, x^2, ..., x^(d-1) for the number field.
-
|
pari(self,
var=None)
Return PARI representation of self.
-
|