Module: sage.rings.number_field.number_field_element
Number Field Elements
Author Log:
Module-level Functions
) |
Return True if x is of type NumberFieldElement, i.e., an element of a number field.
sage: is_NumberFieldElement(2) False sage: k.<a> = NumberField(x^7 + 17*x + 1) sage: is_NumberFieldElement(a+1) True
Class: CoordinateFunction
Functions: alpha
Special Functions: __call__,
__init__,
__repr__
) |
) |
) |
Class: NumberFieldElement
sage: k.<a> = NumberField(x^3 + x + 1) sage: a^3 -a - 1
Functions: abs,
charpoly,
complex_embedding,
complex_embeddings,
conjugate,
coordinates_in_terms_of_powers,
denominator,
galois_conjugates,
is_integral,
is_square,
is_totally_positive,
list,
matrix,
minpoly,
multiplicative_order,
norm,
nth_root,
polynomial,
sqrt,
trace,
valuation,
vector
) |
Return the absolute value of this element with respect to the ith complex embedding of parent, to the given precision.
If prec is 53 (the default), then the complex double field is used; otherwise the arbitrary precision (but slow) complex field is used.
Input:
sage: z = CyclotomicField(7).gen() sage: abs(z) 1.0 sage: abs(z^2 + 17*z - 3) 16.06044268 sage: K.<a> = NumberField(x^3+17) sage: abs(a) 2.57128159066 sage: a.abs(prec=100) 2.5712815906582353554531872087 sage: a.abs(prec=100,i=1) 2.5712815906582353554531872087 sage: a.abs(100, 2) 2.5712815906582353554531872087
Here's one where the absolute value depends on the embedding.
sage: K.<b> = NumberField(x^2-2) sage: a = 1 + b sage: a.abs(i=0) 0.414213562373 sage: a.abs(i=1) 2.41421356237
) |
Return the i-th embedding of self in the complex numbers, to the given precision.
sage: k.<a> = NumberField(x^3 - 2) sage: a.complex_embedding() -0.629960524947 - 1.09112363597*I sage: a.complex_embedding(10) -0.63 - 1.1*I sage: a.complex_embedding(100) -0.62996052494743658238360530364 - 1.0911236359717214035600726142*I sage: a.complex_embedding(20, 1) -0.62996 + 1.0911*I sage: a.complex_embedding(20, 2) 1.2599
) |
Return the images of this element in the floating point complex numbers, to the given bits of precision.
Input:
sage: k.<a> = NumberField(x^3 - 2) sage: a.complex_embeddings() [-0.629960524947 - 1.09112363597*I, -0.629960524947 + 1.09112363597*I, 1.25992104989] sage: a.complex_embeddings(10) [-0.63 - 1.1*I, -0.63 + 1.1*I, 1.3] sage: a.complex_embeddings(100) [-0.62996052494743658238360530364 - 1.0911236359717214035600726142*I, -0.62996052494743658238360530364 + 1.0911236359717214035600726142*I, 1.2599210498948731647672106073]
) |
Return the complex conjugate of the number field element. Currently, this is implemented for cyclotomic fields and quadratic extensions of Q. It seems likely that there are other number fields for which the idea of a conjugate would be easy to compute.
sage: k.<I> = QuadraticField(-1) sage: I.conjugate() -I sage: (I/(1+I)).conjugate() -1/2*I + 1/2 sage: z6=CyclotomicField(6).gen(0) sage: (2*z6).conjugate() -2*zeta6 + 2
sage: K.<b> = NumberField(x^3 - 2) sage: b.conjugate() Traceback (most recent call last): ... NotImplementedError: complex conjugation is not implemented (or doesn't make sense).
) |
Let
be self. Return a Python function that takes any
element of the parent of self in
and writes it in
terms of the powers of
:
.
(NOT CACHED).
This function allows us to write elements of a number field in terms of a different generator without having to construct a whole separate number field.
sage: y = polygen(QQ,'y'); K.<beta> = NumberField(y^3 - 2); K Number Field in beta with defining polynomial y^3 - 2 sage: alpha = beta^2 + beta + 1 sage: c = alpha.coordinates_in_terms_of_powers(); c Coordinate function that writes elements in terms of the powers of beta^2 + beta + 1 sage: c(beta) [-2, -3, 1] sage: c(alpha) [0, 1, 0] sage: c((1+beta)^5) [3, 3, 3] sage: c((1+beta)^10) [54, 162, 189]
This function works even if self only generates a subfield of this number field.
sage: k.<a> = NumberField(x^6 - 5) sage: alpha = a^3 sage: c = alpha.coordinates_in_terms_of_powers() sage: c((2/3)*a^3 - 5/3) [-5/3, 2/3] sage: c Coordinate function that writes elements in terms of the powers of a^3 sage: c(a) Traceback (most recent call last): ... ArithmeticError: vector is not in free module
) |
Return the denominator of this element, which is by definition the denominator of the corresponding polynomial representation. I.e., elements of number fields are represented as a polynomial (in reduced form) modulo the modulus of the number field, and the denominator is the denominator of this polynomial.
sage: K.<z> = CyclotomicField(3) sage: a = 1/3 + (1/5)*z sage: print a.denominator() 15
) |
Return all Gal(Qbar/Q)-conjugates of this number field element in the field K.
In the first example the conjugates are obvious:
sage: K.<a> = NumberField(x^2 - 2) sage: a.galois_conjugates(K) [a, -a] sage: K(3).galois_conjugates(K) [3]
In this example the field is not Galois, so we have to pass to an extension to obtain the Galois conjugates.
sage: K.<a> = NumberField(x^3 - 2) sage: c = a.galois_conjugates(K); c [a] sage: K.<a> = NumberField(x^3 - 2) sage: c = a.galois_conjugates(K.galois_closure('a1')); c [1/84*a1^4 + 13/42*a1, -1/252*a1^4 - 55/126*a1, -1/126*a1^4 + 8/63*a1] sage: c[0]^3 2 sage: parent(c[0]) Number Field in a1 with defining polynomial x^6 + 40*x^3 + 1372 sage: parent(c[0]).is_galois() True
There is only one Galois conjugate of
in
.
sage: a.galois_conjugates(K) [a]
Galois conjugates of
in the field
:
sage: L.<a> = CyclotomicField(3).extension(x^3 - 2) sage: a.galois_conjugates(L) [a, (-zeta3 - 1)*a, zeta3*a]
) |
Determine if a number is in the ring of integers of this number field.
sage: K.<a> = NumberField(x^2 + 23) sage: a.is_integral() True sage: t = (1+a)/2 sage: t.is_integral() True sage: t.minpoly() x^2 - x + 6 sage: t = a/2 sage: t.is_integral() False sage: t.minpoly() x^2 + 23/4
An example in a relative extension:
sage: K.<a,b> = NumberField([x^2+1, x^2+3]) sage: (a+b).is_integral() True sage: ((a-b)/2).is_integral() False
) |
Return True if self is a square in its parent number field and otherwise return False.
Input:
sage: m.<b> = NumberField(x^4 - 1789) sage: b.is_square() False sage: c = (2/3*b + 5)^2; c 4/9*b^2 + 20/3*b + 25 sage: c.is_square() True sage: c.is_square(True) (True, 2/3*b + 5)
We also test the functional notation.
sage: is_square(c, True) (True, 2/3*b + 5) sage: is_square(c) True sage: is_square(c+1) False
) |
Returns True if self is positive for all real embeddings of its parent number field. We do nothing at complex places, so e.g. any element of a totally complex number field will return True.
sage: F.<b> = NumberField(x^3-3*x-1) sage: b.is_totally_positive() False sage: (b^2).is_totally_positive() True
) |
Return list of coefficients of self written in terms of a power basis.
) |
If base is None, return 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
.
If base is not None, then base must be either a field that embeds in the parent of self or a morphism to the parent of self, in which case this function returns the matrix of multiplication by self on the power basis, where we view the parent field as a field over base.
Input:
Regular number field:
sage: K.<a> = NumberField(QQ['x'].0^3 - 5) sage: M = a.matrix(); M [0 1 0] [0 0 1] [5 0 0] sage: M.base_ring() is QQ True
Relative number field:
sage: L.<b> = K.extension(K['x'].0^2 - 2) sage: M = b.matrix(); M [0 1] [2 0] sage: M.base_ring() is K True
Absolute number field:
sage: M = L.absolute_field('c').gen().matrix(); M [ 0 1 0 0 0 0] [ 0 0 1 0 0 0] [ 0 0 0 1 0 0] [ 0 0 0 0 1 0] [ 0 0 0 0 0 1] [-17 -60 -12 -10 6 0] sage: M.base_ring() is QQ True
More complicated relative number field:
sage: L.<b> = K.extension(K['x'].0^2 - a); L Number Field in b with defining polynomial x^2 - a over its base field sage: M = b.matrix(); M [0 1] [a 0] sage: M.base_ring() is K True
An example where we explicitly give the subfield or the embedding:
sage: K.<a> = NumberField(x^4 + 1); L.<a2> = NumberField(x^2 + 1) sage: a.matrix(L) [ 0 1] [a2 0]
Notice that if we compute all embeddings and choose a different one, then the matrix is changed as it should be:
sage: v = L.embeddings(K) sage: a.matrix(v[1]) [ 0 1] [-a2 0]
The norm is also changed:
sage: a.norm(v[1]) a2 sage: a.norm(v[0]) -a2
TESTS:
sage: F.<z> = CyclotomicField(5) ; t = 3*z**3 + 4*z**2 + 2 sage: t.matrix(F) [3*z^3 + 4*z^2 + 2]
) |
Return the minimal polynomial of this number field element.
sage: K.<a> = NumberField(x^2+3) sage: a.minpoly('x') x^2 + 3 sage: R.<X> = K['X'] sage: L.<b> = K.extension(X^2-(22 + a)) sage: b.minpoly('t') t^2 - a - 22 sage: b.absolute_minpoly('t') t^4 - 44*t^2 + 487 sage: b^2 - (22+a) 0
) |
Return the multiplicative order of this number field element.
sage: K.<z> = CyclotomicField(5) sage: z.multiplicative_order() 5 sage: (-z).multiplicative_order() 10 sage: (1+z).multiplicative_order() +Infinity
) |
Return the absolute or relative norm of this number field element.
If K is given then K must be a subfield of the parent L of self, in which case the norm is the relative norm from L to K. In all other cases, the norm is the absolute norm down to QQ.
sage: K.<a> = NumberField(x^3 + x^2 + x - 132/7); K Number Field in a with defining polynomial x^3 + x^2 + x - 132/7 sage: a.norm() 132/7 sage: factor(a.norm()) 2^2 * 3 * 7^-1 * 11 sage: K(0).norm() 0
Some complicated relatives norms in a tower of number fields.
sage: K.<a,b,c> = NumberField([x^2 + 1, x^2 + 3, x^2 + 5]) sage: L = K.base_field(); M = L.base_field() sage: a.norm() 1 sage: a.norm(L) 1 sage: a.norm(M) 1 sage: a a sage: (a+b+c).norm() 121 sage: (a+b+c).norm(L) 2*c*b - 7 sage: (a+b+c).norm(M) -11
We illustrate that norm is compatible with towers:
sage: z = (a+b+c).norm(L); z.norm(M) -11
If we are in an order, the norm is an integer:
sage: K.<a> = NumberField(x^3-2) sage: a.norm().parent() Rational Field sage: R = K.ring_of_integers() sage: R(a).norm().parent() Integer Ring
TESTS:
sage: F.<z> = CyclotomicField(5) sage: t = 3*z**3 + 4*z**2 + 2 sage: t.norm(F) 3*z^3 + 4*z^2 + 2
) |
Return an nth root of self in the given number field.
sage: K.<a> = NumberField(x^4-7) sage: K(7).nth_root(2) a^2 sage: K((a-3)^5).nth_root(5) a - 3
ALGORITHM:
Use Pari to factor
-
self
in K.
) |
Return the underlying polynomial corresponding to this number field element.
The resulting polynomial is currently *not* cached.
sage: K.<a> = NumberField(x^5 - x - 1) sage: f = (-2/3 + 1/3*a)^4; f 1/81*a^4 - 8/81*a^3 + 8/27*a^2 - 32/81*a + 16/81 sage: g = f.polynomial(); g 1/81*x^4 - 8/81*x^3 + 8/27*x^2 - 32/81*x + 16/81 sage: parent(g) Univariate Polynomial Ring in x over Rational Field
Note that the result of this function is not cached (should this be changed?):
sage: g is f.polynomial() False
) |
Returns the square root of this number in the given number field.
sage: K.<a> = NumberField(x^2 - 3) sage: K(3).sqrt() a sage: K(3).sqrt(all=True) [a, -a] sage: K(a^10).sqrt() 9*a sage: K(49).sqrt() 7 sage: K(1+a).sqrt() Traceback (most recent call last): ... ValueError: a + 1 not a square in Number Field in a with defining polynomial x^2 - 3 sage: K(0).sqrt() 0 sage: K((7+a)^2).sqrt(all=True) [a + 7, -a - 7]
sage: K.<a> = CyclotomicField(7) sage: a.sqrt() a^4
sage: K.<a> = NumberField(x^5 - x + 1) sage: (a^4 + a^2 - 3*a + 2).sqrt() a^3 - a^2
ALGORITHM:
Use Pari to factor
-
self
in K.
) |
Return the absolute or relative trace of this number field element.
If K is given then K must be a subfield of the parent L of self, in which case the trace is the relative trace from L to K. In all other cases, the trace is the absolute trace down to QQ.
sage: K.<a> = NumberField(x^3 -132/7*x^2 + x + 1); K Number Field in a with defining polynomial x^3 - 132/7*x^2 + x + 1 sage: a.trace() 132/7 sage: (a+1).trace() == a.trace() + 3 True
If we are in an order, the trace is an integer:
sage: K.<zeta> = CyclotomicField(17) sage: R = K.ring_of_integers() sage: R(zeta).trace().parent() Integer Ring
TESTS:
sage: F.<z> = CyclotomicField(5) ; t = 3*z**3 + 4*z**2 + 2 sage: t.trace(F) 3*z^3 + 4*z^2 + 2
) |
Returns the valuation of self at a given prime ideal P.
Input:
sage: R.<x> = QQ[] sage: K.<a> = NumberField(x^4+3*x^2-17) sage: P = K.ideal(61).factor()[0][0] sage: b = a^2 + 30 sage: b.valuation(P) 1 sage: type(b.valuation(P)) <type 'sage.rings.integer.Integer'>
) |
Return vector representation of self in terms of the basis for the ambient number field.
sage: K.<a> = NumberField(x^2 + 1) sage: (2/3*a - 5/6).vector() (-5/6, 2/3) sage: (-5/6, 2/3) (-5/6, 2/3) sage: O = K.order(2*a) sage: (O.1).vector() (0, 2) sage: K.<a,b> = NumberField([x^2 + 1, x^2 - 3]) sage: (a + b).vector() (b, 1) sage: O = K.order([a,b]) sage: (O.1).vector() (-b, 1) sage: (O.2).vector() (1, -b)
Special Functions: __abs__,
__copy__,
__floordiv__,
__getitem__,
__init__,
__int__,
__invert__,
__long__,
__reduce__,
__repr__,
__rfloordiv__,
_coefficients,
_gap_init_,
_im_gens_,
_integer_,
_latex_,
_lift_cyclotomic_element,
_matrix_over_base,
_matrix_over_base_morphism,
_number_field,
_pari_,
_pari_init_,
_rational_,
_set_multiplicative_order
) |
Return the numerical absolute value of this number field element with respect to the first archimedean embedding, to double precision.
This is the abs( )
Python function. If you want a different
embedding or precision, use self.abs(...)
.
sage: k.<a> = NumberField(x^3 - 2) sage: abs(a) 1.25992104989 sage: abs(a)^3 2.0 sage: a.abs(prec=128) 1.2599210498948731647672106072782283506
) |
) |
Return the quotient of self and other. Since these are field elements the floor division is exactly the same as usual division.
sage: m.<b> = NumberField(x^4 + x^2 + 2/3) sage: c = (1+b) // (1-b); c 3/4*b^3 + 3/4*b^2 + 3/2*b + 1/2 sage: (1+b) / (1-b) == c True sage: c * (1-b) b + 1
) |
Return the n-th coefficient of this number field element, written as a polynomial in the generator.
Note that
must be between 0 and
, where
is the
degree of the number field.
sage: m.<b> = NumberField(x^4 - 1789) sage: c = (2/3-4/5*b)^3; c -64/125*b^3 + 32/25*b^2 - 16/15*b + 8/27 sage: c[0] 8/27 sage: c[2] 32/25 sage: c[3] -64/125
We illustrate bounds checking:
sage: c[-1] Traceback (most recent call last): ... IndexError: index must be between 0 and degree minus 1. sage: c[4] Traceback (most recent call last): ... IndexError: index must be between 0 and degree minus 1.
The list method implicitly calls __getitem__:
sage: list(c) [8/27, -16/15, 32/25, -64/125] sage: m(list(c)) == c True
) |
Attempt to convert this number field element to a Python integer, if possible.
sage: C.<I>=CyclotomicField(4) sage: int(1/I) Traceback (most recent call last): ... TypeError: cannot coerce nonconstant polynomial to int sage: int(I*I) -1
sage: K.<a> = NumberField(x^10 - x - 1) sage: int(a) Traceback (most recent call last): ... TypeError: cannot coerce nonconstant polynomial to int sage: int(K(9390283)) 9390283
The semantics are like in Python, so the value does not have to preserved.
sage: int(K(393/29)) 13
) |
Returns the multiplicative inverse of self in the number field.
sage: C.<I>=CyclotomicField(4) sage: ~I -I sage: (2*I).__invert__() -1/2*I
) |
Attempt to convert this number field element to a Python long, if possible.
sage: K.<a> = NumberField(x^10 - x - 1) sage: long(a) Traceback (most recent call last): ... TypeError: cannot coerce nonconstant polynomial to long sage: long(K(1234)) 1234L
The value does not have to be preserved, in the case of fractions.
sage: long(K(393/29)) 13L
) |
Used in pickling number field elements.
sage: k.<a> = NumberField(x^3 - 17*x^2 + 1) sage: t = a.__reduce__(); t (<built-in function __create__NumberFieldElement_version1>, (Number Field in a with defining polynomial x^3 - 17*x^2 + 1, <type 'sage.rings.number_field.number_field_element.NumberFieldElement_absolute'> , x)) sage: t[0](*t[1]) == a True
) |
String representation of this number field element, which is just a polynomial in the generator.
sage: k.<a> = NumberField(x^2 + 2) sage: b = (2/3)*a + 3/5 sage: b.__repr__() '2/3*a + 3/5'
) |
Return the coefficients of the underlying polynomial corresponding to this number field element.
Output:
) |
Return gap string representation of self.
sage: F=CyclotomicField(8) sage: p=F.gen()^2+2*F.gen()-3 sage: p zeta8^2 + 2*zeta8 - 3 sage: p._gap_init_() # The variable name $sage2 belongs to the gap(F) and is somehow random 'GeneratorsOfField($sage2)[1]^2 + 2*GeneratorsOfField($sage2)[1] - 3' sage: gap(p._gap_init_()) (-3+2*zeta8+zeta8^2)
) |
This is used in computing homomorphisms between number fields.
sage: k.<a> = NumberField(x^2 - 2) sage: m.<b> = NumberField(x^4 - 2) sage: phi = k.hom([b^2]) sage: phi(a+1) b^2 + 1 sage: (a+1)._im_gens_(m, [b^2]) b^2 + 1
) |
Returns a rational integer if this element is actually a rational integer.
sage: C.<I>=CyclotomicField(4) sage: (~I)._integer_() Traceback (most recent call last): ... TypeError: Unable to coerce -I to an integer sage: (2*I*I)._integer_() -2
) |
Returns the latex representation for this element.
sage: C,zeta12=CyclotomicField(12).objgen() sage: latex(zeta12^4-zeta12) \zeta_{12}^{2} - \zeta_{12} - 1
) |
Creates an element of the passed field from this field. This is specific to creating elements in a cyclotomic field from elements in another cyclotomic field, in the case that self.number_field()._n() divides new_parent()._n(). This function aims to make this common coercion extremely fast!
More general coercion (i.e. of zeta6 into CyclotomicField(3)) is implemented in the _coerce_from_other_cyclotomic_field method of a CyclotomicField.
sage: C.<zeta5>=CyclotomicField(5) sage: CyclotomicField(10)(zeta5+1) # The function _lift_cyclotomic_element does the heavy lifting in the background zeta10^2 + 1 sage: (zeta5+1)._lift_cyclotomic_element(CyclotomicField(10)) # There is rarely a purpose to call this function directly zeta10^2 + 1 sage: cf4 = CyclotomicField(4) sage: cf1 = CyclotomicField(1) ; one = cf1.0 sage: cf4(one) 1 sage: type(cf4(1)) <type 'sage.rings.number_field.number_field_element_quadratic.NumberFieldEl ement_quadratic'> sage: cf33 = CyclotomicField(33) ; z33 = cf33.0 sage: cf66 = CyclotomicField(66) ; z66 = cf66.0 sage: z33._lift_cyclotomic_element(cf66) zeta66^2 sage: z66._lift_cyclotomic_element(cf33) Traceback (most recent call last): ... TypeError: The zeta_order of the new field must be a multiple of the zeta_order of the original. sage: cf33(z66) -zeta33^17
Author Log:
) |
Return the matrix of self over the base field L.
sage: K.<a> = NumberField(ZZ['x'].0^3-2, 'a') sage: L.<b> = K.extension(ZZ['x'].0^2+3, 'b') sage: L(a)._matrix_over_base(K) == L(a).matrix() True
) |
Return the matrix of self over a specified base, where phi gives a map from the specified base to self.parent().
sage: F.<alpha> = NumberField(ZZ['x'].0^5-2) sage: h = Hom(QQ,F)([1]) sage: alpha._matrix_over_base_morphism(h) == alpha.matrix() True sage: alpha._matrix_over_base_morphism(h) == alpha.matrix(QQ) True
) |
) |
) |
Return GP/PARI string representation of self. This is used for converting this number field element to GP/PARI. The returned string defines a pari Mod in the variable is var, which is by default 'x' - not the name of the generator of the number field.
Input:
sage: K.<a> = NumberField(x^5 - x - 1) sage: ((1 + 1/3*a)^4)._pari_init_() 'Mod(1/81*x^4 + 4/27*x^3 + 2/3*x^2 + 4/3*x + 1, x^5 - x - 1)' sage: ((1 + 1/3*a)^4)._pari_init_('a') 'Mod(1/81*a^4 + 4/27*a^3 + 2/3*a^2 + 4/3*a + 1, a^5 - a - 1)'
Note that _pari_init_ can fail because of reserved words in PARI, and since it actually works by obtaining the PARI representation of something.
sage: K.<theta> = NumberField(x^5 - x - 1) sage: b = (1/2 - 2/3*theta)^3; b -8/27*theta^3 + 2/3*theta^2 - 1/2*theta + 1/8 sage: b._pari_init_('theta') Traceback (most recent call last): ... PariError: unexpected character (2)
Fortunately pari_init returns everything in terms of x by default.
sage: pari(b) Mod(-8/27*x^3 + 2/3*x^2 - 1/2*x + 1/8, x^5 - x - 1)
) |
Returns a rational number if this element is actually a rational number.
sage: C.<I>=CyclotomicField(4) sage: (~I)._rational_() Traceback (most recent call last): ... TypeError: Unable to coerce -I to a rational sage: (I*I/2)._rational_() -1/2
) |
Set the multiplicative order of this number field element.
WARNING - use with caution - only for internal use! End users should never call this unless they have a very good reason to do so.
sage: K.<a> = NumberField(x^2 + x + 1) sage: a._set_multiplicative_order(3) sage: a.multiplicative_order() 3
You can be evil with this so be careful. That's why the function name begins with an underscore.
sage: a._set_multiplicative_order(389) sage: a.multiplicative_order() 389
Class: NumberFieldElement_absolute
Functions: absolute_charpoly,
absolute_minpoly,
charpoly,
list
) |
Return the characteristic polynomial of this element over
.
) |
Return the minimal polynomial of this element over
.
) |
The characteristic polynomial of this element, over
if
self is an element of a field, and over
is self is an
element of an order.
This is the same as self.absolute_charpoly
since this
is an element of an absolute extension.
We compute the charpoly of cube root of
.
sage: R.<x> = QQ[] sage: K.<a> = NumberField(x^3-2) sage: a.charpoly('x') x^3 - 2
TESTS:
sage: R = K.ring_of_integers() sage: R(a).charpoly() x^3 - 2 sage: R(a).charpoly().parent() Univariate Polynomial Ring in x over Integer Ring
) |
Return list of coefficients of self written in terms of a power basis.
sage: K.<z> = CyclotomicField(3) sage: (2+3/5*z).list() [2, 3/5] sage: (5*z).list() [0, 5] sage: K(3).list() [3, 0]
Special Functions: _pari_
) |
Return PARI C-library object corresponding to self.
sage: k.<j> = QuadraticField(-1) sage: j._pari_('j') Mod(j, j^2 + 1) sage: pari(j) Mod(x, x^2 + 1)
sage: y = QQ['y'].gen() sage: k.<j> = NumberField(y^3 - 2) sage: pari(j) Mod(x, x^3 - 2)
By default the variable name is 'x', since in PARI many variable names are reserved:
sage: theta = polygen(QQ, 'theta') sage: M.<theta> = NumberField(theta^2 + 1) sage: pari(theta) Mod(x, x^2 + 1)
If you try do coerce a generator called I to PARI, hell may break loose:
sage: k.<I> = QuadraticField(-1) sage: I._pari_('I') Traceback (most recent call last): ... PariError: forbidden (45)
Instead, request the variable be named different for the coercion:
sage: pari(I) Mod(x, x^2 + 1) sage: I._pari_('i') Mod(i, i^2 + 1) sage: I._pari_('II') Mod(II, II^2 + 1)
Class: NumberFieldElement_relative
Functions: absolute_charpoly,
absolute_minpoly,
charpoly,
list
) |
The characteristic polynomial of this element over
.
We construct a relative extension and find the characteristic
polynomial over
.
sage: R.<x> = QQ[] sage: K.<a> = NumberField(x^3-2) sage: S.<X> = K[] sage: L.<b> = NumberField(X^3 + 17); L Number Field in b with defining polynomial X^3 + 17 over its base field sage: b.absolute_charpoly() x^9 + 51*x^6 + 867*x^3 + 4913 sage: b.charpoly()(b) 0 sage: a = L.0; a b sage: a.absolute_charpoly('x') x^9 + 51*x^6 + 867*x^3 + 4913 sage: a.absolute_charpoly('y') y^9 + 51*y^6 + 867*y^3 + 4913
) |
Return the minpoly over
of this element.
) |
The characteristic polynomial of this element over its base field.
) |
Return list of coefficients of self written in terms of a power basis.
sage: K.<a,b> = NumberField([x^3+2, x^2+1]) sage: a.list() [0, 1, 0] sage: v = (K.base_field().0 + a)^2 ; v a^2 + 2*b*a - 1 sage: v.list() [-1, 2*b, 1]
Special Functions: __repr__,
_latex_,
_pari_
) |
) |
Returns the latex representation for this element.
sage: C.<zeta> = CyclotomicField(12) sage: PC.<x> = PolynomialRing(C) sage: K.<alpha> = NumberField(x^2 - 7) sage: latex((alpha + zeta)^4) \left(4 \zeta_{12}^{3} + 28 \zeta_{12}\right) \alpha + 43 \zeta_{12}^{2} + 48 sage: PK.<y> = PolynomialRing(K) sage: L.<beta> = NumberField(y^3 + y + alpha) sage: latex((beta + zeta)^3) 3 \zeta_{12} \beta^{2} + \left(3 \zeta_{12}^{2} - 1\right) \beta + \left(-1\right) \alpha + \zeta_{12}^{3}
) |
Return PARI C-library object corresponding to self.
By default the variable name is 'x', since in PARI many variable names are reserved.
sage: y = QQ['y'].gen() sage: k.<j> = NumberField([y^2 - 7, y^3 - 2]) sage: pari(j) Mod(42/5515*x^5 - 9/11030*x^4 - 196/1103*x^3 + 273/5515*x^2 + 10281/5515*x + 4459/11030, x^6 - 21*x^4 + 4*x^3 + 147*x^2 + 84*x - 339) sage: j^2 7 sage: pari(j)^2 Mod(7, x^6 - 21*x^4 + 4*x^3 + 147*x^2 + 84*x - 339)
Class: OrderElement_absolute
sage: K.<a> = NumberField(x^2 + 1) sage: O2 = K.order(2*a) sage: w = O2.1; w 2*a sage: parent(w) Order in Number Field in a with defining polynomial x^2 + 1
Special Functions: __init__
Class: OrderElement_relative
sage: O = EquationOrder([x^2 + x + 1, x^3 - 2],'a,b') sage: c = O.1; c (-2*b^2 - 2)*a - 2*b^2 - b sage: type(c) <type 'sage.rings.number_field.number_field_element.OrderElement_relative'>
Special Functions: __init__
See About this document... for information on suggesting changes.