\(p\)-Adic Generic Nodes¶
This file contains a bunch of intermediate classes for the \(p\)-adic parents, allowing a function to be implemented at the right level of generality.
AUTHORS:
- David Roe
-
class
sage.rings.padics.generic_nodes.
CappedAbsoluteGeneric
(base, prec, names, element_class, category=None)¶ Bases:
sage.rings.padics.local_generic.LocalGeneric
Initializes self.
EXAMPLES:
sage: R = Zp(5) #indirect doctest sage: R.precision_cap() 20
In trac ticket #14084, the category framework has been implemented for p-adic rings:
sage: TestSuite(R).run() sage: K = Qp(7) sage: TestSuite(K).run()
TESTS:
sage: R = Zp(5, 5, 'fixed-mod') sage: R._repr_option('element_is_atomic') False
-
is_capped_absolute
()¶ Returns whether this \(p\)-adic ring bounds precision in a capped absolute fashion.
The absolute precision of an element is the power of \(p\) modulo which that element is defined. In a capped absolute ring, the absolute precision of elements are bounded by a constant depending on the ring.
EXAMPLES:
sage: R = ZpCA(5, 15) sage: R.is_capped_absolute() True sage: R(5^7) 5^7 + O(5^15) sage: S = Zp(5, 15) sage: S.is_capped_absolute() False sage: S(5^7) 5^7 + O(5^22)
-
-
class
sage.rings.padics.generic_nodes.
CappedRelativeFieldGeneric
(base, prec, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.CappedRelativeGeneric
Initializes self.
EXAMPLES:
sage: R = Zp(5) #indirect doctest sage: R.precision_cap() 20
In trac ticket #14084, the category framework has been implemented for p-adic rings:
sage: TestSuite(R).run() sage: K = Qp(7) sage: TestSuite(K).run()
TESTS:
sage: R = Zp(5, 5, 'fixed-mod') sage: R._repr_option('element_is_atomic') False
-
class
sage.rings.padics.generic_nodes.
CappedRelativeGeneric
(base, prec, names, element_class, category=None)¶ Bases:
sage.rings.padics.local_generic.LocalGeneric
Initializes self.
EXAMPLES:
sage: R = Zp(5) #indirect doctest sage: R.precision_cap() 20
In trac ticket #14084, the category framework has been implemented for p-adic rings:
sage: TestSuite(R).run() sage: K = Qp(7) sage: TestSuite(K).run()
TESTS:
sage: R = Zp(5, 5, 'fixed-mod') sage: R._repr_option('element_is_atomic') False
-
is_capped_relative
()¶ Returns whether this \(p\)-adic ring bounds precision in a capped relative fashion.
The relative precision of an element is the power of p modulo which the unit part of that element is defined. In a capped relative ring, the relative precision of elements are bounded by a constant depending on the ring.
EXAMPLES:
sage: R = ZpCA(5, 15) sage: R.is_capped_relative() False sage: R(5^7) 5^7 + O(5^15) sage: S = Zp(5, 15) sage: S.is_capped_relative() True sage: S(5^7) 5^7 + O(5^22)
-
-
class
sage.rings.padics.generic_nodes.
CappedRelativeRingGeneric
(base, prec, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.CappedRelativeGeneric
Initializes self.
EXAMPLES:
sage: R = Zp(5) #indirect doctest sage: R.precision_cap() 20
In trac ticket #14084, the category framework has been implemented for p-adic rings:
sage: TestSuite(R).run() sage: K = Qp(7) sage: TestSuite(K).run()
TESTS:
sage: R = Zp(5, 5, 'fixed-mod') sage: R._repr_option('element_is_atomic') False
-
class
sage.rings.padics.generic_nodes.
FixedModGeneric
(base, prec, names, element_class, category=None)¶ Bases:
sage.rings.padics.local_generic.LocalGeneric
Initializes self.
EXAMPLES:
sage: R = Zp(5) #indirect doctest sage: R.precision_cap() 20
In trac ticket #14084, the category framework has been implemented for p-adic rings:
sage: TestSuite(R).run() sage: K = Qp(7) sage: TestSuite(K).run()
TESTS:
sage: R = Zp(5, 5, 'fixed-mod') sage: R._repr_option('element_is_atomic') False
-
is_fixed_mod
()¶ Returns whether this \(p\)-adic ring bounds precision in a fixed modulus fashion.
The absolute precision of an element is the power of p modulo which that element is defined. In a fixed modulus ring, the absolute precision of every element is defined to be the precision cap of the parent. This means that some operations, such as division by \(p\), don’t return a well defined answer.
EXAMPLES:
sage: R = ZpFM(5,15) sage: R.is_fixed_mod() True sage: R(5^7,absprec=9) 5^7 + O(5^15) sage: S = ZpCA(5, 15) sage: S.is_fixed_mod() False sage: S(5^7,absprec=9) 5^7 + O(5^9)
-
-
sage.rings.padics.generic_nodes.
is_pAdicField
(R)¶ Returns
True
if and only ifR
is a \(p\)-adic field.EXAMPLES:
sage: is_pAdicField(Zp(17)) False sage: is_pAdicField(Qp(17)) True
-
sage.rings.padics.generic_nodes.
is_pAdicRing
(R)¶ Returns
True
if and only ifR
is a \(p\)-adic ring (not a field).EXAMPLES:
sage: is_pAdicRing(Zp(5)) True sage: is_pAdicRing(RR) False
-
class
sage.rings.padics.generic_nodes.
pAdicCappedAbsoluteRingGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.pAdicRingGeneric
,sage.rings.padics.generic_nodes.CappedAbsoluteGeneric
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
class
sage.rings.padics.generic_nodes.
pAdicCappedRelativeFieldGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.pAdicFieldGeneric
,sage.rings.padics.generic_nodes.CappedRelativeFieldGeneric
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
class
sage.rings.padics.generic_nodes.
pAdicCappedRelativeRingGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.pAdicRingGeneric
,sage.rings.padics.generic_nodes.CappedRelativeRingGeneric
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
class
sage.rings.padics.generic_nodes.
pAdicFieldBaseGeneric
(p, prec, print_mode, names, element_class)¶ Bases:
sage.rings.padics.padic_base_generic.pAdicBaseGeneric
,sage.rings.padics.generic_nodes.pAdicFieldGeneric
Initialization
TESTS:
sage: R = Zp(5) #indirect doctest
-
composite
(subfield1, subfield2)¶ Returns the composite of two subfields of self, i.e., the largest subfield containing both
INPUT:
self
– a \(p\)-adic fieldsubfield1
– a subfieldsubfield2
– a subfield
OUTPUT:
- the composite of subfield1 and subfield2
EXAMPLES:
sage: K = Qp(17); K.composite(K, K) is K True
-
construction
()¶ Returns the functorial construction of
self
, namely, completion of the rational numbers with respect a given prime.Also preserves other information that makes this field unique (e.g. precision, rounding, print mode).
EXAMPLE:
sage: K = Qp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L Rational Field sage: c(L) 17-adic Field with capped relative precision 8 sage: K == c(L) True
-
subfield
(list)¶ Returns the subfield generated by the elements in list
INPUT:
self
– a \(p\)-adic fieldlist
– a list of elements ofself
OUTPUT:
- the subfield of
self
generated by the elements of list
EXAMPLES:
sage: K = Qp(17); K.subfield([K(17), K(1827)]) is K True
-
subfields_of_degree
(n)¶ Returns the number of subfields of self of degree \(n\)
INPUT:
self
– a \(p\)-adic fieldn
– an integer
OUTPUT:
- integer – the number of subfields of degree
n
over self.base_ring()
EXAMPLES:
sage: K = Qp(17) sage: K.subfields_of_degree(1) 1
-
-
class
sage.rings.padics.generic_nodes.
pAdicFieldGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.padic_generic.pAdicGeneric
,sage.rings.ring.Field
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
class
sage.rings.padics.generic_nodes.
pAdicFixedModRingGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.generic_nodes.pAdicRingGeneric
,sage.rings.padics.generic_nodes.FixedModGeneric
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
class
sage.rings.padics.generic_nodes.
pAdicRingBaseGeneric
(p, prec, print_mode, names, element_class)¶ Bases:
sage.rings.padics.padic_base_generic.pAdicBaseGeneric
,sage.rings.padics.generic_nodes.pAdicRingGeneric
Initialization
TESTS:
sage: R = Zp(5) #indirect doctest
-
construction
()¶ Returns the functorial construction of self, namely, completion of the rational numbers with respect a given prime.
Also preserves other information that makes this field unique (e.g. precision, rounding, print mode).
EXAMPLE:
sage: K = Zp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L Integer Ring sage: c(L) 17-adic Ring with capped relative precision 8 sage: K == c(L) True
-
random_element
(algorithm='default')¶ Returns a random element of self, optionally using the algorithm argument to decide how it generates the element. Algorithms currently implemented:
- default: Choose \(a_i\), \(i >= 0\), randomly between \(0\) and \(p-1\) until a nonzero choice is made. Then continue choosing \(a_i\) randomly between \(0\) and \(p-1\) until we reach precision_cap, and return \(\sum a_i p^i\).
EXAMPLES:
sage: Zp(5,6).random_element() 3 + 3*5 + 2*5^2 + 3*5^3 + 2*5^4 + 5^5 + O(5^6) sage: ZpCA(5,6).random_element() 4*5^2 + 5^3 + O(5^6) sage: ZpFM(5,6).random_element() 2 + 4*5^2 + 2*5^4 + 5^5 + O(5^6)
-
-
class
sage.rings.padics.generic_nodes.
pAdicRingGeneric
(base, p, prec, print_mode, names, element_class, category=None)¶ Bases:
sage.rings.padics.padic_generic.pAdicGeneric
,sage.rings.ring.EuclideanDomain
Initialization.
INPUT:
- base – Base ring.
- p – prime
- print_mode – dictionary of print options
- names – how to print the uniformizer
- element_class – the class for elements of this ring
EXAMPLES:
sage: R = Zp(17) #indirect doctest
-
is_field
(proof=True)¶ Returns whether this ring is actually a field, ie
False
.EXAMPLES:
sage: Zp(5).is_field() False
-
krull_dimension
()¶ Returns the Krull dimension of self, i.e. 1
INPUT:
- self – a \(p\)-adic ring
OUTPUT:
- the Krull dimension of self. Since self is a \(p\)-adic ring, this is 1.
EXAMPLES:
sage: Zp(5).krull_dimension() 1