Skip to content

Commit 7ee559e

Browse files
author
Matthias Koeppe
committed
Massive modularization fixes
1 parent da1933f commit 7ee559e

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed

src/sage/rings/tate_algebra.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,35 @@
2727
:func:`sage.rings.tate_algebra.TateAlgebra`::
2828
2929
sage: K = Qp(2, 5, print_mode='digits')
30-
sage: A.<x,y> = TateAlgebra(K)
31-
sage: A
32-
Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Field with capped relative precision 5
30+
sage: A.<x,y> = TateAlgebra(K); A
31+
Tate Algebra in x (val >= 0), y (val >= 0)
32+
over 2-adic Field with capped relative precision 5
3333
3434
As we observe, the default value for the log radii of convergence
3535
is `0` (the series then converge on the closed unit disc).
3636
3737
We can specify different log radii using the following syntax::
3838
3939
sage: B.<u,v> = TateAlgebra(K, log_radii=[1,2]); B
40-
Tate Algebra in u (val >= -1), v (val >= -2) over 2-adic Field with capped relative precision 5
40+
Tate Algebra in u (val >= -1), v (val >= -2)
41+
over 2-adic Field with capped relative precision 5
4142
4243
Note that if we pass in the ring of integers of `p`-adic field,
4344
the same Tate algebra is returned::
4445
4546
sage: A1.<x,y> = TateAlgebra(K.integer_ring()); A1
46-
Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Field with capped relative precision 5
47+
Tate Algebra in x (val >= 0), y (val >= 0)
48+
over 2-adic Field with capped relative precision 5
4749
sage: A is A1
4850
True
4951
5052
However the method :meth:`integer_ring` constructs the integer ring
5153
of a Tate algebra, that is the subring consisting of series bounded
5254
by `1` on the domain of convergence::
5355
54-
sage: Ao = A.integer_ring()
55-
sage: Ao
56-
Integer ring of the Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Field with capped relative precision 5
56+
sage: Ao = A.integer_ring(); Ao
57+
Integer ring of the Tate Algebra in x (val >= 0), y (val >= 0)
58+
over 2-adic Field with capped relative precision 5
5759
5860
Now we can build elements::
5961
@@ -67,7 +69,8 @@
6769
sage: f + g
6870
...00001*x^3*y + ...00101 + ...000010*x*y^3 + ...000010*x*y + ...0000100*x^2*y^2
6971
sage: f * g
70-
...00101*x^3*y + ...000010*x^4*y^4 + ...001010*x*y + ...0000100*x^5*y^3 + ...0000100*x^2*y^4 + ...00001000*x^3*y^3
72+
...00101*x^3*y + ...000010*x^4*y^4 + ...001010*x*y
73+
+ ...0000100*x^5*y^3 + ...0000100*x^2*y^4 + ...00001000*x^3*y^3
7174
7275
An element in the integer ring is invertible if and only if its
7376
reduction modulo `p` is a nonzero constant. In our example,
@@ -193,7 +196,8 @@ class TateAlgebraFactory(UniqueFactory):
193196
sage: R = Zp(2, 10, print_mode='digits'); R
194197
2-adic Ring with capped relative precision 10
195198
sage: A.<x,y> = TateAlgebra(R, order='lex'); A
196-
Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Field with capped relative precision 10
199+
Tate Algebra in x (val >= 0), y (val >= 0)
200+
over 2-adic Field with capped relative precision 10
197201
198202
We observe that the result is the Tate algebra over the fraction
199203
field of `R` and not `R` itself::
@@ -207,7 +211,8 @@ class TateAlgebraFactory(UniqueFactory):
207211
we must use the method :meth:`integer_ring`::
208212
209213
sage: Ao = A.integer_ring(); Ao
210-
Integer ring of the Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Field with capped relative precision 10
214+
Integer ring of the Tate Algebra in x (val >= 0), y (val >= 0)
215+
over 2-adic Field with capped relative precision 10
211216
sage: Ao.base_ring()
212217
2-adic Ring with capped relative precision 10
213218
sage: Ao.base_ring() is R
@@ -847,15 +852,19 @@ def _pushout_(self, R):
847852
848853
sage: A.<u,v> = TateAlgebra(R, log_radii=[1,2])
849854
sage: A1 = pushout(A, R1); A1
850-
Tate Algebra in u (val >= -1), v (val >= -2) over 2-adic Unramified Extension Field in a defined by x^2 + x + 1
855+
Tate Algebra in u (val >= -1), v (val >= -2)
856+
over 2-adic Unramified Extension Field in a defined by x^2 + x + 1
851857
sage: A2 = pushout(A, R2); A2
852-
Tate Algebra in u (val >= -2), v (val >= -4) over 2-adic Eisenstein Extension Field in pi defined by x^2 - 2
858+
Tate Algebra in u (val >= -2), v (val >= -4)
859+
over 2-adic Eisenstein Extension Field in pi defined by x^2 - 2
853860
854861
sage: Ao = A.integer_ring()
855862
sage: pushout(Ao, R1)
856-
Integer ring of the Tate Algebra in u (val >= -1), v (val >= -2) over 2-adic Unramified Extension Field in a defined by x^2 + x + 1
863+
Integer ring of the Tate Algebra in u (val >= -1), v (val >= -2)
864+
over 2-adic Unramified Extension Field in a defined by x^2 + x + 1
857865
sage: pushout(Ao, R2.fraction_field())
858-
Tate Algebra in u (val >= -2), v (val >= -4) over 2-adic Eisenstein Extension Field in pi defined by x^2 - 2
866+
Tate Algebra in u (val >= -2), v (val >= -4)
867+
over 2-adic Eisenstein Extension Field in pi defined by x^2 - 2
859868
860869
TESTS::
861870
@@ -1243,20 +1252,23 @@ def random_element(self, degree=2, terms=5, integral=False, prec=None):
12431252
sage: R = Zp(2, prec=10, print_mode="digits")
12441253
sage: A.<x,y> = TateAlgebra(R)
12451254
sage: A.random_element() # random
1246-
(...00101000.01)*y + ...1111011111*x^2 + ...0010010001*x*y + ...110000011 + ...010100100*y^2
1255+
(...00101000.01)*y + ...1111011111*x^2 + ...0010010001*x*y
1256+
+ ...110000011 + ...010100100*y^2
12471257
12481258
sage: A.random_element(degree=5, terms=3) # random
12491259
(...0101100.01)*x^2*y + (...01000011.11)*y^2 + ...00111011*x*y
12501260
12511261
sage: A.random_element(integral=True) # random
1252-
...0001111101*x + ...1101110101 + ...00010010110*y + ...101110001100*x*y + ...000001100100*y^2
1262+
...0001111101*x + ...1101110101 + ...00010010110*y
1263+
+ ...101110001100*x*y + ...000001100100*y^2
12531264
12541265
Note that if we are already working on the ring of integers,
12551266
specifying ``integral=False`` has no effect::
12561267
12571268
sage: Ao = A.integer_ring()
12581269
sage: f = Ao.random_element(integral=False); f # random
1259-
...1100111011*x^2 + ...1110100101*x + ...1100001101*y + ...1110110001 + ...01011010110*y^2
1270+
...1100111011*x^2 + ...1110100101*x + ...1100001101*y
1271+
+ ...1110110001 + ...01011010110*y^2
12601272
sage: f in Ao
12611273
True
12621274
@@ -1265,7 +1277,9 @@ def random_element(self, degree=2, terms=5, integral=False, prec=None):
12651277
12661278
sage: B.<x,y> = TateAlgebra(R, log_radii=[-1,-2])
12671279
sage: B.random_element(integral=True) # random
1268-
(...1111111.001)*x*y + (...111000101.1)*x + (...11010111.01)*y^2 + ...0010011011*y + ...0010100011000
1280+
(...1111111.001)*x*y + (...111000101.1)*x + (...11010111.01)*y^2
1281+
+ ...0010011011*y + ...0010100011000
1282+
12691283
"""
12701284
if integral or self._integral:
12711285
polring = self._polynomial_ring.change_ring(self._field.integer_ring())

0 commit comments

Comments
 (0)