parent, f) |
INPUT: parent -- a number field f -- defines an element of a number field.
The following examples illustrate creation of elements of number fields, and some basic arithmetic.
First we define a polynomial over Q.
sage: from rational_field import RationalField sage: from polynomial_ring import PolynomialRing sage: from number_field import NumberField sage: x = PolynomialRing(RationalField()).gen() sage: f = x**2 + 1
Next we use f to define the number field.
sage: K = NumberField(f, "a"); K Number Field in a with defining polynomial x^2 + 1 sage: a = K.gen() sage: a**2 -1 sage: (a+1)**2 2*a sage: a**2 -1 sage: z = K(5); 1/z 1/5
We create a cube root of 2.
sage: K = NumberField(x**3 - 2, "b") sage: b = K.gen() sage: b**3 2 sage: (b**2 + b + 1)**3 12*b^2 + 15*b + 19
charpoly,
list,
matrix,
minpoly,
norm,
order,
pari,
polynomial,
trace
Further documentation:
) |
The matrix of right multiplication by the element on the power
basis
for the number field. Thus
the rows of this matrix give the images of each of the
.
[var=None]) |
Return PARI representation of self.
Instances of class NumberFieldElement also have the following special functions:
__add__,
__cmp__,
__div__,
__int__,
__invert__,
__long__,
__mul__,
__neg__,
__pow__,
__radd__,
__rdiv__,
__rmul__,
__rsub__,
__sub__
Further documentation:
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
See About this document... for information on suggesting changes.