\(p\)-adic Generic#
A generic superclass for all p-adic parents.
AUTHORS:
David Roe
Genya Zaytman: documentation
David Harvey: doctests
Julian Rueth (2013-03-16): test methods for basic arithmetic
- class sage.rings.padics.padic_generic.ResidueLiftingMap#
Bases:
Morphism
Lifting map to a p-adic ring or field from its residue field or ring.
These maps must be created using the
_create_()
method in order to support categories correctly.EXAMPLES:
sage: from sage.rings.padics.padic_generic import ResidueLiftingMap sage: R.<a> = Zq(125); k = R.residue_field() sage: f = ResidueLiftingMap._create_(k, R); f Lifting morphism: From: Finite Field in a0 of size 5^3 To: 5-adic Unramified Extension Ring in a defined by x^3 + 3*x + 3
- class sage.rings.padics.padic_generic.ResidueReductionMap#
Bases:
Morphism
Reduction map from a p-adic ring or field to its residue field or ring.
These maps must be created using the
_create_()
method in order to support categories correctly.EXAMPLES:
sage: from sage.rings.padics.padic_generic import ResidueReductionMap sage: R.<a> = Zq(125); k = R.residue_field() sage: f = ResidueReductionMap._create_(R, k); f Reduction morphism: From: 5-adic Unramified Extension Ring in a defined by x^3 + 3*x + 3 To: Finite Field in a0 of size 5^3
- is_injective()#
The reduction map is far from injective.
EXAMPLES:
sage: GF(5).convert_map_from(ZpCA(5)).is_injective() False
- is_surjective()#
The reduction map is surjective.
EXAMPLES:
sage: GF(7).convert_map_from(Qp(7)).is_surjective() True
- section()#
Return the section from the residue ring or field back to the p-adic ring or field.
EXAMPLES:
sage: GF(3).convert_map_from(Zp(3)).section() Lifting morphism: From: Finite Field of size 3 To: 3-adic Ring with capped relative precision 20
- sage.rings.padics.padic_generic.local_print_mode(obj, print_options, pos=None, ram_name=None)#
Context manager for safely temporarily changing the print_mode of a p-adic ring/field.
EXAMPLES:
sage: R = Zp(5) sage: R(45) 4*5 + 5^2 + O(5^21) sage: with local_print_mode(R, 'val-unit'): ....: print(R(45)) 5 * 9 + O(5^21)
Note
For more documentation see
sage.structure.parent_gens.localvars
.
- class sage.rings.padics.padic_generic.pAdicGeneric(base, p, prec, print_mode, names, element_class, category=None)#
Bases:
PrincipalIdealDomain
,LocalGeneric
Initialize
self
.INPUT:
base
– base ringp
– primeprint_mode
– dictionary of print optionsnames
– how to print the uniformizerelement_class
– the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) # indirect doctest
- characteristic()#
Return the characteristic of
self
, which is always 0.EXAMPLES:
sage: R = Zp(3, 10,'fixed-mod'); R.characteristic() 0
- extension(modulus, prec=None, names=None, print_mode=None, implementation='FLINT', **kwds)#
Create an extension of this p-adic ring.
EXAMPLES:
sage: k = Qp(5) sage: R.<x> = k[] sage: l.<w> = k.extension(x^2-5); l 5-adic Eisenstein Extension Field in w defined by x^2 - 5 sage: F = list(Qp(19)['x'](cyclotomic_polynomial(5)).factor())[0][0] sage: L = Qp(19).extension(F, names='a') sage: L 19-adic Unramified Extension Field in a defined by x^2 + 8751674996211859573806383*x + 1
- fraction_field(print_mode=None)#
Return the fraction field of this ring or field.
For \(\ZZ_p\), this is the \(p\)-adic field with the same options, and for extensions, it is just the extension of the fraction field of the base determined by the same polynomial.
The fraction field of a capped absolute ring is capped relative, and that of a fixed modulus ring is floating point.
INPUT:
print_mode
– (optional) a dictionary containing print options; defaults to the same options as this ring
OUTPUT:
the fraction field of this ring
EXAMPLES:
sage: R = Zp(5, print_mode='digits', show_prec=False) sage: K = R.fraction_field(); K(1/3) 31313131313131313132 sage: L = R.fraction_field({'max_ram_terms':4}); L(1/3) doctest:warning ... DeprecationWarning: Use the change method if you want to change print options in fraction_field() See https://github.com/sagemath/sage/issues/23227 for details. 3132 sage: U.<a> = Zq(17^4, 6, print_mode='val-unit', print_max_terse_terms=3) sage: U.fraction_field() 17-adic Unramified Extension Field in a defined by x^4 + 7*x^2 + 10*x + 3 sage: U.fraction_field({"pos":False}) == U.fraction_field() False
- frobenius_endomorphism(n=1)#
Return the \(n\)-th power of the absolute arithmetic Frobeninus endomorphism on this field.
INPUT:
n
– an integer (default: 1)
EXAMPLES:
sage: K.<a> = Qq(3^5) sage: Frob = K.frobenius_endomorphism(); Frob Frobenius endomorphism on 3-adic Unramified Extension ... lifting a |--> a^3 on the residue field sage: Frob(a) == a.frobenius() True
We can specify a power:
sage: K.frobenius_endomorphism(2) Frobenius endomorphism on 3-adic Unramified Extension ... lifting a |--> a^(3^2) on the residue field
The result is simplified if possible:
sage: K.frobenius_endomorphism(6) Frobenius endomorphism on 3-adic Unramified Extension ... lifting a |--> a^3 on the residue field sage: K.frobenius_endomorphism(5) Identity endomorphism of 3-adic Unramified Extension ...
Comparisons work:
sage: K.frobenius_endomorphism(6) == Frob True
- gens()#
Return a list of generators.
EXAMPLES:
sage: R = Zp(5); R.gens() [5 + O(5^21)] sage: Zq(25,names='a').gens() [a + O(5^20)] sage: S.<x> = ZZ[]; f = x^5 + 25*x -5; W.<w> = R.ext(f); W.gens() [w + O(w^101)]
- integer_ring(print_mode=None)#
Return the ring of integers of this ring or field.
For \(\QQ_p\), this is the \(p\)-adic ring with the same options, and for extensions, it is just the extension of the ring of integers of the base determined by the same polynomial.
INPUT:
print_mode
– (optional) a dictionary containing print options; defaults to the same options as this ring
OUTPUT:
the ring of elements of this field with nonnegative valuation
EXAMPLES:
sage: K = Qp(5, print_mode='digits', show_prec=False) sage: R = K.integer_ring(); R(1/3) 31313131313131313132 sage: S = K.integer_ring({'max_ram_terms':4}); S(1/3) doctest:warning ... DeprecationWarning: Use the change method if you want to change print options in integer_ring() See https://github.com/sagemath/sage/issues/23227 for details. 3132 sage: U.<a> = Qq(17^4, 6, print_mode='val-unit', print_max_terse_terms=3) sage: U.integer_ring() 17-adic Unramified Extension Ring in a defined by x^4 + 7*x^2 + 10*x + 3 sage: U.fraction_field({"print_mode":"terse"}) == U.fraction_field() doctest:warning ... DeprecationWarning: Use the change method if you want to change print options in fraction_field() See https://github.com/sagemath/sage/issues/23227 for details. False
- ngens()#
Return the number of generators of
self
.We conventionally define this as 1: for base rings, we take a uniformizer as the generator; for extension rings, we take a root of the minimal polynomial defining the extension.
EXAMPLES:
sage: Zp(5).ngens() 1 sage: Zq(25,names='a').ngens() 1
- prime()#
Return the prime, ie the characteristic of the residue field.
OUTPUT:
The characteristic of the residue field.
EXAMPLES:
sage: R = Zp(3,5,'fixed-mod') sage: R.prime() 3
- primitive_root_of_unity(n=None, order=False)#
Return a generator of the group of
n
-th roots of unity in this ring.INPUT:
n
– an integer orNone
(default:None
)order
– a boolean (default:False
)
OUTPUT:
A generator of the group of
n
-th roots of unity. Ifn
isNone
, a generator of the full group of roots of unity is returned.If
order
isTrue
, the order of the above group is returned as well.EXAMPLES:
sage: R = Zp(5, 10) sage: zeta = R.primitive_root_of_unity(); zeta 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10) sage: zeta == R.teichmuller(2) True
Now we consider an example with non trivial
p
-th roots of unity:sage: W = Zp(3, 2) sage: S.<x> = W[] sage: R.<pi> = W.extension((x+1)^6 + (x+1)^3 + 1) sage: zeta, order = R.primitive_root_of_unity(order=True) sage: zeta 2 + 2*pi + 2*pi^3 + 2*pi^7 + 2*pi^8 + 2*pi^9 + pi^11 + O(pi^12) sage: order 18 sage: zeta.multiplicative_order() 18 sage: zeta, order = R.primitive_root_of_unity(24, order=True) sage: zeta 2 + pi^3 + 2*pi^7 + 2*pi^8 + 2*pi^10 + 2*pi^11 + O(pi^12) sage: order # equal to gcd(18,24) 6 sage: zeta.multiplicative_order() 6
- print_mode()#
Return the current print mode as a string.
EXAMPLES:
sage: R = Qp(7,5, 'capped-rel') sage: R.print_mode() 'series'
- residue_characteristic()#
Return the prime, i.e., the characteristic of the residue field.
OUTPUT:
The characteristic of the residue field.
EXAMPLES:
sage: R = Zp(3,5,'fixed-mod') sage: R.residue_characteristic() 3
- residue_class_field()#
Return the residue class field.
EXAMPLES:
sage: R = Zp(3,5,'fixed-mod') sage: k = R.residue_class_field() sage: k Finite Field of size 3
- residue_field()#
Return the residue class field.
EXAMPLES:
sage: R = Zp(3,5,'fixed-mod') sage: k = R.residue_field() sage: k Finite Field of size 3
- residue_ring(n)#
Return the quotient of the ring of integers by the
n
-th power of the maximal ideal.EXAMPLES:
sage: R = Zp(11) sage: R.residue_ring(3) Ring of integers modulo 1331
- residue_system()#
Return a list of elements representing all the residue classes.
EXAMPLES:
sage: R = Zp(3, 5,'fixed-mod') sage: R.residue_system() [0, 1, 2]
- roots_of_unity(n=None)#
Return all the
n
-th roots of unity in this ring.INPUT:
n
– an integer orNone
(default:None
); ifNone
, the full group of roots of unity is returned
EXAMPLES:
sage: R = Zp(5, 10) sage: roots = R.roots_of_unity(); roots [1 + O(5^10), 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10), 4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10), 3 + 3*5 + 2*5^2 + 3*5^3 + 5^4 + 2*5^6 + 5^7 + 4*5^8 + 5^9 + O(5^10)] sage: R.roots_of_unity(10) [1 + O(5^10), 4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)]
In this case, the roots of unity are the Teichmüller representatives:
sage: R.teichmuller_system() [1 + O(5^10), 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10), 3 + 3*5 + 2*5^2 + 3*5^3 + 5^4 + 2*5^6 + 5^7 + 4*5^8 + 5^9 + O(5^10), 4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + O(5^10)]
In general, there might be more roots of unity (it happens when the ring has non trivial
p
-th roots of unity):sage: W.<a> = Zq(3^2, 2) sage: S.<x> = W[] sage: R.<pi> = W.extension((x+1)^2 + (x+1) + 1) sage: roots = R.roots_of_unity(); roots [1 + O(pi^4), a + 2*a*pi + 2*a*pi^2 + a*pi^3 + O(pi^4), ... 1 + pi + O(pi^4), a + a*pi^2 + 2*a*pi^3 + O(pi^4), ... 1 + 2*pi + pi^2 + O(pi^4), a + a*pi + a*pi^2 + O(pi^4), ...] sage: len(roots) 24
We check that the logarithm of each root of unity vanishes:
sage: for root in roots: ....: if root.log() != 0: ....: raise ValueError
- some_elements()#
Return a list of elements in this ring.
This is typically used for running generic tests (see
TestSuite
).EXAMPLES:
sage: Zp(2,4).some_elements() [0, 1 + O(2^4), 2 + O(2^5), 1 + 2^2 + 2^3 + O(2^4), 2 + 2^2 + 2^3 + 2^4 + O(2^5)]
- teichmuller(x, prec=None)#
Return the Teichmüller representative of
x
.x
– something that can be cast intoself
OUTPUT:
the Teichmüller lift of
x
EXAMPLES:
sage: R = Zp(5, 10, 'capped-rel', 'series') sage: R.teichmuller(2) 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10) sage: R = Qp(5, 10,'capped-rel','series') sage: R.teichmuller(2) 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10) sage: R = Zp(5, 10, 'capped-abs', 'series') sage: R.teichmuller(2) 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 + O(5^10) sage: R = Zp(5, 10, 'fixed-mod', 'series') sage: R.teichmuller(2) 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + 4*5^5 + 2*5^6 + 3*5^7 + 3*5^9 sage: R = Zp(5,5) sage: S.<x> = R[] sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 sage: W.<w> = R.ext(f) sage: y = W.teichmuller(3); y 3 + 3*w^5 + w^7 + 2*w^9 + 2*w^10 + 4*w^11 + w^12 + 2*w^13 + 3*w^15 + 2*w^16 + 3*w^17 + w^18 + 3*w^19 + 3*w^20 + 2*w^21 + 2*w^22 + 3*w^23 + 4*w^24 + O(w^25) sage: y^5 == y True sage: g = x^3 + 3*x + 3 sage: A.<a> = R.ext(g) sage: b = A.teichmuller(1 + 2*a - a^2); b (4*a^2 + 2*a + 1) + 2*a*5 + (3*a^2 + 1)*5^2 + (a + 4)*5^3 + (a^2 + a + 1)*5^4 + O(5^5) sage: b^125 == b True
We check that github issue #23736 is resolved:
sage: R.teichmuller(GF(5)(2)) 2 + 5 + 2*5^2 + 5^3 + 3*5^4 + O(5^5)
AUTHORS:
Initial version: David Roe
Quadratic time version: Kiran Kedlaya <kedlaya@math.mit.edu> (2007-03-27)
- teichmuller_system()#
Return a set of Teichmüller representatives for the invertible elements of \(\ZZ / p\ZZ\).
OUTPUT:
A list of Teichmüller representatives for the invertible elements of \(\ZZ / p\ZZ\).
EXAMPLES:
sage: R = Zp(3, 5,'fixed-mod', 'terse') sage: R.teichmuller_system() [1, 242]
Check that github issue #20457 is fixed:
sage: F.<a> = Qq(5^2,6) sage: F.teichmuller_system()[3] (2*a + 2) + (4*a + 1)*5 + 4*5^2 + (2*a + 1)*5^3 + (4*a + 1)*5^4 + (2*a + 3)*5^5 + O(5^6)
Note
Should this return 0 as well?
- uniformizer_pow(n)#
Return \(p^n\), as an element of
self
.If
n
is infinity, returns 0.EXAMPLES:
sage: R = Zp(3, 5, 'fixed-mod') sage: R.uniformizer_pow(3) 3^3 sage: R.uniformizer_pow(infinity) 0
- valuation()#
Return the \(p\)-adic valuation on this ring.
OUTPUT:
A valuation that is normalized such that the rational prime \(p\) has valuation 1.
EXAMPLES:
sage: K = Qp(3) sage: R.<a> = K[] sage: L.<a> = K.extension(a^3 - 3) sage: v = L.valuation(); v 3-adic valuation sage: v(3) 1 sage: L(3).valuation() 3
The normalization is chosen such that the valuation restricts to the valuation on the base ring:
sage: v(3) == K.valuation()(3) True sage: v.restriction(K) == K.valuation() True