Skip to content

Commit

Permalink
src/sage/rings/localization.py: Change # needs sage.rings.finite_ring…
Browse files Browse the repository at this point in the history
…s to more precise sage.libs.pari; use more block tags
  • Loading branch information
Matthias Koeppe committed Aug 31, 2023
1 parent 182b9bc commit 59e556e
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions src/sage/rings/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@
Obtain specializations in positive characteristic::
sage: # needs sage.libs.pari sage.modules
sage: Fp = GF(17)
sage: f = L.hom((3,5,7,11), codomain=Fp); f # needs sage.libs.pari
sage: f = L.hom((3,5,7,11), codomain=Fp); f
Ring morphism:
From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring localized at
(q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1, u2*q - u1, u2*q - u0,
Expand All @@ -88,17 +89,17 @@
u1 |--> 5
u2 |--> 7
q |--> 11
sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1 # needs sage.libs.pari sage.modules
sage: mFp1 = matrix({k: f(v) for k, v in m1.dict().items()}); mFp1
[5 0 0]
[0 3 0]
[0 0 3]
sage: mFp1.base_ring() # needs sage.libs.pari sage.modules
sage: mFp1.base_ring()
Finite Field of size 17
sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2 # needs sage.libs.pari sage.modules
sage: mFp2 = matrix({k: f(v) for k, v in m2.dict().items()}); mFp2
[ 2 3 0]
[ 9 8 0]
[ 0 0 16]
sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3 # needs sage.libs.pari sage.modules
sage: mFp3 = matrix({k: f(v) for k, v in m3.dict().items()}); mFp3
[16 0 0]
[ 0 4 5]
[ 0 7 6]
Expand All @@ -116,25 +117,28 @@
u1 |--> 5
u2 |--> 7
q |--> 11
sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1 # needs sage.modules sage.rings.finite_rings
sage: # needs sage.libs.pari sage.modules sage.rings.finite_rings
sage: mQ1 = matrix({k: fQ(v) for k, v in m1.dict().items()}); mQ1
[5 0 0]
[0 3 0]
[0 0 3]
sage: mQ1.base_ring() # needs sage.modules sage.rings.finite_rings
sage: mQ1.base_ring()
Rational Field
sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2 # needs sage.modules sage.rings.finite_rings
sage: mQ2 = matrix({k: fQ(v) for k, v in m2.dict().items()}); mQ2
[-15 -14 0]
[ 26 25 0]
[ 0 0 -1]
sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3 # needs sage.modules sage.rings.finite_rings
sage: mQ3 = matrix({k: fQ(v) for k, v in m3.dict().items()}); mQ3
[ -1 0 0]
[ 0 -15/26 11/26]
[ 0 301/26 275/26]
sage: # needs sage.libs.pari sage.libs.singular
sage: S.<x, y, z, t> = QQ[]
sage: T = S.quo(x + y + z)
sage: F = T.fraction_field() # needs sage.libs.pari sage.libs.singular
sage: fF = L.hom((x, y, z, t), codomain=F); fF # needs sage.libs.pari sage.libs.singular
sage: F = T.fraction_field()
sage: fF = L.hom((x, y, z, t), codomain=F); fF
Ring morphism:
From: Multivariate Polynomial Ring in u0, u1, u2, q over Integer Ring
localized at (q, q + 1, u2, u1, u1 - u2, u0, u0 - u2, u0 - u1,
Expand All @@ -145,11 +149,11 @@
u1 |--> ybar
u2 |--> zbar
q |--> tbar
sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # needs sage.libs.pari sage.libs.singular sage.modules
sage: mF1 = matrix({k: fF(v) for k, v in m1.dict().items()}); mF1 # needs sage.modules
[ ybar 0 0]
[ 0 -ybar - zbar 0]
[ 0 0 -ybar - zbar]
sage: mF1.base_ring() == F # needs sage.libs.pari sage.libs.singular sage.modules
sage: mF1.base_ring() == F # needs sage.modules
True
TESTS::
Expand Down Expand Up @@ -211,15 +215,16 @@ def normalize_extra_units(base_ring, add_units, warning=True):
....: [3*x, z*y**2, 2*z, 18*(x*y*z)**2, x*z, 6*x*z, 5])
[z, y, x]
sage: # needs sage.libs.singular
sage: R.<x, y> = ZZ[]
sage: Q.<a, b> = R.quo(x**2 - 5) # needs sage.libs.singular
sage: p = b**2 - 5 # needs sage.libs.singular
sage: p == (b-a)*(b+a) # needs sage.libs.singular
sage: Q.<a, b> = R.quo(x**2 - 5)
sage: p = b**2 - 5
sage: p == (b-a)*(b+a)
True
sage: normalize_extra_units(Q, [p]) # needs sage.libs.pari sage.libs.singular
sage: normalize_extra_units(Q, [p]) # needs sage.libs.pari
doctest:...: UserWarning: Localization may not be represented uniquely
[b^2 - 5]
sage: normalize_extra_units(Q, [p], warning=False) # needs sage.libs.pari sage.libs.singular
sage: normalize_extra_units(Q, [p], warning=False) # needs sage.libs.pari
[b^2 - 5]
"""
# convert to base ring
Expand Down Expand Up @@ -256,7 +261,7 @@ class LocalizationElement(IntegralDomainElement):
EXAMPLES::
sage: # needs sage.rings.finite_rings
sage: # needs sage.libs.pari
sage: from sage.rings.localization import LocalizationElement
sage: P.<x,y,z> = GF(5)[]
sage: L = P.localization((x, y*z - x))
Expand Down Expand Up @@ -716,7 +721,7 @@ def _repr_(self):
EXAMPLES::
sage: R.<a> = GF(3)[]
sage: Localization(R, a**2 - 1) # needs sage.rings.finite_rings
sage: Localization(R, a**2 - 1) # needs sage.libs.pari
Univariate Polynomial Ring in a over Finite Field of size 3
localized at (a + 1, a + 2)
"""
Expand Down Expand Up @@ -967,7 +972,7 @@ def fraction_field(self):
EXAMPLES::
sage: # needs sage.rings.finite_rings
sage: # needs sage.libs.pari
sage: R.<a> = GF(5)[]
sage: L = Localization(R, (a**2 - 3, a))
sage: L.fraction_field()
Expand All @@ -983,9 +988,10 @@ def characteristic(self):
EXAMPLES::
sage: # needs sage.libs.pari
sage: R.<a> = GF(5)[]
sage: L = R.localization((a**2 - 3, a)) # needs sage.rings.finite_rings
sage: L.characteristic() # needs sage.rings.finite_rings
sage: L = R.localization((a**2 - 3, a))
sage: L.characteristic()
5
"""
return self.base_ring().characteristic()
Expand Down

0 comments on commit 59e556e

Please sign in to comment.