From d0fbcd9f33d10b75c5739bb265d314eca09fae96 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 12 May 2023 20:00:12 -0700 Subject: [PATCH 01/20] sage.rings: Fix # optional --- src/sage/rings/function_field/function_field.py | 6 +++--- src/sage/rings/function_field/valuation.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 75c8fc1e0b0..8392792e995 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -37,7 +37,7 @@ We next make an extension of the above function field, illustrating that arithmetic with a tower of three fields is fully supported:: - sage: S. = L[] # optional - sage.rings.finite_rings + sage: S. = L[] # optional - sage.rings.finite_rings sage.rings.function_field sage: M. = L.extension(t^2 - x*y) # optional - sage.rings.finite_rings sage.rings.function_field sage: M # optional - sage.rings.finite_rings sage.rings.function_field Function field in t defined by t^2 + 4*x*y @@ -120,8 +120,8 @@ sage: TestSuite(J).run() # optional - sage.rings.finite_rings sage: TestSuite(K).run(max_runs=256) # long time (10s) # optional - sage.rings.number_field sage: TestSuite(L).run(max_runs=8) # long time (25s) # optional - sage.rings.function_field sage.rings.number_field - sage: TestSuite(M).run(max_runs=8) # long time (35s) - sage: TestSuite(N).run(max_runs=8, skip = '_test_derivation') # long time (15s) + sage: TestSuite(M).run(max_runs=8) # long time (35s) # optional - sage.rings.finite_rings sage.rings.function_field + sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s) # optional - sage.rings.finite_rings sage: TestSuite(O).run() # optional - sage.rings.function_field sage.rings.number_field sage: TestSuite(R).run() sage: TestSuite(S).run() # long time (4s) # optional - sage.rings.finite_rings sage.rings.function_field diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 90d5a2dae3e..9df6b5ffe73 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -107,7 +107,7 @@ sage: v = K.valuation(x^2 + 1) sage: L. = FunctionField(GaussianIntegers().fraction_field()) sage: ws = v.extensions(L) # optional - sage.rings.function_field - sage: for w in ws: TestSuite(w).run(max_runs=100) # long time + sage: for w in ws: TestSuite(w).run(max_runs=100) # long time # optional - sage.rings.function_field Run test suite for a finite place with residual degree and ramification:: From 242d0107ad92ecfc04041769436be7afd6ab1eac Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 1 Jun 2023 23:01:56 -0700 Subject: [PATCH 02/20] sage.rings: More # optional --- src/sage/rings/function_field/function_field_rational.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index 88d1c2cc0a3..7978933370d 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -870,10 +870,10 @@ def higher_derivation(self): EXAMPLES:: sage: F. = FunctionField(QQ) - sage: d = F.higher_derivation() # optional - sage.modules - sage: [d(x^5,i) for i in range(10)] # optional - sage.modules + sage: d = F.higher_derivation() # optional - sage.libs.singular sage.modules + sage: [d(x^5,i) for i in range(10)] # optional - sage.libs.singular sage.modules [x^5, 5*x^4, 10*x^3, 10*x^2, 5*x, 1, 0, 0, 0, 0] - sage: [d(x^9,i) for i in range(10)] # optional - sage.modules + sage: [d(x^9,i) for i in range(10)] # optional - sage.libs.singular sage.modules [x^9, 9*x^8, 36*x^7, 84*x^6, 126*x^5, 126*x^4, 84*x^3, 36*x^2, 9*x, 1] """ from .derivations_polymod import FunctionFieldHigherDerivation_char_zero From 3a8e6b50bb941b5b3b9a71120c5fd12bc08376bd Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 14 Jun 2023 18:25:01 -0700 Subject: [PATCH 03/20] sage.rings: More # optional --- src/sage/rings/function_field/function_field_rational.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index 7978933370d..5f26999ba0d 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -134,7 +134,7 @@ def __init__(self, constant_field, names, category=None): EXAMPLES:: - sage: K. = FunctionField(CC); K + sage: K. = FunctionField(CC); K # optional - sage.rings.real_mpfr Rational function field in t over Complex Field with 53 bits of precision sage: TestSuite(K).run() # long time (5s) From 9f672a29a67b4bebb47e09686e405a5e3ee16fa2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 8 Jul 2023 11:43:43 -0700 Subject: [PATCH 04/20] src/sage/rings/polynomial/polynomial_ring.py: Use '# needs sage.libs.ntl' when GF2X is used --- src/sage/rings/function_field/order_rational.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/function_field/order_rational.py b/src/sage/rings/function_field/order_rational.py index 9a57abfafe5..6bb49b6eaa4 100644 --- a/src/sage/rings/function_field/order_rational.py +++ b/src/sage/rings/function_field/order_rational.py @@ -273,7 +273,7 @@ def _residue_field_global(self, q, name=None): sage: k. = GF(2) # optional - sage.rings.finite_rings sage: F. = FunctionField(k) # optional - sage.rings.finite_rings sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: O._ring # optional - sage.rings.finite_rings + sage: O._ring # optional - sage.rings.finite_rings sage.libs.ntl Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X) sage: f = x^3 + x + 1 # optional - sage.rings.finite_rings sage: _f = f.numerator() # optional - sage.rings.finite_rings From 74641bb333fb9c20a81a47f2a27c46cf8ac0b988 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jul 2023 18:11:29 -0700 Subject: [PATCH 05/20] ./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/function_field --- src/sage/rings/function_field/constructor.py | 36 +- src/sage/rings/function_field/derivations.py | 9 +- .../function_field/derivations_polymod.py | 218 +++--- src/sage/rings/function_field/differential.py | 401 ++++++----- src/sage/rings/function_field/element.pyx | 255 +++---- .../rings/function_field/element_polymod.pyx | 42 +- .../rings/function_field/element_rational.pyx | 60 +- src/sage/rings/function_field/extensions.py | 96 +-- .../rings/function_field/function_field.py | 500 ++++++------- .../function_field/function_field_polymod.py | 466 ++++++------ .../function_field/function_field_rational.py | 188 ++--- src/sage/rings/function_field/ideal.py | 674 +++++++++--------- .../rings/function_field/ideal_rational.py | 174 +++-- src/sage/rings/function_field/maps.py | 331 +++++---- src/sage/rings/function_field/order.py | 52 +- src/sage/rings/function_field/order_basis.py | 182 ++--- .../rings/function_field/order_polymod.py | 416 ++++++----- .../rings/function_field/order_rational.py | 142 ++-- src/sage/rings/function_field/place.py | 205 +++--- .../rings/function_field/place_polymod.py | 185 ++--- src/sage/rings/function_field/valuation.py | 301 ++++---- 21 files changed, 2611 insertions(+), 2322 deletions(-) diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index 37aa8494a9e..8e5ecd281ee 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -57,10 +57,10 @@ class FunctionFieldFactory(UniqueFactory): sage: K. = FunctionField(QQ); K Rational function field in x over Rational Field - sage: L. = FunctionField(GF(7)); L # optional - sage.rings.finite_rings + sage: L. = FunctionField(GF(7)); L Rational function field in y over Finite Field of size 7 - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^7 - z - y); M # optional - sage.rings.finite_rings sage.rings.function_field + sage: R. = L[] + sage: M. = L.extension(z^7 - z - y); M # needs sage.rings.finite_rings sage.rings.function_field Function field in z defined by z^7 + 6*z + 6*y TESTS:: @@ -69,8 +69,8 @@ class FunctionFieldFactory(UniqueFactory): sage: L. = FunctionField(QQ) sage: K is L True - sage: M. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K is M # optional - sage.rings.finite_rings + sage: M. = FunctionField(GF(7)) + sage: K is M False sage: N. = FunctionField(QQ) sage: K is N @@ -136,9 +136,9 @@ class FunctionFieldExtensionFactory(UniqueFactory): sage: y2 = y*1 sage: y2 is y False - sage: L. = K.extension(x - y^2) # optional - sage.rings.function_field - sage: M. = K.extension(x - y2^2) # optional - sage.rings.function_field - sage: L is M # optional - sage.rings.function_field + sage: L. = K.extension(x - y^2) # needs sage.rings.function_field + sage: M. = K.extension(x - y2^2) # needs sage.rings.function_field + sage: L is M # needs sage.rings.function_field True """ def create_key(self,polynomial,names): @@ -150,7 +150,7 @@ def create_key(self,polynomial,names): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(x - y^2) # indirect doctest # optional - sage.rings.function_field + sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field TESTS: @@ -158,12 +158,12 @@ def create_key(self,polynomial,names): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z - 1) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z - 1) # needs sage.rings.function_field sage: R. = K[] - sage: N. = K.extension(z - 1) # optional - sage.rings.function_field - sage: M is N # optional - sage.rings.function_field + sage: N. = K.extension(z - 1) # needs sage.rings.function_field + sage: M is N # needs sage.rings.function_field False """ @@ -182,10 +182,10 @@ def create_object(self,version,key,**extra_args): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(x - y^2) # indirect doctest # optional - sage.rings.function_field - sage: y2 = y*1 # optional - sage.rings.function_field - sage: M. = K.extension(x - y2^2) # indirect doctest # optional - sage.rings.function_field - sage: L is M # optional - sage.rings.function_field + sage: L. = K.extension(x - y^2) # indirect doctest # needs sage.rings.function_field + sage: y2 = y*1 + sage: M. = K.extension(x - y2^2) # indirect doctest # needs sage.rings.function_field + sage: L is M # needs sage.rings.function_field True """ from . import function_field_polymod, function_field_rational diff --git a/src/sage/rings/function_field/derivations.py b/src/sage/rings/function_field/derivations.py index d0c34397a46..bca44bbe5f7 100644 --- a/src/sage/rings/function_field/derivations.py +++ b/src/sage/rings/function_field/derivations.py @@ -4,10 +4,11 @@ For global function fields, which have positive characteristics, the higher derivation is available:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings sage.rings.function_field - sage: h(y^2, 2) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: h = L.higher_derivation() # needs sage.rings.function_field + sage: h(y^2, 2) # needs sage.rings.function_field ((x^7 + 1)/x^2)*y^2 + x^3*y AUTHORS: diff --git a/src/sage/rings/function_field/derivations_polymod.py b/src/sage/rings/function_field/derivations_polymod.py index cc23d4c2461..18790c3ab1e 100644 --- a/src/sage/rings/function_field/derivations_polymod.py +++ b/src/sage/rings/function_field/derivations_polymod.py @@ -176,24 +176,26 @@ def __init__(self, parent, u=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: d = L.derivation() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: d = L.derivation() This also works for iterated non-monic extensions:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - 1/x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^2*y - x^3) # optional - sage.rings.finite_rings - sage: M.derivation() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - 1/x) + sage: R. = L[] + sage: M. = L.extension(z^2*y - x^3) + sage: M.derivation() d/dz We can also create a multiple of the canonical derivation:: - sage: M.derivation([x]) # optional - sage.rings.finite_rings + sage: M.derivation([x]) # needs sage.rings.finite_rings x*d/dz """ FunctionFieldDerivation.__init__(self, parent) @@ -219,15 +221,16 @@ def _call_(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: d = L.derivation() # optional - sage.rings.finite_rings - sage: d(x) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: d = L.derivation() + sage: d(x) # indirect doctest 0 - sage: d(y) # optional - sage.rings.finite_rings + sage: d(y) 1 - sage: d(y^2) # optional - sage.rings.finite_rings + sage: d(y^2) 0 """ @@ -242,13 +245,14 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 - x) # optional - sage.rings.finite_rings - sage: d = L.derivation() # optional - sage.rings.finite_rings - sage: d # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: R. = K[] + sage: L. = K.extension(y^3 - x) + sage: d = L.derivation() + sage: d d/dy - sage: d + d # optional - sage.rings.finite_rings + sage: d + d 2*d/dy """ return type(self)(self.parent(), [self._u + other._u]) @@ -259,13 +263,14 @@ def _lmul_(self, factor): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: d = L.derivation() # optional - sage.rings.finite_rings - sage: d # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: d = L.derivation() + sage: d d/dy - sage: y * d # optional - sage.rings.finite_rings + sage: y * d y*d/dy """ return type(self)(self.parent(), [factor * self._u]) @@ -281,8 +286,8 @@ class FunctionFieldHigherDerivation(Map): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: F.higher_derivation() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: F.higher_derivation() # needs sage.rings.finite_rings Higher derivation map: From: Rational function field in x over Finite Field of size 2 To: Rational function field in x over Finite Field of size 2 @@ -293,9 +298,9 @@ def __init__(self, field): TESTS:: - sage: F. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: TestSuite(h).run(skip='_test_category') # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(4)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: TestSuite(h).run(skip='_test_category') # needs sage.rings.finite_rings """ Map.__init__(self, Hom(field, field, Sets())) self._field = field @@ -311,9 +316,9 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h # indirect doctest # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: h # indirect doctest # needs sage.rings.finite_rings Higher derivation map: From: Rational function field in x over Finite Field of size 2 To: Rational function field in x over Finite Field of size 2 @@ -326,9 +331,9 @@ def __eq__(self, other) -> bool: TESTS:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: loads(dumps(h)) == h # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: loads(dumps(h)) == h # needs sage.rings.finite_rings True """ if isinstance(other, FunctionFieldHigherDerivation): @@ -344,9 +349,9 @@ def _pth_root_in_prime_field(e): sage: from sage.rings.function_field.derivations_polymod import _pth_root_in_prime_field sage: p = 5 - sage: F. = GF(p) # optional - sage.rings.finite_rings - sage: e = F.random_element() # optional - sage.rings.finite_rings - sage: _pth_root_in_prime_field(e)^p == e # optional - sage.rings.finite_rings + sage: F. = GF(p) # needs sage.rings.finite_rings + sage: e = F.random_element() # needs sage.rings.finite_rings + sage: _pth_root_in_prime_field(e)^p == e # needs sage.rings.finite_rings True """ return e @@ -360,9 +365,9 @@ def _pth_root_in_finite_field(e): sage: from sage.rings.function_field.derivations_polymod import _pth_root_in_finite_field sage: p = 3 - sage: F. = GF(p^2) # optional - sage.rings.finite_rings - sage: e = F.random_element() # optional - sage.rings.finite_rings - sage: _pth_root_in_finite_field(e)^p == e # optional - sage.rings.finite_rings + sage: F. = GF(p^2) # needs sage.rings.finite_rings + sage: e = F.random_element() # needs sage.rings.finite_rings + sage: _pth_root_in_finite_field(e)^p == e # needs sage.rings.finite_rings True """ return e.pth_root() @@ -378,13 +383,14 @@ class RationalFunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h Higher derivation map: From: Rational function field in x over Finite Field of size 2 To: Rational function field in x over Finite Field of size 2 - sage: h(x^2, 2) # optional - sage.rings.finite_rings + sage: h(x^2, 2) 1 """ def __init__(self, field): @@ -393,9 +399,9 @@ def __init__(self, field): TESTS:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: TestSuite(h).run(skip='_test_category') # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: TestSuite(h).run(skip='_test_category') # needs sage.rings.finite_rings """ FunctionFieldHigherDerivation.__init__(self, field) @@ -408,9 +414,9 @@ def _call_with_args(self, f, args=(), kwds={}): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h(x^2, 2) # indirect doctest # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: h(x^2, 2) # indirect doctest # needs sage.rings.finite_rings 1 """ return self._derive(f, *args, **kwds) @@ -424,17 +430,18 @@ def _derive(self, f, i, separating_element=None): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h._derive(x^3, 0) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h._derive(x^3, 0) x^3 - sage: h._derive(x^3, 1) # optional - sage.rings.finite_rings + sage: h._derive(x^3, 1) x^2 - sage: h._derive(x^3, 2) # optional - sage.rings.finite_rings + sage: h._derive(x^3, 2) x - sage: h._derive(x^3, 3) # optional - sage.rings.finite_rings + sage: h._derive(x^3, 3) 1 - sage: h._derive(x^3, 4) # optional - sage.rings.finite_rings + sage: h._derive(x^3, 4) 0 """ F = self._field @@ -491,11 +498,12 @@ def _prime_power_representation(self, f, separating_element=None): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h._prime_power_representation(x^2 + x + 1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h._prime_power_representation(x^2 + x + 1) [x + 1, 1] - sage: x^2 + x + 1 == _[0]^2 + _[1]^2 * x # optional - sage.rings.finite_rings + sage: x^2 + x + 1 == _[0]^2 + _[1]^2 * x True """ F = self._field @@ -541,9 +549,9 @@ def _pth_root(self, c): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: h = F.higher_derivation() # optional - sage.rings.finite_rings - sage: h._pth_root((x^2+1)^2) # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: h = F.higher_derivation() # needs sage.rings.finite_rings + sage: h._pth_root((x^2+1)^2) # needs sage.rings.finite_rings x^2 + 1 """ K = self._field @@ -570,14 +578,15 @@ class FunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: h # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: h Higher derivation map: From: Function field in y defined by y^3 + x^3*y + x To: Function field in y defined by y^3 + x^3*y + x - sage: h(y^2, 2) # optional - sage.rings.finite_rings + sage: h(y^2, 2) ((x^7 + 1)/x^2)*y^2 + x^3*y """ @@ -587,10 +596,11 @@ def __init__(self, field): TESTS:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: TestSuite(h).run(skip=['_test_category']) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: TestSuite(h).run(skip=['_test_category']) """ from sage.matrix.constructor import matrix @@ -615,10 +625,11 @@ def _call_with_args(self, f, args, kwds): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: h(y^2, 2) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: h(y^2, 2) # indirect doctest ((x^7 + 1)/x^2)*y^2 + x^3*y """ return self._derive(f, *args, **kwds) @@ -632,20 +643,21 @@ def _derive(self, f, i, separating_element=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: y^3 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: y^3 x^3*y + x - sage: h._derive(y^3, 0) # optional - sage.rings.finite_rings + sage: h._derive(y^3, 0) x^3*y + x - sage: h._derive(y^3, 1) # optional - sage.rings.finite_rings + sage: h._derive(y^3, 1) x^4*y^2 + 1 - sage: h._derive(y^3, 2) # optional - sage.rings.finite_rings + sage: h._derive(y^3, 2) x^10*y^2 + (x^8 + x)*y - sage: h._derive(y^3, 3) # optional - sage.rings.finite_rings + sage: h._derive(y^3, 3) (x^9 + x^2)*y^2 + x^7*y - sage: h._derive(y^3, 4) # optional - sage.rings.finite_rings + sage: h._derive(y^3, 4) (x^22 + x)*y^2 + ((x^21 + x^14 + x^7 + 1)/x)*y """ F = self._field @@ -731,11 +743,12 @@ def _prime_power_representation(self, f, separating_element=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: b = h._prime_power_representation(y) # optional - sage.rings.finite_rings - sage: y == b[0]^2 + b[1]^2 * x # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: b = h._prime_power_representation(y) + sage: y == b[0]^2 + b[1]^2 * x True """ F = self._field @@ -777,10 +790,11 @@ def _pth_root(self, c): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: h = L.higher_derivation() # optional - sage.rings.finite_rings - sage: h._pth_root((x^2 + y^2)^2) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: h = L.higher_derivation() + sage: h._pth_root((x^2 + y^2)^2) y^2 + x^2 """ from sage.modules.free_module_element import vector diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index c3eaa240b7a..ea25dbaf207 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -9,35 +9,36 @@ The module of differentials on a function field forms an one-dimensional vector space over the function field:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = x + y # optional - sage.rings.finite_rings sage.rings.function_field - sage: g = 1 / y # optional - sage.rings.finite_rings sage.rings.function_field - sage: df = f.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: dg = g.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: dfdg = f.derivative() / g.derivative() # optional - sage.rings.finite_rings sage.rings.function_field - sage: df == dfdg * dg # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: f = x + y # needs sage.rings.function_field + sage: g = 1 / y # needs sage.rings.function_field + sage: df = f.differential() # needs sage.rings.function_field + sage: dg = g.differential() # needs sage.rings.function_field + sage: dfdg = f.derivative() / g.derivative() # needs sage.rings.function_field + sage: df == dfdg * dg # needs sage.rings.function_field True - sage: df # optional - sage.rings.finite_rings sage.rings.function_field + sage: df # needs sage.rings.function_field (x*y^2 + 1/x*y + 1) d(x) - sage: df.parent() # optional - sage.rings.finite_rings sage.rings.function_field + sage: df.parent() # needs sage.rings.function_field Space of differentials of Function field in y defined by y^3 + x^3*y + x We can compute a canonical divisor:: - sage: k = df.divisor() # optional - sage.rings.finite_rings sage.rings.function_field - sage: k.degree() # optional - sage.rings.finite_rings sage.rings.function_field + sage: k = df.divisor() # needs sage.rings.finite_rings sage.rings.function_field + sage: k.degree() # needs sage.rings.finite_rings sage.rings.function_field 4 - sage: k.degree() == 2 * L.genus() - 2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: k.degree() == 2 * L.genus() - 2 # needs sage.rings.finite_rings sage.rings.function_field True Exact differentials vanish and logarithmic differentials are stable under the Cartier operation:: - sage: df.cartier() # optional - sage.rings.finite_rings sage.rings.function_field + sage: df.cartier() # needs sage.rings.finite_rings sage.rings.function_field 0 - sage: w = 1/f * df # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.cartier() == w # optional - sage.rings.finite_rings sage.rings.function_field + sage: w = 1/f * df # needs sage.rings.finite_rings sage.rings.function_field + sage: w.cartier() == w # needs sage.rings.finite_rings sage.rings.function_field True AUTHORS: @@ -90,10 +91,10 @@ class FunctionFieldDifferential(ModuleElement): :: sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.function_field - sage: L(x).differential() # optional - sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: L(x).differential() # needs sage.rings.function_field d(x) - sage: y.differential() # optional - sage.rings.function_field + sage: y.differential() # needs sage.rings.function_field ((21/4*x/(x^7 + 27/4))*y^2 + ((3/2*x^7 + 9/4)/(x^8 + 27/4*x))*y + 7/2*x^4/(x^7 + 27/4)) d(x) """ def __init__(self, parent, f, t=None): @@ -102,10 +103,11 @@ def __init__(self, parent, f, t=None): TESTS:: - sage: F. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: f = x/(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: w = f.differential() # optional - sage.rings.finite_rings - sage: TestSuite(w).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(7)) + sage: f = x/(x^2 + x + 1) + sage: w = f.differential() + sage: TestSuite(w).run() """ ModuleElement.__init__(self, parent) @@ -120,9 +122,9 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3+x+x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: y.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3+x+x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field + sage: y.differential() # needs sage.rings.finite_rings sage.rings.function_field (x*y^2 + 1/x*y) d(x) sage: F. = FunctionField(QQ) @@ -146,10 +148,11 @@ def _latex_(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings - sage: w = y.differential() # optional - sage.rings.finite_rings - sage: latex(w) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w = y.differential() + sage: latex(w) \left( x y^{2} + \frac{1}{x} y \right)\, dx """ if self._f.is_zero(): # zero differential @@ -168,11 +171,12 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: {x.differential(): 1} # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: {x.differential(): 1} # needs sage.rings.function_field {d(x): 1} - sage: {y.differential(): 1} # optional - sage.rings.finite_rings sage.rings.function_field + sage: {y.differential(): 1} # needs sage.rings.function_field {(x*y^2 + 1/x*y) d(x): 1} """ return hash((self.parent(), self._f)) @@ -190,16 +194,17 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w2 = L(x).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w3 = (x*y).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 < w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w1 = y.differential() # needs sage.rings.function_field + sage: w2 = L(x).differential() # needs sage.rings.function_field + sage: w3 = (x*y).differential() # needs sage.rings.function_field + sage: w1 < w2 # needs sage.rings.function_field False - sage: w2 < w1 # optional - sage.rings.finite_rings sage.rings.function_field + sage: w2 < w1 # needs sage.rings.function_field True - sage: w3 == x * w1 + y * w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: w3 == x * w1 + y * w2 # needs sage.rings.function_field True sage: F. = FunctionField(QQ) @@ -224,11 +229,12 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w2 = (1/y).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 + w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w1 = y.differential() # needs sage.rings.function_field + sage: w2 = (1/y).differential() # needs sage.rings.function_field + sage: w1 + w2 # needs sage.rings.function_field (((x^3 + 1)/x^2)*y^2 + 1/x*y) d(x) sage: F. = FunctionField(QQ) @@ -252,11 +258,12 @@ def _div_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w2 = (1/y).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 / w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w1 = y.differential() # needs sage.rings.function_field + sage: w2 = (1/y).differential() # needs sage.rings.function_field + sage: w1 / w2 # needs sage.rings.function_field y^2 sage: F. = FunctionField(QQ) @@ -276,11 +283,12 @@ def _neg_(self): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w2 = (-y).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: -w1 == w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w1 = y.differential() # needs sage.rings.function_field + sage: w2 = (-y).differential() # needs sage.rings.function_field + sage: -w1 == w2 # needs sage.rings.function_field True sage: F. = FunctionField(QQ) @@ -303,11 +311,12 @@ def _rmul_(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 = (1/y).differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w2 = (-1/y^2) * y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w1 == w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w1 = (1/y).differential() # needs sage.rings.function_field + sage: w2 = (-1/y^2) * y.differential() # needs sage.rings.function_field + sage: w1 == w2 # needs sage.rings.function_field True sage: F. = FunctionField(QQ) @@ -332,26 +341,27 @@ def _acted_upon_(self, f, self_on_left): EXAMPLES:: - sage: K. = FunctionField(GF(31)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x); _. = L[] # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = L.extension(Z^2 - y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: z.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(31)); _. = K[] + sage: L. = K.extension(Y^2 - x); _. = L[] # needs sage.rings.function_field + sage: M. = L.extension(Z^2 - y) # needs sage.rings.function_field + sage: z.differential() # needs sage.rings.function_field (8/x*z) d(x) - sage: 1/(2*z) * y.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: 1/(2*z) * y.differential() # needs sage.rings.function_field (8/x*z) d(x) - sage: z * x.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: z * x.differential() # needs sage.rings.finite_rings sage.rings.function_field (z) d(x) - sage: z * (y^2).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: z * (y^2).differential() # needs sage.rings.finite_rings sage.rings.function_field (z) d(x) - sage: z * (z^4).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: z * (z^4).differential() # needs sage.rings.finite_rings sage.rings.function_field (z) d(x) :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: y * x.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field + sage: y * x.differential() # needs sage.rings.finite_rings sage.rings.function_field (y) d(x) """ F = f.parent() @@ -367,10 +377,11 @@ def divisor(self): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = (1/y) * y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w = (1/y) * y.differential() # needs sage.rings.function_field + sage: w.divisor() # needs sage.rings.function_field - Place (1/x, 1/x^3*y^2 + 1/x) - Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) - Place (x, y) @@ -398,10 +409,11 @@ def valuation(self, place): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = (1/y) * y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: [w.valuation(p) for p in L.places()] # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w = (1/y) * y.differential() # needs sage.rings.function_field + sage: [w.valuation(p) for p in L.places()] # needs sage.rings.function_field [-1, -1, -1, 0, 1, 0] """ F = self.parent().function_field() @@ -425,39 +437,41 @@ def residue(self, place): We verify the residue theorem in a rational function field:: - sage: F. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: f = 0 # optional - sage.rings.finite_rings - sage: while f == 0: # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(4)) + sage: f = 0 + sage: while f == 0: ....: f = F.random_element() - sage: w = 1/f * f.differential() # optional - sage.rings.finite_rings - sage: d = f.divisor() # optional - sage.rings.finite_rings - sage: s = d.support() # optional - sage.rings.finite_rings - sage: sum([w.residue(p).trace() for p in s]) # optional - sage.rings.finite_rings + sage: w = 1/f * f.differential() + sage: d = f.divisor() + sage: s = d.support() + sage: sum([w.residue(p).trace() for p in s]) 0 and in an extension field:: - sage: K. = FunctionField(GF(7)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = 0 # optional - sage.rings.finite_rings sage.rings.function_field - sage: while f == 0: # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: f = 0 # needs sage.rings.function_field + sage: while f == 0: # needs sage.rings.function_field ....: f = L.random_element() - sage: w = 1/f * f.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: d = f.divisor() # optional - sage.rings.finite_rings sage.rings.function_field - sage: s = d.support() # optional - sage.rings.finite_rings sage.rings.function_field - sage: sum([w.residue(p).trace() for p in s]) # optional - sage.rings.finite_rings sage.rings.function_field + sage: w = 1/f * f.differential() # needs sage.rings.function_field + sage: d = f.divisor() # needs sage.rings.function_field + sage: s = d.support() # needs sage.rings.function_field + sage: sum([w.residue(p).trace() for p in s]) # needs sage.rings.function_field 0 and also in a function field of characteristic zero:: sage: R. = FunctionField(QQ) sage: L. = R[] - sage: F. = R.extension(Y^2 - x^4 - 4*x^3 - 2*x^2 - 1) # optional - sage.rings.function_field - sage: a = 6*x^2 + 5*x + 7 # optional - sage.rings.function_field - sage: b = 2*x^6 + 8*x^5 + 3*x^4 - 4*x^3 - 1 # optional - sage.rings.function_field - sage: w = y*a/b*x.differential() # optional - sage.rings.function_field - sage: d = w.divisor() # optional - sage.rings.function_field - sage: sum([QQ(w.residue(p)) for p in d.support()]) # optional - sage.rings.function_field + sage: F. = R.extension(Y^2 - x^4 - 4*x^3 - 2*x^2 - 1) # needs sage.rings.function_field + sage: a = 6*x^2 + 5*x + 7 # needs sage.rings.function_field + sage: b = 2*x^6 + 8*x^5 + 3*x^4 - 4*x^3 - 1 # needs sage.rings.function_field + sage: w = y*a/b*x.differential() # needs sage.rings.function_field + sage: d = w.divisor() # needs sage.rings.function_field + sage: sum([QQ(w.residue(p)) for p in d.support()]) # needs sage.rings.function_field 0 """ @@ -485,12 +499,13 @@ def monomial_coefficients(self, copy=True): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: d = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: d # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: d = y.differential() # needs sage.rings.function_field + sage: d # needs sage.rings.function_field ((4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)) d(x) - sage: d.monomial_coefficients() # optional - sage.rings.finite_rings sage.rings.function_field + sage: d.monomial_coefficients() # needs sage.rings.function_field {0: (4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)} """ return {0: self._f} @@ -502,16 +517,16 @@ class FunctionFieldDifferential_global(FunctionFieldDifferential): EXAMPLES:: - sage: F. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: f = x/(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: f.differential() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(7)) # needs sage.rings.finite_rings + sage: f = x/(x^2 + x + 1) # needs sage.rings.finite_rings + sage: f.differential() # needs sage.rings.finite_rings ((6*x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x) :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: y.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field + sage: y.differential() # needs sage.rings.finite_rings sage.rings.function_field (x*y^2 + 1/x*y) d(x) """ def cartier(self): @@ -531,19 +546,21 @@ def cartier(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = x/y # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = 1/f*f.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.cartier() == w # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: f = x/y # needs sage.rings.function_field + sage: w = 1/f*f.differential() # needs sage.rings.function_field + sage: w.cartier() == w # needs sage.rings.function_field True :: - sage: F. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: f = x/(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: w = 1/f*f.differential() # optional - sage.rings.finite_rings - sage: w.cartier() == w # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(4)) + sage: f = x/(x^2 + x + 1) + sage: w = 1/f*f.differential() + sage: w.cartier() == w True """ W = self.parent() @@ -563,9 +580,9 @@ class DifferentialsSpace(UniqueRepresentation, Parent): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.space_of_differentials() # needs sage.rings.finite_rings sage.rings.function_field Space of differentials of Function field in y defined by y^3 + x^3*y + x The space of differentials is a one-dimensional module over the function @@ -575,14 +592,15 @@ class DifferentialsSpace(UniqueRepresentation, Parent): element is automatically found and used to generate the base differential relative to which other differentials are denoted:: - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^5 - 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L(x).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: R. = K[] + sage: L. = K.extension(y^5 - 1/x) # needs sage.rings.function_field + sage: L(x).differential() # needs sage.rings.function_field 0 - sage: y.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: y.differential() # needs sage.rings.function_field d(y) - sage: (y^2).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: (y^2).differential() # needs sage.rings.function_field (2*y) d(y) """ Element = FunctionFieldDifferential @@ -593,10 +611,11 @@ def __init__(self, field, category=None): TESTS:: - sage: K. = FunctionField(GF(4)); _.=K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: W = L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(W).run() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _.=K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: W = L.space_of_differentials() # needs sage.rings.function_field + sage: TestSuite(W).run() # needs sage.rings.function_field """ Parent.__init__(self, base=field, category=Modules(field).FiniteDimensional().WithBasis().or_subcategory(category)) @@ -619,10 +638,11 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = y.differential() # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.parent() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: w = y.differential() # needs sage.rings.function_field + sage: w.parent() # needs sage.rings.function_field Space of differentials of Function field in y defined by y^3 + x^3*y + x """ return "Space of differentials of {}".format(self.base()) @@ -637,14 +657,15 @@ def _element_constructor_(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: S = L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field - sage: S(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: S = L.space_of_differentials() # needs sage.rings.function_field + sage: S(y) # needs sage.rings.function_field (x*y^2 + 1/x*y) d(x) - sage: S(y) in S # optional - sage.rings.finite_rings sage.rings.function_field + sage: S(y) in S # needs sage.rings.function_field True - sage: S(1) # optional - sage.rings.finite_rings sage.rings.function_field + sage: S(1) # needs sage.rings.function_field 0 """ if f in self.base(): @@ -662,8 +683,8 @@ def _coerce_map_from_(self, S): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: L.space_of_differentials().coerce_map_from(K.space_of_differentials()) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: L.space_of_differentials().coerce_map_from(K.space_of_differentials()) # needs sage.rings.function_field Inclusion morphism: From: Space of differentials of Rational function field in x over Rational Field To: Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3 @@ -679,10 +700,11 @@ def function_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: S = L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field - sage: S.function_field() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: S = L.space_of_differentials() # needs sage.rings.function_field + sage: S.function_field() # needs sage.rings.function_field Function field in y defined by y^3 + x^3*y + x """ return self.base() @@ -693,10 +715,11 @@ def _an_element_(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: S = L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field - sage: S.an_element() # random # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: S = L.space_of_differentials() # needs sage.rings.function_field + sage: S.an_element() # random # needs sage.rings.function_field (x*y^2 + 1/x*y) d(x) """ F = self.base() @@ -708,10 +731,11 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: S = L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field - sage: S.basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: S = L.space_of_differentials() # needs sage.rings.function_field + sage: S.basis() # needs sage.rings.function_field Family (d(x),) """ return Family([self.element_class(self, self.base().one())]) @@ -727,9 +751,9 @@ class DifferentialsSpace_global(DifferentialsSpace): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_differentials() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.space_of_differentials() # needs sage.rings.finite_rings sage.rings.function_field Space of differentials of Function field in y defined by y^3 + x^3*y + x """ Element = FunctionFieldDifferential_global @@ -742,10 +766,10 @@ class DifferentialsSpaceInclusion(Morphism): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: OK = K.space_of_differentials() # optional - sage.rings.function_field - sage: OL = L.space_of_differentials() # optional - sage.rings.function_field - sage: OL.coerce_map_from(OK) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OL = L.space_of_differentials() # needs sage.rings.function_field + sage: OL.coerce_map_from(OK) # needs sage.rings.function_field Inclusion morphism: From: Space of differentials of Rational function field in x over Rational Field To: Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3 @@ -758,10 +782,10 @@ def _repr_(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: OK = K.space_of_differentials() # optional - sage.rings.function_field - sage: OL = L.space_of_differentials() # optional - sage.rings.function_field - sage: OL.coerce_map_from(OK) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OL = L.space_of_differentials() # needs sage.rings.function_field + sage: OL.coerce_map_from(OK) # needs sage.rings.function_field Inclusion morphism: From: Space of differentials of Rational function field in x over Rational Field To: Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3 @@ -778,10 +802,10 @@ def is_injective(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: OK = K.space_of_differentials() # optional - sage.rings.function_field - sage: OL = L.space_of_differentials() # optional - sage.rings.function_field - sage: OL.coerce_map_from(OK).is_injective() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OL = L.space_of_differentials() # needs sage.rings.function_field + sage: OL.coerce_map_from(OK).is_injective() # needs sage.rings.function_field True """ return True @@ -793,15 +817,15 @@ def is_surjective(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: OK = K.space_of_differentials() # optional - sage.rings.function_field - sage: OL = L.space_of_differentials() # optional - sage.rings.function_field - sage: OL.coerce_map_from(OK).is_surjective() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OL = L.space_of_differentials() # needs sage.rings.function_field + sage: OL.coerce_map_from(OK).is_surjective() # needs sage.rings.function_field False - sage: S. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z - 1) # optional - sage.rings.function_field - sage: OM = M.space_of_differentials() # optional - sage.rings.function_field - sage: OM.coerce_map_from(OL).is_surjective() # optional - sage.rings.function_field + sage: S. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z - 1) # needs sage.rings.function_field + sage: OM = M.space_of_differentials() # needs sage.rings.function_field + sage: OM.coerce_map_from(OL).is_surjective() # needs sage.rings.function_field True """ K = self.domain().function_field() @@ -818,12 +842,13 @@ def _call_(self, v): EXAMPLES:: - sage: K. = FunctionField(QQbar); _. = K[] # optional - sage.rings.number_field - sage: L. = K.extension(Y^2 - x*Y + 4*x^3) # optional - sage.rings.function_field sage.rings.number_field - sage: OK = K.space_of_differentials() # optional - sage.rings.function_field sage.rings.number_field - sage: OL = L.space_of_differentials() # optional - sage.rings.function_field sage.rings.number_field - sage: mor = OL.coerce_map_from(OK) # optional - sage.rings.function_field sage.rings.number_field - sage: mor(x.differential()).parent() # optional - sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = FunctionField(QQbar); _. = K[] + sage: L. = K.extension(Y^2 - x*Y + 4*x^3) # needs sage.rings.function_field + sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OL = L.space_of_differentials() # needs sage.rings.function_field + sage: mor = OL.coerce_map_from(OK) # needs sage.rings.function_field + sage: mor(x.differential()).parent() # needs sage.rings.function_field Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3 """ domain = self.domain() diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index b144cd20d22..092b1887bf3 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -20,16 +20,16 @@ Arithmetic with rational functions:: Derivatives of elements in separable extensions:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (y^3 + x).derivative() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (y^3 + x).derivative() # needs sage.rings.finite_rings sage.rings.function_field ((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3 The divisor of an element of a global function field:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: y.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: y.divisor() # needs sage.rings.finite_rings sage.rings.function_field - Place (1/x, 1/x*y) - Place (x, x*y) + 2*Place (x + 1, x*y) @@ -141,8 +141,8 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(b^2 - a) # optional - sage.rings.function_field - sage: b.__pari__() # optional - sage.rings.function_field + sage: L. = K.extension(b^2 - a) # needs sage.rings.function_field + sage: b.__pari__() # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError: PARI does not support general function field elements. @@ -180,19 +180,19 @@ cdef class FunctionFieldElement(FieldElement): A rational function field:: sage: K. = FunctionField(QQ) - sage: t.matrix() # optional - sage.modules + sage: t.matrix() # needs sage.modules [t] - sage: (1/(t+1)).matrix() # optional - sage.modules + sage: (1/(t+1)).matrix() # needs sage.modules [1/(t + 1)] Now an example in a nontrivial extension of a rational function field:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: y.matrix() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: y.matrix() # needs sage.modules sage.rings.function_field [ 0 1] [-4*x^3 x] - sage: y.matrix().charpoly('Z') # optional - sage.modules sage.rings.function_field + sage: y.matrix().charpoly('Z') # needs sage.modules sage.rings.function_field Z^2 - x*Z + 4*x^3 An example in a relative extension, where neither function @@ -200,21 +200,21 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: M. = L[] # optional - sage.rings.function_field - sage: Z. = L.extension(T^3 - y^2*T + x) # optional - sage.rings.function_field - sage: alpha.matrix() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: M. = L[] # needs sage.rings.function_field + sage: Z. = L.extension(T^3 - y^2*T + x) # needs sage.rings.function_field + sage: alpha.matrix() # needs sage.modules sage.rings.function_field [ 0 1 0] [ 0 0 1] [ -x x*y - 4*x^3 0] - sage: alpha.matrix(K) # optional - sage.modules sage.rings.function_field + sage: alpha.matrix(K) # needs sage.modules sage.rings.function_field [ 0 0 1 0 0 0] [ 0 0 0 1 0 0] [ 0 0 0 0 1 0] [ 0 0 0 0 0 1] [ -x 0 -4*x^3 x 0 0] [ 0 -x -4*x^4 -4*x^3 + x^2 0 0] - sage: alpha.matrix(Z) # optional - sage.modules sage.rings.function_field + sage: alpha.matrix(Z) # needs sage.modules sage.rings.function_field [alpha] We show that this matrix does indeed work as expected when making a @@ -222,13 +222,13 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # optional - sage.rings.function_field - sage: V, from_V, to_V = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: y5 = to_V(y^5); y5 # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.function_field + sage: V, from_V, to_V = L.vector_space() # needs sage.modules sage.rings.function_field + sage: y5 = to_V(y^5); y5 # needs sage.modules sage.rings.function_field ((x^4 + 1)/x, 2*x, 0, 0, 0) - sage: y4y = to_V(y^4) * y.matrix(); y4y # optional - sage.modules sage.rings.function_field + sage: y4y = to_V(y^4) * y.matrix(); y4y # needs sage.modules sage.rings.function_field ((x^4 + 1)/x, 2*x, 0, 0, 0) - sage: y5 == y4y # optional - sage.modules sage.rings.function_field + sage: y5 == y4y # needs sage.modules sage.rings.function_field True """ # multiply each element of the vector space isomorphic to the parent @@ -250,8 +250,8 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: y.trace() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: y.trace() # needs sage.modules sage.rings.function_field x """ return self.matrix().trace() @@ -263,18 +263,18 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: y.norm() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: y.norm() # needs sage.modules sage.rings.function_field 4*x^3 The norm is relative:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^3 - y^2*z + x) # optional - sage.rings.function_field - sage: z.norm() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^3 - y^2*z + x) # needs sage.rings.function_field + sage: z.norm() # needs sage.modules sage.rings.function_field -x - sage: z.norm().parent() # optional - sage.modules sage.rings.function_field + sage: z.norm().parent() # needs sage.modules sage.rings.function_field Function field in y defined by y^2 - x*y + 4*x^3 """ return self.matrix().determinant() @@ -323,13 +323,13 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^3 - y^2*z + x) # optional - sage.rings.function_field - sage: x.characteristic_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^3 - y^2*z + x) # needs sage.rings.function_field + sage: x.characteristic_polynomial('W') # needs sage.modules sage.rings.function_field W - x - sage: y.characteristic_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: y.characteristic_polynomial('W') # needs sage.modules sage.rings.function_field W^2 - x*W + 4*x^3 - sage: z.characteristic_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: z.characteristic_polynomial('W') # needs sage.modules sage.rings.function_field W^3 + (-x*y + 4*x^3)*W + x """ return self.matrix().characteristic_polynomial(*args, **kwds) @@ -344,13 +344,13 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^3 - y^2*z + x) # optional - sage.rings.function_field - sage: x.minimal_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^3 - y^2*z + x) # needs sage.rings.function_field + sage: x.minimal_polynomial('W') # needs sage.modules sage.rings.function_field W - x - sage: y.minimal_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: y.minimal_polynomial('W') # needs sage.modules sage.rings.function_field W^2 - x*W + 4*x^3 - sage: z.minimal_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: z.minimal_polynomial('W') # needs sage.modules sage.rings.function_field W^3 + (-x*y + 4*x^3)*W + x """ return self.matrix().minimal_polynomial(*args, **kwds) @@ -364,16 +364,16 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: y.is_integral() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: y.is_integral() # needs sage.rings.function_field True - sage: (y/x).is_integral() # optional - sage.modules sage.rings.function_field + sage: (y/x).is_integral() # needs sage.modules sage.rings.function_field True - sage: (y/x)^2 - (y/x) + 4*x # optional - sage.modules sage.rings.function_field + sage: (y/x)^2 - (y/x) + 4*x # needs sage.modules sage.rings.function_field 0 - sage: (y/x^2).is_integral() # optional - sage.modules sage.rings.function_field + sage: (y/x^2).is_integral() # needs sage.modules sage.rings.function_field False - sage: (y/x).minimal_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: (y/x).minimal_polynomial('W') # needs sage.modules sage.rings.function_field W^2 - W + 4*x """ R = self.parent().base_field().maximal_order() @@ -387,29 +387,30 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ) sage: f = 1 / t - sage: f.differential() # optional - sage.modules + sage: f.differential() # needs sage.modules (-1/t^2) d(t) - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x +1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (y^3 + x).differential() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x +1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (y^3 + x).differential() # needs sage.modules sage.rings.finite_rings sage.rings.function_field (((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3) d(x) TESTS: Verify that :trac:`27712` is resolved:: - sage: K. = FunctionField(GF(31)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: R. = L[] # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = L.extension(z^2 - y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(31)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^2 - y) # needs sage.rings.function_field - sage: x.differential() # optional - sage.rings.finite_rings sage.modules + sage: x.differential() # needs sage.modules sage.rings.finite_rings d(x) - sage: y.differential() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: y.differential() # needs sage.modules sage.rings.finite_rings sage.rings.function_field (16/x*y) d(x) - sage: z.differential() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: z.differential() # needs sage.modules sage.rings.finite_rings sage.rings.function_field (8/x*z) d(x) """ F = self.parent() @@ -427,12 +428,12 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ) sage: f = (t + 1) / (t^2 - 1/3) - sage: f.derivative() # optional - sage.modules + sage: f.derivative() # needs sage.modules (-t^2 - 2*t - 1/3)/(t^4 - 2/3*t^2 + 1/9) - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (y^3 + x).derivative() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (y^3 + x).derivative() # needs sage.modules sage.rings.finite_rings sage.rings.function_field ((x^2 + 1)/x^2)*y + (x^4 + x^3 + 1)/x^3 """ D = self.parent().derivation() @@ -452,16 +453,16 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = t^2 # optional - sage.rings.finite_rings - sage: f.higher_derivative(2) # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = t^2 + sage: f.higher_derivative(2) # needs sage.modules sage.rings.finite_rings 1 :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (y^3 + x).higher_derivative(2) # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (y^3 + x).higher_derivative(2) # needs sage.modules sage.rings.finite_rings sage.rings.function_field 1/x^3*y + (x^6 + x^4 + x^3 + x^2 + x + 1)/x^5 """ D = self.parent().higher_derivation() @@ -474,18 +475,18 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = 1/(x^3 + x^2 + x) # optional - sage.rings.finite_rings - sage: f.divisor() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = 1/(x^3 + x^2 + x) + sage: f.divisor() # needs sage.modules sage.rings.finite_rings 3*Place (1/x) - Place (x) - Place (x^2 + x + 1) :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: y.divisor() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: y.divisor() # needs sage.modules sage.rings.finite_rings sage.rings.function_field - Place (1/x, 1/x*y) - Place (x, x*y) + 2*Place (x + 1, x*y) @@ -504,16 +505,16 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = 1/(x^3 + x^2 + x) # optional - sage.rings.finite_rings - sage: f.divisor_of_zeros() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = 1/(x^3 + x^2 + x) + sage: f.divisor_of_zeros() # needs sage.modules sage.rings.finite_rings 3*Place (1/x) :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (x/y).divisor_of_zeros() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (x/y).divisor_of_zeros() # needs sage.modules sage.rings.finite_rings sage.rings.function_field 3*Place (x, x*y) """ if self.is_zero(): @@ -530,17 +531,17 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = 1/(x^3 + x^2 + x) # optional - sage.rings.finite_rings - sage: f.divisor_of_poles() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = 1/(x^3 + x^2 + x) + sage: f.divisor_of_poles() # needs sage.modules sage.rings.finite_rings Place (x) + Place (x^2 + x + 1) :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (x/y).divisor_of_poles() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (x/y).divisor_of_poles() # needs sage.modules sage.rings.finite_rings sage.rings.function_field Place (1/x, 1/x*y) + 2*Place (x + 1, x*y) """ if self.is_zero(): @@ -557,16 +558,16 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = 1/(x^3 + x^2 + x) # optional - sage.rings.finite_rings - sage: f.zeros() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = 1/(x^3 + x^2 + x) + sage: f.zeros() # needs sage.modules sage.rings.finite_rings [Place (1/x)] :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: (x/y).zeros() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings + sage: (x/y).zeros() # needs sage.modules sage.rings.finite_rings [Place (x, x*y)] """ return self.divisor_of_zeros().support() @@ -577,16 +578,16 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: f = 1/(x^3 + x^2 + x) # optional - sage.rings.finite_rings - sage: f.poles() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)) + sage: f = 1/(x^3 + x^2 + x) + sage: f.poles() # needs sage.modules sage.rings.finite_rings [Place (x), Place (x^2 + x + 1)] :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: (x/y).poles() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: (x/y).poles() # needs sage.modules sage.rings.finite_rings sage.rings.function_field [Place (1/x, 1/x*y), Place (x + 1, x*y)] """ return self.divisor_of_poles().support() @@ -601,19 +602,20 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_infinite()[0] # optional - sage.rings.finite_rings sage.modules sage.rings.function_field - sage: y.valuation(p) # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_infinite()[0] # needs sage.modules sage.rings.function_field + sage: y.valuation(p) # needs sage.modules sage.rings.function_field -1 :: sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.function_field sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.function_field sage.rings.function_field - sage: p = O.ideal(x - 1).place() # optional - sage.rings.function_field sage.rings.function_field - sage: y.valuation(p) # optional - sage.rings.function_field sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: p = O.ideal(x - 1).place() # needs sage.rings.function_field + sage: y.valuation(p) # needs sage.rings.function_field 0 """ prime = place.prime_ideal() @@ -636,23 +638,25 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: p = K.place_infinite() # optional - sage.rings.finite_rings - sage: f = 1/t^2 + 3 # optional - sage.rings.finite_rings - sage: f.evaluate(p) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: p = K.place_infinite() + sage: f = 1/t^2 + 3 + sage: f.evaluate(p) 3 :: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p, = L.places_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: p, = L.places_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: (y + x).evaluate(p) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p, = L.places_infinite() # needs sage.rings.function_field + sage: p, = L.places_infinite() # needs sage.rings.function_field + sage: (y + x).evaluate(p) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: has a pole at the place - sage: (y/x + 1).evaluate(p) # optional - sage.rings.finite_rings sage.rings.function_field + sage: (y/x + 1).evaluate(p) # needs sage.rings.function_field 1 """ R, _, to_R = place._residue_field() @@ -685,9 +689,9 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: f = (x+1)/(x-1) # optional - sage.rings.finite_rings - sage: f.is_nth_power(2) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: f = (x+1)/(x-1) + sage: f.is_nth_power(2) False """ raise NotImplementedError("is_nth_power() not implemented for generic elements") @@ -711,10 +715,11 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L(y^27).nth_root(27) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: L(y^27).nth_root(27) # needs sage.rings.function_field y """ raise NotImplementedError("nth_root() not implemented for generic elements") diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index e797531eea9..2d8adccb476 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -276,22 +276,24 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: L(y^3).nth_root(3) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: L(y^3).nth_root(3) y - sage: L(y^9).nth_root(-9) # optional - sage.rings.finite_rings + sage: L(y^9).nth_root(-9) 1/x*y This also works for inseparable extensions:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 - x^2) # optional - sage.rings.finite_rings - sage: L(x).nth_root(3)^3 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: R. = K[] + sage: L. = K.extension(y^3 - x^2) + sage: L(x).nth_root(3)^3 x - sage: L(x^9).nth_root(-27)^-27 # optional - sage.rings.finite_rings + sage: L(x^9).nth_root(-27)^-27 x^9 """ @@ -337,12 +339,13 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: y.is_nth_power(2) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: y.is_nth_power(2) False - sage: L(x).is_nth_power(2) # optional - sage.rings.finite_rings + sage: L(x).is_nth_power(2) True """ @@ -374,10 +377,11 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: (y^3).nth_root(3) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: (y^3).nth_root(3) # indirect doctest y """ cdef Py_ssize_t deg = self._parent.degree() diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index a21fbe397e2..07d1f0da766 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -59,7 +59,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: ((a+1)/(a-1)).__pari__() # optional - sage.rings.finite_rings + sage: ((a+1)/(a-1)).__pari__() # needs sage.rings.finite_rings (a + 1)/(a - 1) """ @@ -71,16 +71,16 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: t.element() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: t.element() t - sage: type(t.element()) # optional - sage.rings.finite_rings + sage: type(t.element()) # needs sage.rings.finite_rings <... 'sage.rings.fraction_field_FpT.FpTElement'> - sage: K. = FunctionField(GF(131101)) # optional - sage.rings.finite_rings - sage: t.element() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(131101)) # needs sage.rings.finite_rings + sage: t.element() t - sage: type(t.element()) # optional - sage.rings.finite_rings + sage: type(t.element()) <... 'sage.rings.fraction_field_element.FractionFieldElement_1poly_field'> """ return self._x @@ -297,9 +297,9 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: f.valuation(t^2 - 1/3) -3 - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: p = K.places_finite()[0] # optional - sage.rings.finite_rings - sage: (1/x^2).valuation(p) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: p = K.places_finite()[0] # needs sage.rings.finite_rings + sage: (1/x^2).valuation(p) # needs sage.rings.finite_rings -2 """ from .place import FunctionFieldPlace @@ -327,10 +327,10 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: f = 9 * (t+1)^6 / (t^2 - 2*t + 1); f.is_square() True - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: (-t^2).is_square() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: (-t^2).is_square() # needs sage.rings.finite_rings True - sage: (-t^2).sqrt() # optional - sage.rings.finite_rings + sage: (-t^2).sqrt() # needs sage.rings.finite_rings 2*t """ return self._x.is_square() @@ -385,15 +385,16 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: f = (x+1)/(x-1) # optional - sage.rings.finite_rings - sage: f.is_nth_power(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: f = (x+1)/(x-1) + sage: f.is_nth_power(1) True - sage: f.is_nth_power(3) # optional - sage.rings.finite_rings + sage: f.is_nth_power(3) False - sage: (f^3).is_nth_power(3) # optional - sage.rings.finite_rings + sage: (f^3).is_nth_power(3) True - sage: (f^9).is_nth_power(-9) # optional - sage.rings.finite_rings + sage: (f^9).is_nth_power(-9) True """ if n == 1: @@ -436,17 +437,18 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: f = (x+1)/(x+2) # optional - sage.rings.finite_rings - sage: f.nth_root(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: f = (x+1)/(x+2) + sage: f.nth_root(1) (x + 1)/(x + 2) - sage: f.nth_root(3) # optional - sage.rings.finite_rings + sage: f.nth_root(3) Traceback (most recent call last): ... ValueError: element is not an n-th power - sage: (f^3).nth_root(3) # optional - sage.rings.finite_rings + sage: (f^3).nth_root(3) (x + 1)/(x + 2) - sage: (f^9).nth_root(-9) # optional - sage.rings.finite_rings + sage: (f^9).nth_root(-9) (x + 2)/(x + 1) """ if n == 0: @@ -475,13 +477,13 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: K. = FunctionField(QQ) sage: f = (t+1) / (t^2 - 1/3) - sage: f.factor() # optional - sage.rings.finite_rings + sage: f.factor() # needs sage.rings.finite_rings (t + 1) * (t^2 - 1/3)^-1 - sage: (7*f).factor() # optional - sage.rings.finite_rings + sage: (7*f).factor() # needs sage.rings.finite_rings (7) * (t + 1) * (t^2 - 1/3)^-1 - sage: ((7*f).factor()).unit() # optional - sage.rings.finite_rings + sage: ((7*f).factor()).unit() # needs sage.rings.finite_rings 7 - sage: (f^3).factor() # optional - sage.rings.finite_rings + sage: (f^3).factor() # needs sage.rings.finite_rings (t + 1)^3 * (t^2 - 1/3)^-3 """ P = self.parent() diff --git a/src/sage/rings/function_field/extensions.py b/src/sage/rings/function_field/extensions.py index 10a81cc3c1e..335293ebdd6 100644 --- a/src/sage/rings/function_field/extensions.py +++ b/src/sage/rings/function_field/extensions.py @@ -11,36 +11,37 @@ Constant field extension of the rational function field over rational numbers:: sage: K. = FunctionField(QQ) - sage: N. = QuadraticField(2) # optional - sage.rings.number_field - sage: L = K.extension_constant_field(N) # optional - sage.rings.number_field - sage: L # optional - sage.rings.number_field + sage: N. = QuadraticField(2) # needs sage.rings.number_field + sage: L = K.extension_constant_field(N) # needs sage.rings.number_field + sage: L # needs sage.rings.number_field Rational function field in x over Number Field in a with defining polynomial x^2 - 2 with a = 1.4142... over its base - sage: d = (x^2 - 2).divisor() # optional - sage.rings.number_field - sage: d # optional - sage.rings.number_field + sage: d = (x^2 - 2).divisor() # needs sage.rings.number_field + sage: d # needs sage.rings.number_field -2*Place (1/x) + Place (x^2 - 2) - sage: L.conorm_divisor(d) # optional - sage.rings.number_field + sage: L.conorm_divisor(d) # needs sage.rings.number_field -2*Place (1/x) + Place (x - a) + Place (x + a) Constant field extension of a function field over a finite field:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: E # needs sage.rings.function_field Function field in y defined by y^3 + x^6 + x^4 + x^2 over its base - sage: p = F.get_place(3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E.conorm_place(p) # random # optional - sage.rings.finite_rings sage.rings.function_field + sage: p = F.get_place(3) # needs sage.rings.function_field + sage: E.conorm_place(p) # random # needs sage.rings.function_field Place (x + z3, y + z3^2 + z3) + Place (x + z3^2, y + z3) + Place (x + z3^2 + z3, y + z3^2) - sage: q = F.get_place(2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E.conorm_place(q) # random # optional - sage.rings.finite_rings sage.rings.function_field + sage: q = F.get_place(2) # needs sage.rings.function_field + sage: E.conorm_place(q) # random # needs sage.rings.function_field Place (x + 1, y^2 + y + 1) - sage: E.conorm_divisor(p + q) # random # optional - sage.rings.finite_rings sage.rings.function_field + sage: E.conorm_divisor(p + q) # random # needs sage.rings.function_field Place (x + 1, y^2 + y + 1) + Place (x + z3, y + z3^2 + z3) + Place (x + z3^2, y + z3) @@ -90,10 +91,11 @@ def __init__(self, F, k_ext): TESTS:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(E).run(skip=['_test_elements', '_test_pickling']) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: TestSuite(E).run(skip=['_test_elements', '_test_pickling']) # needs sage.rings.function_field """ k = F.constant_base_field() F_base = F.base_field() @@ -129,10 +131,11 @@ def top(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E.top() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: E.top() # needs sage.rings.function_field Function field in y defined by y^3 + x^6 + x^4 + x^2 """ return self._F_ext @@ -145,10 +148,11 @@ def defining_morphism(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E.defining_morphism() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: E.defining_morphism() # needs sage.rings.function_field Function Field morphism: From: Function field in y defined by y^3 + x^6 + x^4 + x^2 To: Function field in y defined by y^3 + x^6 + x^4 + x^2 @@ -170,16 +174,17 @@ def conorm_place(self, p): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = F.get_place(3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: d = E.conorm_place(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: [pl.degree() for pl in d.support()] # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: p = F.get_place(3) # needs sage.rings.function_field + sage: d = E.conorm_place(p) # needs sage.rings.function_field + sage: [pl.degree() for pl in d.support()] # needs sage.rings.function_field [1, 1, 1] - sage: p = F.get_place(2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: d = E.conorm_place(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: [pl.degree() for pl in d.support()] # optional - sage.rings.finite_rings sage.rings.function_field + sage: p = F.get_place(2) # needs sage.rings.function_field + sage: d = E.conorm_place(p) # needs sage.rings.function_field + sage: [pl.degree() for pl in d.support()] # needs sage.rings.function_field [2] """ embedF = self.defining_morphism() @@ -206,15 +211,16 @@ def conorm_divisor(self, d): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1 = F.get_place(3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p2 = F.get_place(2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: c = E.conorm_divisor(2*p1 + 3*p2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: c1 = E.conorm_place(p1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: c2 = E.conorm_place(p2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: c == 2*c1 + 3*c2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field + sage: p1 = F.get_place(3) # needs sage.rings.function_field + sage: p2 = F.get_place(2) # needs sage.rings.function_field + sage: c = E.conorm_divisor(2*p1 + 3*p2) # needs sage.rings.function_field + sage: c1 = E.conorm_place(p1) # needs sage.rings.function_field + sage: c2 = E.conorm_place(p2) # needs sage.rings.function_field + sage: c == 2*c1 + 3*c2 # needs sage.rings.function_field True """ div_top = self.divisor_group() diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 8392792e995..6739e722df2 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -9,122 +9,126 @@ We create a rational function field:: - sage: K. = FunctionField(GF(5^2,'a')); K # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5^2,'a')); K Rational function field in x over Finite Field in a of size 5^2 - sage: K.genus() # optional - sage.rings.finite_rings + sage: K.genus() 0 - sage: f = (x^2 + x + 1) / (x^3 + 1) # optional - sage.rings.finite_rings - sage: f # optional - sage.rings.finite_rings + sage: f = (x^2 + x + 1) / (x^3 + 1) + sage: f (x^2 + x + 1)/(x^3 + 1) - sage: f^3 # optional - sage.rings.finite_rings + sage: f^3 (x^6 + 3*x^5 + x^4 + 2*x^3 + x^2 + 3*x + 1)/(x^9 + 3*x^6 + 3*x^3 + 1) Then we create an extension of the rational function field, and do some simple arithmetic in it:: - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 - (x^3 + 2*x*y + 1/x)); L # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: R. = K[] + sage: L. = K.extension(y^3 - (x^3 + 2*x*y + 1/x)); L # needs sage.rings.function_field Function field in y defined by y^3 + 3*x*y + (4*x^4 + 4)/x - sage: y^2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 # needs sage.rings.function_field y^2 - sage: y^3 # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^3 # needs sage.rings.function_field 2*x*y + (x^4 + 1)/x - sage: a = 1/y; a # optional - sage.rings.finite_rings sage.rings.function_field + sage: a = 1/y; a # needs sage.rings.function_field (x/(x^4 + 1))*y^2 + 3*x^2/(x^4 + 1) - sage: a * y # optional - sage.rings.finite_rings sage.rings.function_field + sage: a * y # needs sage.rings.function_field 1 We next make an extension of the above function field, illustrating that arithmetic with a tower of three fields is fully supported:: - sage: S. = L[] # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = L.extension(t^2 - x*y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: M # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: S. = L[] + sage: M. = L.extension(t^2 - x*y) + sage: M Function field in t defined by t^2 + 4*x*y - sage: t^2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: t^2 x*y - sage: 1/t # optional - sage.rings.finite_rings sage.rings.function_field + sage: 1/t ((1/(x^4 + 1))*y^2 + 3*x/(x^4 + 1))*t - sage: M.base_field() # optional - sage.rings.finite_rings sage.rings.function_field + sage: M.base_field() Function field in y defined by y^3 + 3*x*y + (4*x^4 + 4)/x - sage: M.base_field().base_field() # optional - sage.rings.finite_rings sage.rings.function_field + sage: M.base_field().base_field() Rational function field in x over Finite Field in a of size 5^2 It is also possible to construct function fields over an imperfect base field:: - sage: N. = FunctionField(K) # optional - sage.rings.finite_rings + sage: N. = FunctionField(K) # needs sage.rings.finite_rings and inseparable extension function fields:: - sage: J. = FunctionField(GF(5)); J # optional - sage.rings.finite_rings + sage: J. = FunctionField(GF(5)); J Rational function field in x over Finite Field of size 5 - sage: T. = J[] # optional - sage.rings.finite_rings - sage: O. = J.extension(v^5 - x); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: T. = J[] + sage: O. = J.extension(v^5 - x); O # needs sage.rings.finite_rings sage.rings.function_field Function field in v defined by v^5 + 4*x Function fields over the rational field are supported:: sage: F. = FunctionField(QQ) sage: R. = F[] - sage: L. = F.extension(Y^2 - x^8 - 1) # optional - sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.function_field - sage: I = O.ideal(x, y - 1) # optional - sage.rings.function_field - sage: P = I.place() # optional - sage.rings.function_field - sage: D = P.divisor() # optional - sage.rings.function_field - sage: D.basis_function_space() # optional - sage.rings.function_field + sage: L. = F.extension(Y^2 - x^8 - 1) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(x, y - 1) # needs sage.rings.function_field + sage: P = I.place() # needs sage.rings.function_field + sage: D = P.divisor() # needs sage.rings.function_field + sage: D.basis_function_space() # needs sage.rings.function_field [1] - sage: (2*D).basis_function_space() # optional - sage.rings.function_field + sage: (2*D).basis_function_space() # needs sage.rings.function_field [1] - sage: (3*D).basis_function_space() # optional - sage.rings.function_field + sage: (3*D).basis_function_space() # needs sage.rings.function_field [1] - sage: (4*D).basis_function_space() # optional - sage.rings.function_field + sage: (4*D).basis_function_space() # needs sage.rings.function_field [1, 1/x^4*y + 1/x^4] sage: K. = FunctionField(QQ); _. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: I.divisor() # optional - sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: O = F.maximal_order() + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor() # needs sage.rings.function_field 2*Place (x, y, (1/(x^3 + x^2 + x))*y^2) + 2*Place (x^2 + x + 1, y, (1/(x^3 + x^2 + x))*y^2) sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: I.divisor() # optional - sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor() # needs sage.rings.function_field - Place (x, x*y) + Place (x^2 + 1, x*y) Function fields over the algebraic field are supported:: - sage: K. = FunctionField(QQbar); _. = K[] # optional - sage.rings.number_field - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.function_field sage.rings.number_field - sage: O = L.maximal_order() # optional - sage.rings.function_field sage.rings.number_field - sage: I = O.ideal(y) # optional - sage.rings.function_field sage.rings.number_field - sage: I.divisor() # optional - sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = FunctionField(QQbar); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor() # needs sage.rings.function_field Place (x - I, x*y) - Place (x, x*y) + Place (x + I, x*y) - sage: pl = I.divisor().support()[0] # optional - sage.rings.function_field sage.rings.number_field - sage: m = L.completion(pl, prec=5) # optional - sage.rings.function_field sage.rings.number_field - sage: m(x) # optional - sage.rings.function_field sage.rings.number_field + sage: pl = I.divisor().support()[0] # needs sage.rings.function_field + sage: m = L.completion(pl, prec=5) # needs sage.rings.function_field + sage: m(x) # needs sage.rings.function_field I + s + O(s^5) - sage: m(y) # long time (4s) # optional - sage.rings.function_field sage.rings.number_field + sage: m(y) # long time (4s) # needs sage.rings.function_field -2*s + (-4 - I)*s^2 + (-15 - 4*I)*s^3 + (-75 - 23*I)*s^4 + (-413 - 154*I)*s^5 + O(s^6) - sage: m(y)^2 + m(y) + m(x) + 1/m(x) # long time (8s) # optional - sage.rings.function_field sage.rings.number_field + sage: m(y)^2 + m(y) + m(x) + 1/m(x) # long time (8s) # needs sage.rings.function_field O(s^5) TESTS:: - sage: TestSuite(J).run() # optional - sage.rings.finite_rings - sage: TestSuite(K).run(max_runs=256) # long time (10s) # optional - sage.rings.number_field - sage: TestSuite(L).run(max_runs=8) # long time (25s) # optional - sage.rings.function_field sage.rings.number_field - sage: TestSuite(M).run(max_runs=8) # long time (35s) # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s) # optional - sage.rings.finite_rings - sage: TestSuite(O).run() # optional - sage.rings.function_field sage.rings.number_field + sage: TestSuite(J).run() # needs sage.rings.finite_rings + sage: TestSuite(K).run(max_runs=256) # long time (10s) # needs sage.rings.number_field + sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field + sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field + sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings + sage: TestSuite(O).run() # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(R).run() - sage: TestSuite(S).run() # long time (4s) # optional - sage.rings.finite_rings sage.rings.function_field + sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field Global function fields ---------------------- @@ -139,31 +143,33 @@ of its maximal order and maximal infinite order, and then do arithmetic with ideals of those maximal orders:: - sage: K. = FunctionField(GF(3)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); _. = K[] + sage: L. = K.extension(t^4 + t - x^5) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, y, 1/x*y^2 + 1/x*y, 1/x^3*y^3 + 2/x^3*y^2 + 1/x^3*y) - sage: I = O.ideal(x,y); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: I = O.ideal(x,y); I # needs sage.rings.function_field Ideal (x, y) of Maximal order of Function field in y defined by y^4 + y + 2*x^5 - sage: J = I^-1 # optional - sage.rings.finite_rings sage.rings.function_field - sage: J.basis_matrix() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = I^-1 # needs sage.rings.function_field + sage: J.basis_matrix() # needs sage.rings.function_field [ 1 0 0 0] [1/x 1/x 0 0] [ 0 0 1 0] [ 0 0 0 1] - sage: L.maximal_order_infinite().basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: L.maximal_order_infinite().basis() # needs sage.rings.function_field (1, 1/x^2*y, 1/x^3*y^2, 1/x^4*y^3) As an example of the most sophisticated computations that Sage can do with a global function field, we compute all the Weierstrass places of the Klein quartic over `\GF{2}` and gap numbers for ordinary places:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.genus() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: L.genus() # needs sage.rings.function_field 3 - sage: L.weierstrass_places() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: L.weierstrass_places() # needs sage.modules sage.rings.function_field [Place (1/x, 1/x^3*y^2 + 1/x), Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1), Place (x, y), @@ -174,17 +180,18 @@ Place (x^3 + x^2 + 1, y + x), Place (x^3 + x^2 + 1, y + x^2 + 1), Place (x^3 + x^2 + 1, y + x^2 + x + 1)] - sage: L.gaps() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: L.gaps() # needs sage.modules sage.rings.function_field [1, 2, 3] The gap numbers for Weierstrass places are of course not ordinary:: - sage: p1,p2,p3 = L.weierstrass_places()[:3] # optional - sage.rings.finite_rings sage.modules sage.rings.function_field - sage: p1.gaps() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: p1,p2,p3 = L.weierstrass_places()[:3] + sage: p1.gaps() [1, 2, 4] - sage: p2.gaps() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: p2.gaps() [1, 2, 4] - sage: p3.gaps() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: p3.gaps() [1, 2, 4] AUTHORS: @@ -303,7 +310,7 @@ def is_perfect(self): sage: FunctionField(QQ, 'x').is_perfect() True - sage: FunctionField(GF(2), 'x').is_perfect() # optional - sage.rings.finite_rings + sage: FunctionField(GF(2), 'x').is_perfect() False """ return self.characteristic() == 0 @@ -331,8 +338,8 @@ def some_elements(self): :: sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: L.some_elements() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: L.some_elements() # needs sage.rings.function_field [1, y, 1/x*y, @@ -366,15 +373,15 @@ def characteristic(self): sage: K. = FunctionField(QQ) sage: K.characteristic() 0 - sage: K. = FunctionField(QQbar) # optional - sage.rings.number_field - sage: K.characteristic() # optional - sage.rings.number_field + sage: K. = FunctionField(QQbar) # needs sage.rings.number_field + sage: K.characteristic() 0 - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.characteristic() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.characteristic() 7 - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.characteristic() # optional - sage.rings.finite_rings sage.rings.function_field + sage: R. = K[] + sage: L. = K.extension(y^2 - x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.characteristic() # needs sage.rings.finite_rings sage.rings.function_field 7 """ return self.constant_base_field().characteristic() @@ -388,8 +395,8 @@ def is_finite(self): sage: R. = FunctionField(QQ) sage: R.is_finite() False - sage: R. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: R.is_finite() # optional - sage.rings.finite_rings + sage: R. = FunctionField(GF(7)) + sage: R.is_finite() False """ return False @@ -404,11 +411,11 @@ def is_global(self): sage: R. = FunctionField(QQ) sage: R.is_global() False - sage: R. = FunctionField(QQbar) # optional - sage.rings.number_field - sage: R.is_global() # optional - sage.rings.number_field + sage: R. = FunctionField(QQbar) # needs sage.rings.number_field + sage: R.is_global() False - sage: R. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: R.is_global() # optional - sage.rings.finite_rings + sage: R. = FunctionField(GF(7)) + sage: R.is_global() True """ return self.constant_base_field().is_finite() @@ -431,18 +438,18 @@ def extension(self, f, names=None): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: K.extension(y^5 - x^3 - 3*x + x*y) # optional - sage.rings.function_field + sage: K.extension(y^5 - x^3 - 3*x + x*y) # needs sage.rings.function_field Function field in y defined by y^5 + x*y - x^3 - 3*x A nonintegral defining polynomial:: sage: K. = FunctionField(QQ); R. = K[] - sage: K.extension(y^3 + (1/t)*y + t^3/(t+1), 'z') # optional - sage.rings.function_field + sage: K.extension(y^3 + (1/t)*y + t^3/(t+1), 'z') # needs sage.rings.function_field Function field in z defined by z^3 + 1/t*z + t^3/(t + 1) The defining polynomial need not be monic or integral:: - sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # optional - sage.rings.function_field + sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field Function field in y defined by t*y^3 + 1/t*y + t^3/(t + 1) """ from . import constructor @@ -468,29 +475,29 @@ def order_with_basis(self, basis, check=True): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: O = L.order_with_basis([1, y, y^2]); O # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: O = L.order_with_basis([1, y, y^2]); O # needs sage.rings.function_field Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # optional - sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, y, y^2) Note that 1 does not need to be an element of the basis, as long it is in the module spanned by it:: - sage: O = L.order_with_basis([1+y, y, y^2]); O # optional - sage.rings.function_field + sage: O = L.order_with_basis([1+y, y, y^2]); O # needs sage.rings.function_field Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # optional - sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (y + 1, y, y^2) The following error is raised when the module spanned by the basis is not closed under multiplication:: - sage: O = L.order_with_basis([1, x^2 + x*y, (2/3)*y^2]); O # optional - sage.rings.function_field + sage: O = L.order_with_basis([1, x^2 + x*y, (2/3)*y^2]); O # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: the module generated by basis (1, x*y + x^2, 2/3*y^2) must be closed under multiplication and this happens when the identity is not in the module spanned by the basis:: - sage: O = L.order_with_basis([x, x^2 + x*y, (2/3)*y^2]) # optional - sage.rings.function_field + sage: O = L.order_with_basis([x, x^2 + x*y, (2/3)*y^2]) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: the identity element must be in the module spanned by basis (x, x*y + x^2, 2/3*y^2) @@ -511,20 +518,20 @@ def order(self, x, check=True): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: O = L.order(y); O # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: O = L.order(y); O # needs sage.modules sage.rings.function_field Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # optional - sage.modules sage.rings.function_field + sage: O.basis() # needs sage.modules sage.rings.function_field (1, y, y^2) - sage: Z = K.order(x); Z # optional - sage.modules + sage: Z = K.order(x); Z # needs sage.modules Order in Rational function field in x over Rational Field - sage: Z.basis() # optional - sage.modules + sage: Z.basis() # needs sage.modules (1,) Orders with multiple generators are not yet supported:: - sage: Z = K.order([x, x^2]); Z # optional - sage.modules + sage: Z = K.order([x, x^2]); Z Traceback (most recent call last): ... NotImplementedError @@ -556,24 +563,24 @@ def order_infinite_with_basis(self, basis, check=True): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: O = L.order_infinite_with_basis([1, 1/x*y, 1/x^2*y^2]); O # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: O = L.order_infinite_with_basis([1, 1/x*y, 1/x^2*y^2]); O # needs sage.rings.function_field Infinite order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # optional - sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, 1/x*y, 1/x^2*y^2) Note that 1 does not need to be an element of the basis, as long it is in the module spanned by it:: - sage: O = L.order_infinite_with_basis([1+1/x*y,1/x*y, 1/x^2*y^2]); O # optional - sage.rings.function_field + sage: O = L.order_infinite_with_basis([1+1/x*y,1/x*y, 1/x^2*y^2]); O # needs sage.rings.function_field Infinite order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # optional - sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1/x*y + 1, 1/x*y, 1/x^2*y^2) The following error is raised when the module spanned by the basis is not closed under multiplication:: - sage: O = L.order_infinite_with_basis([1,y, 1/x^2*y^2]); O # optional - sage.rings.function_field + sage: O = L.order_infinite_with_basis([1,y, 1/x^2*y^2]); O # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: the module generated by basis (1, y, 1/x^2*y^2) must be closed under multiplication @@ -581,7 +588,7 @@ def order_infinite_with_basis(self, basis, check=True): and this happens when the identity is not in the module spanned by the basis:: - sage: O = L.order_infinite_with_basis([1/x,1/x*y, 1/x^2*y^2]) # optional - sage.rings.function_field + sage: O = L.order_infinite_with_basis([1/x,1/x*y, 1/x^2*y^2]) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: the identity element must be in the module spanned by basis (1/x, 1/x*y, 1/x^2*y^2) @@ -602,17 +609,17 @@ def order_infinite(self, x, check=True): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: L.order_infinite(y) # todo: not implemented # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: L.order_infinite(y) # not implemented # needs sage.modules sage.rings.function_field - sage: Z = K.order(x); Z # optional - sage.modules + sage: Z = K.order(x); Z # needs sage.modules Order in Rational function field in x over Rational Field - sage: Z.basis() # optional - sage.modules + sage: Z.basis() # needs sage.modules (1,) Orders with multiple generators, not yet supported:: - sage: Z = K.order_infinite([x, x^2]); Z # optional - sage.modules + sage: Z = K.order_infinite([x, x^2]); Z Traceback (most recent call last): ... NotImplementedError @@ -639,34 +646,34 @@ def _coerce_map_from_(self, source): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: L.equation_order() # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: L.equation_order() # needs sage.rings.function_field Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: L._coerce_map_from_(L.equation_order()) # optional - sage.rings.function_field + sage: L._coerce_map_from_(L.equation_order()) # needs sage.rings.function_field Conversion map: From: Order in Function field in y defined by y^3 + x^3 + 4*x + 1 To: Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: L._coerce_map_from_(GF(7)) # optional - sage.rings.finite_rings sage.rings.function_field + sage: L._coerce_map_from_(GF(7)) # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(QQ) - sage: L. = FunctionField(GaussianIntegers().fraction_field()) # optional - sage.rings.number_field - sage: L.has_coerce_map_from(K) # optional - sage.rings.number_field + sage: L. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field + sage: L.has_coerce_map_from(K) # needs sage.rings.number_field True sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^3 + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: K. = FunctionField(GaussianIntegers().fraction_field()) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: M. = K.extension(y^3 + 1) # optional - sage.rings.function_field - sage: M.has_coerce_map_from(L) # not tested (the constant field including into a function field is not yet known to be injective) # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field + sage: R. = K[] + sage: M. = K.extension(y^3 + 1) # needs sage.rings.function_field + sage: M.has_coerce_map_from(L) # not tested (the constant field including into a function field is not yet known to be injective), needs sage.rings.function_field True sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(I^2 + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = FunctionField(GaussianIntegers().fraction_field()) # optional - sage.rings.number_field - sage: M.has_coerce_map_from(L) # optional - sage.rings.finite_rings sage.rings.function_field sage.rings.number_field + sage: L. = K.extension(I^2 + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: M. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field + sage: M.has_coerce_map_from(L) # needs sage.rings.finite_rings sage.rings.function_field sage.rings.number_field True Check that :trac:`31072` is fixed:: @@ -764,8 +771,8 @@ def _convert_map_from_(self, R): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # optional - sage.rings.function_field - sage: K(L(x)) # indirect doctest # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field + sage: K(L(x)) # indirect doctest # needs sage.rings.function_field x """ try: @@ -799,28 +806,29 @@ def _intermediate_fields(self, base): [Rational function field in x over Rational Field] sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: L._intermediate_fields(K) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: L._intermediate_fields(K) # needs sage.rings.function_field [Function field in y defined by y^2 - x, Rational function field in x over Rational Field] - sage: R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^2 - y) # optional - sage.rings.function_field - sage: M._intermediate_fields(L) # optional - sage.rings.function_field + sage: # needs sage.rings.function_field + sage: R. = L[] + sage: M. = L.extension(z^2 - y) + sage: M._intermediate_fields(L) [Function field in z defined by z^2 - y, Function field in y defined by y^2 - x] - sage: M._intermediate_fields(K) # optional - sage.rings.function_field + sage: M._intermediate_fields(K) [Function field in z defined by z^2 - y, Function field in y defined by y^2 - x, Rational function field in x over Rational Field] TESTS:: - sage: K._intermediate_fields(M) # optional - sage.rings.function_field + sage: K._intermediate_fields(M) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: field has not been constructed as a finite extension of base - sage: K._intermediate_fields(QQ) # optional - sage.rings.function_field + sage: K._intermediate_fields(QQ) Traceback (most recent call last): ... TypeError: base must be a function field @@ -847,13 +855,13 @@ def rational_function_field(self): Rational function field in x over Rational Field sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: L.rational_function_field() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: L.rational_function_field() # needs sage.rings.function_field Rational function field in x over Rational Field - sage: R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^2 - y) # optional - sage.rings.function_field - sage: M.rational_function_field() # optional - sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^2 - y) # needs sage.rings.function_field + sage: M.rational_function_field() # needs sage.rings.function_field Rational function field in x over Rational Field """ from .function_field_rational import RationalFunctionField @@ -877,49 +885,50 @@ def valuation(self, prime): function field:: sage: K. = FunctionField(QQ) - sage: v = K.valuation(1); v # optional - sage.rings.function_field + sage: v = K.valuation(1); v # needs sage.rings.function_field (x - 1)-adic valuation - sage: v(x) # optional - sage.rings.function_field + sage: v(x) # needs sage.rings.function_field 0 - sage: v(x - 1) # optional - sage.rings.function_field + sage: v(x - 1) # needs sage.rings.function_field 1 A place can also be specified with an irreducible polynomial:: - sage: v = K.valuation(x - 1); v # optional - sage.rings.function_field + sage: v = K.valuation(x - 1); v # needs sage.rings.function_field (x - 1)-adic valuation Similarly, for a finite non-rational place:: - sage: v = K.valuation(x^2 + 1); v # optional - sage.rings.function_field + sage: v = K.valuation(x^2 + 1); v # needs sage.rings.function_field (x^2 + 1)-adic valuation - sage: v(x^2 + 1) # optional - sage.rings.function_field + sage: v(x^2 + 1) # needs sage.rings.function_field 1 - sage: v(x) # optional - sage.rings.function_field + sage: v(x) # needs sage.rings.function_field 0 Or for the infinite place:: - sage: v = K.valuation(1/x); v # optional - sage.rings.function_field + sage: v = K.valuation(1/x); v # needs sage.rings.function_field Valuation at the infinite place - sage: v(x) # optional - sage.rings.function_field + sage: v(x) # needs sage.rings.function_field -1 Instead of specifying a generator of a place, we can define a valuation on a rational function field by giving a discrete valuation on the underlying polynomial ring:: - sage: R. = QQ[] # optional - sage.rings.function_field - sage: u = valuations.GaussValuation(R, valuations.TrivialValuation(QQ)) # optional - sage.rings.function_field - sage: w = u.augmentation(x - 1, 1) # optional - sage.rings.function_field - sage: v = K.valuation(w); v # optional - sage.rings.function_field + sage: # needs sage.rings.function_field + sage: R. = QQ[] + sage: u = valuations.GaussValuation(R, valuations.TrivialValuation(QQ)) + sage: w = u.augmentation(x - 1, 1) + sage: v = K.valuation(w); v (x - 1)-adic valuation Note that this allows us to specify valuations which do not correspond to a place of the function field:: - sage: w = valuations.GaussValuation(R, QQ.valuation(2)) # optional - sage.rings.function_field - sage: v = K.valuation(w); v # optional - sage.rings.function_field + sage: w = valuations.GaussValuation(R, QQ.valuation(2)) # needs sage.rings.function_field + sage: v = K.valuation(w); v # needs sage.rings.function_field 2-adic valuation The same is possible for valuations with `v(1/x) > 0` by passing in an @@ -929,9 +938,9 @@ def valuation(self, prime): applying the substitution `x \mapsto 1/x` (here, the inverse map is also `x \mapsto 1/x`):: - sage: w = valuations.GaussValuation(R, QQ.valuation(2)).augmentation(x, 1) # optional - sage.rings.function_field - sage: w = K.valuation(w) # optional - sage.rings.function_field - sage: v = K.valuation((w, K.hom([~K.gen()]), K.hom([~K.gen()]))); v # optional - sage.rings.function_field + sage: w = valuations.GaussValuation(R, QQ.valuation(2)).augmentation(x, 1) # needs sage.rings.function_field + sage: w = K.valuation(w) # needs sage.rings.function_field + sage: v = K.valuation((w, K.hom([~K.gen()]), K.hom([~K.gen()]))); v # needs sage.rings.function_field Valuation on rational function field induced by [ Gauss valuation induced by 2-adic valuation, v(x) = 1 ] (in Rational function field in x over Rational Field after x |--> 1/x) @@ -939,10 +948,11 @@ def valuation(self, prime): Note that classical valuations at finite places or the infinite place are always normalized such that the uniformizing element has valuation 1:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = FunctionField(K) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = M.valuation(x^3 - t) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v(x^3 - t) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(3)) + sage: M. = FunctionField(K) + sage: v = M.valuation(x^3 - t) + sage: v(x^3 - t) 1 However, if such a valuation comes out of a base change of the ground @@ -950,16 +960,17 @@ def valuation(self, prime): extension of ``v`` to ``L`` still has valuation 1 on `x^3 - t` but it has valuation ``1/3`` on its uniformizing element `x - w`:: - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(w^3 - t) # optional - sage.rings.finite_rings sage.rings.function_field - sage: N. = FunctionField(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = v.extension(N) # missing factorization, :trac:`16572` # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: R. = K[] + sage: L. = K.extension(w^3 - t) # needs sage.rings.function_field + sage: N. = FunctionField(L) # needs sage.rings.function_field + sage: w = v.extension(N) # missing factorization, :trac:`16572` # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError - sage: w(x^3 - t) # not tested # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(x^3 - t) # not tested # needs sage.rings.function_field 1 - sage: w(x - w) # not tested # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(x - w) # not tested # needs sage.rings.function_field 1/3 There are several ways to create valuations on extensions of rational @@ -967,12 +978,12 @@ def valuation(self, prime): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x); L # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x); L # needs sage.rings.function_field Function field in y defined by y^2 - x A place that has a unique extension can just be defined downstairs:: - sage: v = L.valuation(x); v # optional - sage.rings.function_field + sage: v = L.valuation(x); v # needs sage.rings.function_field (x)-adic valuation """ @@ -986,12 +997,12 @@ def space_of_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.space_of_differentials() # optional - sage.modules + sage: K.space_of_differentials() # needs sage.modules Space of differentials of Rational function field in t over Rational Field - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_differentials() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.space_of_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field Space of differentials of Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) """ @@ -1004,7 +1015,11 @@ def space_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) +<<<<<<< HEAD sage: K.space_of_holomorphic_differentials() # optional - sage.modules +======= + sage: K.space_of_holomorphic_differentials() # needs sage.libs.pari sage.modules +>>>>>>> 0e22212ec9 (./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/function_field) (Vector space of dimension 0 over Rational Field, Linear map: From: Vector space of dimension 0 over Rational Field @@ -1013,9 +1028,9 @@ def space_of_holomorphic_differentials(self): From: Space of differentials of Rational function field in t over Rational Field To: Vector space of dimension 0 over Rational Field) - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_holomorphic_differentials() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.space_of_holomorphic_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field (Vector space of dimension 4 over Finite Field of size 5, Linear map: From: Vector space of dimension 4 over Finite Field of size 5 @@ -1037,12 +1052,16 @@ def basis_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) +<<<<<<< HEAD sage: K.basis_of_holomorphic_differentials() # optional - sage.modules +======= + sage: K.basis_of_holomorphic_differentials() # needs sage.libs.pari sage.modules +>>>>>>> 0e22212ec9 (./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/function_field) [] - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.basis_of_holomorphic_differentials() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.basis_of_holomorphic_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field [((x/(x^3 + 4))*y) d(x), ((1/(x^3 + 4))*y) d(x), ((x/(x^3 + 4))*y^2) d(x), @@ -1059,17 +1078,17 @@ def divisor_group(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.divisor_group() # optional - sage.modules + sage: K.divisor_group() # needs sage.modules Divisor group of Rational function field in t over Rational Field sage: _. = K[] - sage: L. = K.extension(Y^3 - (t^3 - 1)/(t^3 - 2)) # optional - sage.rings.function_field - sage: L.divisor_group() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(Y^3 - (t^3 - 1)/(t^3 - 2)) # needs sage.rings.function_field + sage: L.divisor_group() # needs sage.modules sage.rings.function_field Divisor group of Function field in y defined by y^3 + (-t^3 + 1)/(t^3 - 2) - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.divisor_group() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.divisor_group() # needs sage.modules sage.rings.finite_rings sage.rings.function_field Divisor group of Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) """ from .divisor import DivisorGroup @@ -1081,17 +1100,17 @@ def place_set(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.place_set() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.place_set() Set of places of Rational function field in t over Finite Field of size 7 sage: K. = FunctionField(QQ) sage: K.place_set() Set of places of Rational function field in t over Rational Field - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field Set of places of Function field in y defined by y^2 + y + (x^2 + 1)/x """ from .place import PlaceSet @@ -1115,83 +1134,87 @@ def completion(self, place, name=None, prec=None, gen_name=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p); m # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p); m # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x, 10) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(x, 10) # needs sage.rings.function_field s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + O(s^12) - sage: m(y, 10) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(y, 10) # needs sage.rings.function_field s^-1 + 1 + s^3 + s^5 + s^7 + O(s^9) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p); m # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p); m # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x, 10) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(x, 10) # needs sage.rings.function_field s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + O(s^12) - sage: m(y, 10) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(y, 10) # needs sage.rings.function_field s^-1 + 1 + s^3 + s^5 + s^7 + O(s^9) - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: p = K.places_finite()[0]; p # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: p = K.places_finite()[0]; p Place (x) - sage: m = K.completion(p); m # optional - sage.rings.finite_rings + sage: m = K.completion(p); m Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(1/(x+1)) # optional - sage.rings.finite_rings + sage: m(1/(x+1)) 1 + s + s^2 + s^3 + s^4 + s^5 + s^6 + s^7 + s^8 + s^9 + s^10 + s^11 + s^12 + s^13 + s^14 + s^15 + s^16 + s^17 + s^18 + s^19 + O(s^20) - sage: p = K.place_infinite(); p # optional - sage.rings.finite_rings + sage: p = K.place_infinite(); p # needs sage.rings.finite_rings Place (1/x) - sage: m = K.completion(p); m # optional - sage.rings.finite_rings + sage: m = K.completion(p); m # needs sage.rings.finite_rings Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x) # optional - sage.rings.finite_rings + sage: m(x) # needs sage.rings.finite_rings s^-1 + O(s^19) - sage: m = K.completion(p, prec=infinity); m # optional - sage.rings.finite_rings + sage: m = K.completion(p, prec=infinity); m # needs sage.rings.finite_rings Completion map: From: Rational function field in x over Finite Field of size 2 To: Lazy Laurent Series Ring in s over Finite Field of size 2 - sage: f = m(x); f # optional - sage.rings.finite_rings + sage: f = m(x); f # needs sage.rings.finite_rings s^-1 + ... - sage: f.coefficient(100) # optional - sage.rings.finite_rings + sage: f.coefficient(100) # needs sage.rings.finite_rings 0 sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 - x) # optional - sage.rings.function_field sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.function_field sage.rings.function_field - sage: decomp = O.decomposition(K.maximal_order().ideal(x - 1)) # optional - sage.rings.function_field sage.rings.function_field - sage: pls = (decomp[0][0].place(), decomp[1][0].place()) # optional - sage.rings.function_field sage.rings.function_field - sage: m = L.completion(pls[0]); m # optional - sage.rings.function_field sage.rings.function_field + sage: L. = K.extension(Y^2 - x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: decomp = O.decomposition(K.maximal_order().ideal(x - 1)) # needs sage.rings.function_field + sage: pls = (decomp[0][0].place(), decomp[1][0].place()) # needs sage.rings.function_field + sage: m = L.completion(pls[0]); m # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 - x To: Laurent Series Ring in s over Rational Field - sage: xe = m(x) # optional - sage.rings.function_field sage.rings.function_field - sage: ye = m(y) # optional - sage.rings.function_field sage.rings.function_field - sage: ye^2 - xe == 0 # optional - sage.rings.function_field sage.rings.function_field + sage: xe = m(x) # needs sage.rings.function_field + sage: ye = m(y) # needs sage.rings.function_field + sage: ye^2 - xe == 0 # needs sage.rings.function_field True - sage: decomp2 = O.decomposition(K.maximal_order().ideal(x^2 + 1)) # optional - sage.rings.function_field sage.rings.function_field - sage: pls2 = decomp2[0][0].place() # optional - sage.rings.function_field sage.rings.function_field - sage: m = L.completion(pls2); m # optional - sage.rings.function_field sage.rings.function_field + sage: # needs sage.rings.function_field + sage: decomp2 = O.decomposition(K.maximal_order().ideal(x^2 + 1)) + sage: pls2 = decomp2[0][0].place() + sage: m = L.completion(pls2); m Completion map: From: Function field in y defined by y^2 - x To: Laurent Series Ring in s over Number Field in a with defining polynomial x^4 + 2*x^2 + 4*x + 2 - sage: xe = m(x) # optional - sage.rings.function_field sage.rings.function_field - sage: ye = m(y) # optional - sage.rings.function_field sage.rings.function_field - sage: ye^2 - xe == 0 # optional - sage.rings.function_field sage.rings.function_field + sage: xe = m(x) + sage: ye = m(y) + sage: ye^2 - xe == 0 True """ from .maps import FunctionFieldCompletion @@ -1207,12 +1230,13 @@ def extension_constant_field(self, k): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^4)) # optional - sage.rings.finite_rings sage.rings.function_field - sage: E # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: E = F.extension_constant_field(GF(2^4)) # needs sage.rings.function_field + sage: E # needs sage.rings.function_field Function field in y defined by y^2 + y + (x^2 + 1)/x over its base - sage: E.constant_base_field() # optional - sage.rings.finite_rings sage.rings.function_field + sage: E.constant_base_field() # needs sage.rings.function_field Finite Field in z4 of size 2^4 """ from .extensions import ConstantFieldExtension diff --git a/src/sage/rings/function_field/function_field_polymod.py b/src/sage/rings/function_field/function_field_polymod.py index fa8731848ee..cf0dfc439c5 100644 --- a/src/sage/rings/function_field/function_field_polymod.py +++ b/src/sage/rings/function_field/function_field_polymod.py @@ -491,9 +491,9 @@ def constant_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^5 - x) # optional - sage.rings.finite_rings - sage: L.constant_field() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^5 - x) # needs sage.rings.finite_rings + sage: L.constant_field() # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError @@ -631,28 +631,31 @@ def is_separable(self, base=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: L.is_separable() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: L.is_separable() False - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^3 - y) # optional - sage.rings.finite_rings - sage: M.is_separable() # optional - sage.rings.finite_rings + sage: R. = L[] + sage: M. = L.extension(z^3 - y) + sage: M.is_separable() True - sage: M.is_separable(K) # optional - sage.rings.finite_rings + sage: M.is_separable(K) False - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # optional - sage.rings.finite_rings - sage: L.is_separable() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: R. = K[] + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) + sage: L.is_separable() True - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^5 - 1) # optional - sage.rings.finite_rings - sage: L.is_separable() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: R. = K[] + sage: L. = K.extension(y^5 - 1) + sage: L.is_separable() False """ @@ -719,48 +722,49 @@ def free_module(self, base=None, basis=None, map=True): We get the vector spaces, and maps back and forth:: - sage: V, from_V, to_V = L.free_module() # optional - sage.modules - sage: V # optional - sage.modules + sage: # needs sage.modules + sage: V, from_V, to_V = L.free_module() + sage: V Vector space of dimension 5 over Rational function field in x over Rational Field - sage: from_V # optional - sage.modules + sage: from_V Isomorphism: From: Vector space of dimension 5 over Rational function field in x over Rational Field To: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x - sage: to_V # optional - sage.modules + sage: to_V Isomorphism: From: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x To: Vector space of dimension 5 over Rational function field in x over Rational Field We convert an element of the vector space back to the function field:: - sage: from_V(V.1) # optional - sage.modules + sage: from_V(V.1) # needs sage.modules y We define an interesting element of the function field:: - sage: a = 1/L.0; a # optional - sage.modules + sage: a = 1/L.0; a # needs sage.modules (x/(x^4 + 1))*y^4 - 2*x^2/(x^4 + 1) We convert it to the vector space, and get a vector over the base field:: - sage: to_V(a) # optional - sage.modules + sage: to_V(a) # needs sage.modules (-2*x^2/(x^4 + 1), 0, 0, 0, x/(x^4 + 1)) We convert to and back, and get the same element:: - sage: from_V(to_V(a)) == a # optional - sage.modules + sage: from_V(to_V(a)) == a # needs sage.modules True In the other direction:: - sage: v = x*V.0 + (1/x)*V.1 # optional - sage.modules - sage: to_V(from_V(v)) == v # optional - sage.modules + sage: v = x*V.0 + (1/x)*V.1 # needs sage.modules + sage: to_V(from_V(v)) == v # needs sage.modules True And we show how it works over an extension of an extension field:: sage: R2. = L[]; M. = L.extension(z^2 - y) - sage: M.free_module() # optional - sage.modules + sage: M.free_module() # needs sage.modules (Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x, Isomorphism: From: Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x To: Function field in z defined by z^2 - y, Isomorphism: @@ -769,7 +773,7 @@ def free_module(self, base=None, basis=None, map=True): We can also get the vector space of ``M`` over ``K``:: - sage: M.free_module(K) # optional - sage.modules + sage: M.free_module(K) # needs sage.modules (Vector space of dimension 10 over Rational function field in x over Rational Field, Isomorphism: From: Vector space of dimension 10 over Rational function field in x over Rational Field To: Function field in z defined by z^2 - y, Isomorphism: @@ -815,14 +819,14 @@ def maximal_order_infinite(self): sage: L.maximal_order_infinite() Maximal infinite order of Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: F.maximal_order_infinite() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings + sage: F.maximal_order_infinite() # needs sage.rings.finite_rings Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: L.maximal_order_infinite() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings + sage: L.maximal_order_infinite() # needs sage.rings.finite_rings Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ from .order_polymod import FunctionFieldMaximalOrderInfinite_polymod @@ -834,9 +838,9 @@ def different(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: F.different() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings + sage: F.different() # needs sage.rings.finite_rings 2*Place (x, (1/(x^3 + x^2 + x))*y^2) + 2*Place (x^2 + x + 1, (1/(x^3 + x^2 + x))*y^2) """ @@ -1079,12 +1083,13 @@ def _simple_model(self, name='v'): Check that this also works for inseparable extensions:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^2 - y) # optional - sage.rings.finite_rings - sage: M._simple_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: R. = L[] + sage: M. = L.extension(z^2 - y) + sage: M._simple_model() (Function field in v defined by v^4 + x, Function Field morphism: From: Function field in v defined by v^4 + x @@ -1099,12 +1104,13 @@ def _simple_model(self, name='v'): An example where the generator of the last extension does not generate the extension of the rational function field:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^3 - 1) # optional - sage.rings.finite_rings - sage: M._simple_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: R. = L[] + sage: M. = L.extension(z^3 - 1) + sage: M._simple_model() (Function field in v defined by v^6 + x*v^4 + x^2*v^2 + x^3 + 1, Function Field morphism: From: Function field in v defined by v^6 + x*v^4 + x^2*v^2 + x^3 + 1 @@ -1239,10 +1245,11 @@ def simple_model(self, name=None): An example with higher degrees:: - sage: K. = FunctionField(GF(3)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^5 - x); R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^3 - x) # optional - sage.rings.finite_rings - sage: M.simple_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); R. = K[] + sage: L. = K.extension(y^5 - x); R. = L[] + sage: M. = L.extension(z^3 - x) + sage: M.simple_model() (Function field in z defined by z^15 + x*z^12 + x^2*z^9 + 2*x^3*z^6 + 2*x^4*z^3 + 2*x^5 + 2*x^3, Function Field morphism: From: Function field in z defined by z^15 + x*z^12 + x^2*z^9 + 2*x^3*z^6 + 2*x^4*z^3 + 2*x^5 + 2*x^3 @@ -1257,10 +1264,11 @@ def simple_model(self, name=None): This also works for inseparable extensions:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x); R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^2 - y) # optional - sage.rings.finite_rings - sage: M.simple_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x); R. = L[] + sage: M. = L.extension(z^2 - y) + sage: M.simple_model() (Function field in z defined by z^4 + x, Function Field morphism: From: Function field in z defined by z^4 + x To: Function field in z defined by z^2 + y @@ -1330,12 +1338,13 @@ def primitive_element(self): This also works for inseparable extensions:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(Z^2 - y) # optional - sage.rings.finite_rings - sage: M.primitive_element() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(Y^2 - x) + sage: R. = L[] + sage: M. = L.extension(Z^2 - y) + sage: M.primitive_element() z """ N, f, t = self.simple_model() @@ -1371,10 +1380,11 @@ def separable_model(self, names=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3) # optional - sage.rings.finite_rings - sage: L.separable_model(('t','w')) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x^3) + sage: L.separable_model(('t','w')) (Function field in t defined by t^3 + w^2, Function Field morphism: From: Function field in t defined by t^3 + w^2 @@ -1389,10 +1399,11 @@ def separable_model(self, names=None): This also works for non-integral polynomials:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2/x - x^2) # optional - sage.rings.finite_rings - sage: L.separable_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2/x - x^2) + sage: L.separable_model() (Function field in y_ defined by y_^3 + x_^2, Function Field morphism: From: Function field in y_ defined by y_^3 + x_^2 @@ -1407,13 +1418,14 @@ def separable_model(self, names=None): If the base field is not perfect this is only implemented in trivial cases:: - sage: k. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: k.is_perfect() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = FunctionField(GF(2)) + sage: k.is_perfect() False - sage: K. = FunctionField(k) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 - t) # optional - sage.rings.finite_rings - sage: L.separable_model() # optional - sage.rings.finite_rings + sage: K. = FunctionField(k) + sage: R. = K[] + sage: L. = K.extension(y^3 - t) + sage: L.separable_model() (Function field in y defined by y^3 + t, Function Field endomorphism of Function field in y defined by y^3 + t Defn: y |--> y @@ -1425,9 +1437,9 @@ def separable_model(self, names=None): Some other cases for which a separable model could be constructed are not supported yet:: - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - t) # optional - sage.rings.finite_rings - sage: L.separable_model() # optional - sage.rings.finite_rings + sage: R. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(y^2 - t) # needs sage.rings.finite_rings + sage: L.separable_model() # needs sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: constructing a separable model is only implemented for function fields over a perfect constant base field @@ -1450,12 +1462,13 @@ def separable_model(self, names=None): Check that this works for towers of inseparable extensions:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^2 - y) # optional - sage.rings.finite_rings - sage: M.separable_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: R. = L[] + sage: M. = L.extension(z^2 - y) + sage: M.separable_model() (Function field in z_ defined by z_ + x_^4, Function Field morphism: From: Function field in z_ defined by z_ + x_^4 @@ -1471,12 +1484,13 @@ def separable_model(self, names=None): Check that this also works if only the first extension is inseparable:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x) # optional - sage.rings.finite_rings - sage: R. = L[] # optional - sage.rings.finite_rings - sage: M. = L.extension(z^3 - y) # optional - sage.rings.finite_rings - sage: M.separable_model() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 - x) + sage: R. = L[] + sage: M. = L.extension(z^3 - y) + sage: M.separable_model() (Function field in z_ defined by z_ + x_^6, Function Field morphism: From: Function field in z_ defined by z_ + x_^6 To: Function field in z defined by z^3 + y @@ -1655,9 +1669,9 @@ def _inversion_isomorphism(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: F._inversion_isomorphism() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings + sage: F._inversion_isomorphism() # needs sage.rings.finite_rings (Function field in s defined by s^3 + x^16 + x^14 + x^12, Composite map: From: Function field in s defined by s^3 + x^16 + x^14 + x^12 To: Function field in y defined by y^3 + x^6 + x^4 + x^2 @@ -1712,9 +1726,9 @@ def places_above(self, p): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: all(q.place_below() == p # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings + sage: all(q.place_below() == p # needs sage.rings.finite_rings ....: for p in K.places() for q in F.places_above(p)) True @@ -1726,12 +1740,13 @@ def places_above(self, p): ....: for p in pls for q in F.places_above(p)) True - sage: K. = FunctionField(QQbar); _. = K[] # optional - sage.rings.number_field - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.number_field - sage: O = K.maximal_order() # optional - sage.rings.number_field - sage: pls = [O.ideal(x - QQbar(sqrt(c))).place() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = FunctionField(QQbar); _. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: O = K.maximal_order() + sage: pls = [O.ideal(x - QQbar(sqrt(c))).place() ....: for c in [-2, -1, 0, 1, 2]] - sage: all(q.place_below() == p # long time (4s) # optional - sage.rings.number_field + sage: all(q.place_below() == p # long time (4s) ....: for p in pls for q in F.places_above(p)) True """ @@ -1754,9 +1769,9 @@ def constant_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(3)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # optional - sage.rings.finite_rings - sage: L.constant_field() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.finite_rings + sage: L.constant_field() # needs sage.rings.finite_rings Finite Field of size 3 """ return self.exact_constant_field()[0] @@ -1771,17 +1786,18 @@ def exact_constant_field(self, name='t'): EXAMPLES:: - sage: K. = FunctionField(GF(3)); _. = K[] # optional - sage.rings.finite_rings - sage: f = Y^2 - x*Y + x^2 + 1 # irreducible but not absolutely irreducible # optional - sage.rings.finite_rings - sage: L. = K.extension(f) # optional - sage.rings.finite_rings - sage: L.genus() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); _. = K[] + sage: f = Y^2 - x*Y + x^2 + 1 # irreducible but not absolutely irreducible + sage: L. = K.extension(f) + sage: L.genus() 0 - sage: L.exact_constant_field() # optional - sage.rings.finite_rings + sage: L.exact_constant_field() (Finite Field in t of size 3^2, Ring morphism: From: Finite Field in t of size 3^2 To: Function field in y defined by y^2 + 2*x*y + x^2 + 1 Defn: t |--> y + x) - sage: (y+x).divisor() # optional - sage.rings.finite_rings + sage: (y+x).divisor() 0 """ # A basis of the full constant field is obtained from @@ -1816,12 +1832,13 @@ def genus(self): EXAMPLES:: - sage: F. = GF(16) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F); K # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(16) + sage: K. = FunctionField(F); K Rational function field in x over Finite Field in a of size 2^4 - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L.genus() # optional - sage.rings.finite_rings + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L.genus() 6 The genus is computed by the Hurwitz genus formula. @@ -1855,24 +1872,25 @@ def residue_field(self, place, name=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings - sage: R, fr_R, to_R = L.residue_field(p) # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: R, fr_R, to_R = L.residue_field(p) + sage: R Finite Field of size 2 - sage: f = 1 + y # optional - sage.rings.finite_rings - sage: f.valuation(p) # optional - sage.rings.finite_rings + sage: f = 1 + y + sage: f.valuation(p) -1 - sage: to_R(f) # optional - sage.rings.finite_rings + sage: to_R(f) Traceback (most recent call last): ... TypeError: ... - sage: (1+1/f).valuation(p) # optional - sage.rings.finite_rings + sage: (1+1/f).valuation(p) 0 - sage: to_R(1 + 1/f) # optional - sage.rings.finite_rings + sage: to_R(1 + 1/f) 1 - sage: [fr_R(e) for e in R] # optional - sage.rings.finite_rings + sage: [fr_R(e) for e in R] [0, 1] """ return place.residue_field(name=name) @@ -1905,7 +1923,7 @@ def higher_derivation(self): sage: K. = FunctionField(QQ); _. = K[] sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) - sage: L.higher_derivation() # optional - sage.modules + sage: L.higher_derivation() # needs sage.modules Higher derivation map: From: Function field in y defined by y^3 + (-x^3 + 1)/(x^3 - 2) To: Function field in y defined by y^3 + (-x^3 + 1)/(x^3 - 2) @@ -1926,23 +1944,23 @@ class FunctionField_global(FunctionField_simple): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings - sage: L # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings + sage: L # needs sage.rings.finite_rings Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) The defining equation needs not be monic:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension((1 - x)*Y^7 - x^3) # optional - sage.rings.finite_rings - sage: L.gaps() # long time (6s) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension((1 - x)*Y^7 - x^3) # needs sage.rings.finite_rings + sage: L.gaps() # long time (6s) # needs sage.rings.finite_rings [1, 2, 3] or may define a trivial extension:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y-1) # optional - sage.rings.finite_rings - sage: L.genus() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y-1) # needs sage.rings.finite_rings + sage: L.genus() # needs sage.rings.finite_rings 0 """ _differentials_space = LazyImport('sage.rings.function_field.differential', 'DifferentialsSpace_global') @@ -1953,9 +1971,9 @@ def __init__(self, polynomial, names): TESTS:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings - sage: TestSuite(L).run() # long time (7s) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings + sage: TestSuite(L).run() # long time (7s) # needs sage.rings.finite_rings """ FunctionField_polymod.__init__(self, polynomial, names) @@ -1965,11 +1983,12 @@ def maximal_order(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^4 + x^12*t^2 + x^18*t + x^21 + x^18) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: O.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = PolynomialRing(K) + sage: F. = K.extension(t^4 + x^12*t^2 + x^18*t + x^21 + x^18) + sage: O = F.maximal_order() + sage: O.basis() (1, 1/x^4*y, 1/x^11*y^2 + 1/x^2, 1/x^15*y^3 + 1/x^6*y) """ from .order_polymod import FunctionFieldMaximalOrder_global @@ -1987,9 +2006,9 @@ def higher_derivation(self): EXAMPLES:: - sage: K. = FunctionField(GF(5)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # optional - sage.rings.finite_rings - sage: L.higher_derivation() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(5)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings + sage: L.higher_derivation() # needs sage.modules sage.rings.finite_rings Higher derivation map: From: Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) To: Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) @@ -2009,25 +2028,26 @@ def get_place(self, degree): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^4 + Y - x^5) # optional - sage.rings.finite_rings - sage: L.get_place(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(Y^4 + Y - x^5) + sage: L.get_place(1) Place (x, y) - sage: L.get_place(2) # optional - sage.rings.finite_rings + sage: L.get_place(2) Place (x, y^2 + y + 1) - sage: L.get_place(3) # optional - sage.rings.finite_rings + sage: L.get_place(3) Place (x^3 + x^2 + 1, y + x^2 + x) - sage: L.get_place(4) # optional - sage.rings.finite_rings + sage: L.get_place(4) Place (x + 1, x^5 + 1) - sage: L.get_place(5) # optional - sage.rings.finite_rings + sage: L.get_place(5) Place (x^5 + x^3 + x^2 + x + 1, y + x^4 + 1) - sage: L.get_place(6) # optional - sage.rings.finite_rings + sage: L.get_place(6) Place (x^3 + x^2 + 1, y^2 + y + x^2) - sage: L.get_place(7) # optional - sage.rings.finite_rings + sage: L.get_place(7) Place (x^7 + x + 1, y + x^6 + x^5 + x^4 + x^3 + x) - sage: L.get_place(8) # optional - sage.rings.finite_rings + sage: L.get_place(8) """ for p in self._places_finite(degree): @@ -2048,11 +2068,12 @@ def places(self, degree=1): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L.places(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L.places(1) [Place (1/x, 1/x^4*y^3), Place (x, y), Place (x, y + 1)] """ return self.places_infinite(degree) + self.places_finite(degree) @@ -2067,11 +2088,12 @@ def places_finite(self, degree=1): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L.places_finite(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L.places_finite(1) [Place (x, y), Place (x, y + 1)] """ return list(self._places_finite(degree)) @@ -2086,11 +2108,12 @@ def _places_finite(self, degree): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L._places_finite(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L._places_finite(1) """ O = self.maximal_order() @@ -2115,11 +2138,12 @@ def places_infinite(self, degree=1): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L.places_infinite(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L.places_infinite(1) [Place (1/x, 1/x^4*y^3)] """ return list(self._places_infinite(degree)) @@ -2134,11 +2158,12 @@ def _places_infinite(self, degree): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: L. = K.extension(t^4 + t - x^5) # optional - sage.rings.finite_rings - sage: L._places_infinite(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: R. = PolynomialRing(K) + sage: L. = K.extension(t^4 + t - x^5) + sage: L._places_infinite(1) """ Oinf = self.maximal_order_infinite() @@ -2156,9 +2181,9 @@ def gaps(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3 * Y + x) # optional - sage.rings.finite_rings - sage: L.gaps() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3 * Y + x) # needs sage.rings.finite_rings + sage: L.gaps() # needs sage.modules sage.rings.finite_rings [1, 2, 3] """ return self._weierstrass_places()[1] @@ -2169,9 +2194,9 @@ def weierstrass_places(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3 * Y + x) # optional - sage.rings.finite_rings - sage: L.weierstrass_places() # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3 * Y + x) # needs sage.rings.finite_rings + sage: L.weierstrass_places() # needs sage.modules sage.rings.finite_rings [Place (1/x, 1/x^3*y^2 + 1/x), Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1), Place (x, y), @@ -2193,9 +2218,9 @@ def _weierstrass_places(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3 * Y + x) # optional - sage.rings.finite_rings - sage: len(L.weierstrass_places()) # indirect doctest # optional - sage.rings.finite_rings sage.modules + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3 * Y + x) # needs sage.rings.finite_rings + sage: len(L.weierstrass_places()) # indirect doctest # needs sage.modules sage.rings.finite_rings 10 This method implements Algorithm 30 in [Hes2002b]_. @@ -2241,9 +2266,9 @@ def L_polynomial(self, name='t'): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: F.L_polynomial() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: F. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings + sage: F.L_polynomial() # needs sage.rings.finite_rings 2*t^2 + t + 1 """ from sage.rings.integer_ring import ZZ @@ -2273,11 +2298,12 @@ def number_of_rational_places(self, r=1): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: F.number_of_rational_places() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(Y^2 + Y + x + 1/x) + sage: F.number_of_rational_places() 4 - sage: [F.number_of_rational_places(r) for r in [1..10]] # optional - sage.rings.finite_rings + sage: [F.number_of_rational_places(r) for r in [1..10]] [4, 8, 4, 16, 44, 56, 116, 288, 508, 968] """ from sage.rings.integer_ring import IntegerRing @@ -2368,10 +2394,11 @@ def _maximal_order_basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^4 + x^12*t^2 + x^18*t + x^21 + x^18) # optional - sage.rings.finite_rings - sage: F._maximal_order_basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = PolynomialRing(K) + sage: F. = K.extension(t^4 + x^12*t^2 + x^18*t + x^21 + x^18) + sage: F._maximal_order_basis() [1, 1/x^4*y, 1/x^11*y^2 + 1/x^2, 1/x^15*y^3 + 1/x^6*y] The basis of the maximal order *always* starts with 1. This is assumed @@ -2466,9 +2493,9 @@ def equation_order(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: F.equation_order() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # needs sage.rings.finite_rings + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.finite_rings + sage: F.equation_order() # needs sage.rings.finite_rings Order in Function field in y defined by y^3 + x^6 + x^4 + x^2 sage: K. = FunctionField(QQ); R. = PolynomialRing(K) @@ -2492,11 +2519,12 @@ def primitive_integal_element_infinite(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: b = F.primitive_integal_element_infinite(); b # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: b = F.primitive_integal_element_infinite(); b 1/x^2*y - sage: b.minimal_polynomial('t') # optional - sage.rings.finite_rings + sage: b.minimal_polynomial('t') t^3 + (x^4 + x^2 + 1)/x^4 """ f = self.polynomial() @@ -2519,9 +2547,9 @@ def equation_order_infinite(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: F.equation_order_infinite() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # needs sage.rings.finite_rings + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.finite_rings + sage: F.equation_order_infinite() # needs sage.rings.finite_rings Infinite order in Function field in y defined by y^3 + x^6 + x^4 + x^2 sage: K. = FunctionField(QQ); R. = PolynomialRing(K) diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index 5f26999ba0d..63aae7c5835 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -50,11 +50,11 @@ class RationalFunctionField(FunctionField): EXAMPLES:: - sage: K. = FunctionField(GF(3)); K # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); K Rational function field in t over Finite Field of size 3 - sage: K.gen() # optional - sage.rings.finite_rings + sage: K.gen() t - sage: 1/t + t^3 + 5 # optional - sage.rings.finite_rings + sage: 1/t + t^3 + 5 (t^4 + 2*t + 1)/t sage: K. = FunctionField(QQ); K @@ -67,14 +67,15 @@ class RationalFunctionField(FunctionField): There are various ways to get at the underlying fields and rings associated to a rational function field:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.base_field() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.base_field() Rational function field in t over Finite Field of size 7 - sage: K.field() # optional - sage.rings.finite_rings + sage: K.field() Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 - sage: K.constant_field() # optional - sage.rings.finite_rings + sage: K.constant_field() Finite Field of size 7 - sage: K.maximal_order() # optional - sage.rings.finite_rings + sage: K.maximal_order() Maximal order of Rational function field in t over Finite Field of size 7 sage: K. = FunctionField(QQ) @@ -101,25 +102,26 @@ class RationalFunctionField(FunctionField): sage: R. = FunctionField(QQ) sage: L. = R[] - sage: F. = R.extension(y^2 - (x^2+1)) # optional - sage.rings.function_field - sage: (y/x).divisor() # optional - sage.rings.function_field sage.modules + sage: F. = R.extension(y^2 - (x^2+1)) # needs sage.rings.function_field + sage: (y/x).divisor() # needs sage.modules sage.rings.function_field - Place (x, y - 1) - Place (x, y + 1) + Place (x^2 + 1, y) - sage: A. = QQ[] # optional - sage.rings.number_field - sage: NF. = NumberField(z^2 + 1) # optional - sage.rings.number_field - sage: R. = FunctionField(NF) # optional - sage.rings.number_field - sage: L. = R[] # optional - sage.rings.number_field - sage: F. = R.extension(y^2 - (x^2+1)) # optional - sage.rings.function_field sage.modules sage.rings.number_field + sage: # needs sage.rings.number_field + sage: A. = QQ[] + sage: NF. = NumberField(z^2 + 1) + sage: R. = FunctionField(NF) + sage: L. = R[] + sage: F. = R.extension(y^2 - (x^2+1)) # needs sage.modules sage.rings.function_field - sage: (x/y*x.differential()).divisor() # optional - sage.rings.function_field sage.modules sage.rings.number_field + sage: (x/y*x.differential()).divisor() # needs sage.modules sage.rings.function_field sage.rings.number_field -2*Place (1/x, 1/x*y - 1) - 2*Place (1/x, 1/x*y + 1) + Place (x, y - 1) + Place (x, y + 1) - sage: (x/y).divisor() # optional - sage.rings.function_field sage.modules sage.rings.number_field + sage: (x/y).divisor() # needs sage.modules sage.rings.function_field sage.rings.number_field - Place (x - i, y) + Place (x, y - 1) + Place (x, y + 1) @@ -134,11 +136,11 @@ def __init__(self, constant_field, names, category=None): EXAMPLES:: - sage: K. = FunctionField(CC); K # optional - sage.rings.real_mpfr + sage: K. = FunctionField(CC); K # needs sage.rings.real_mpfr Rational function field in t over Complex Field with 53 bits of precision sage: TestSuite(K).run() # long time (5s) - sage: FunctionField(QQ[I], 'alpha') # optional - sage.rings.number_field + sage: FunctionField(QQ[I], 'alpha') # needs sage.rings.number_field Rational function field in alpha over Number Field in I with defining polynomial x^2 + 1 with I = 1*I @@ -251,8 +253,8 @@ def _element_constructor_(self, x): Some indirect test of conversion:: sage: S. = K[] - sage: I = S * [x^2 - y^2, y - t] # optional - sage.rings.function_field - sage: I.groebner_basis() # optional - sage.rings.function_field + sage: I = S * [x^2 - y^2, y - t] + sage: I.groebner_basis() # needs sage.rings.function_field [x^2 - t^2, y - t] """ @@ -339,10 +341,11 @@ def _to_bivariate_polynomial(self, f): EXAMPLES:: - sage: R. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: S. = R[] # optional - sage.rings.finite_rings - sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) # optional - sage.rings.finite_rings - sage: R._to_bivariate_polynomial(f) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = FunctionField(GF(7)) + sage: S. = R[] + sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) + sage: R._to_bivariate_polynomial(f) (X^7*t^2 - X^4*t^5 - X^3 + t^3, t^3) """ v = f.list() @@ -367,41 +370,44 @@ def _factor_univariate_polynomial(self, f, proof=None): sage: R. = FunctionField(QQ) sage: S. = R[] sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) - sage: f.factor() # indirect doctest # optional - sage.libs.singular + sage: f.factor() # indirect doctest # needs sage.libs.singular (1/t) * (X - t) * (X^2 - 1/t) * (X^2 + 1/t) * (X^2 + t*X + t^2) - sage: f.factor().prod() == f # optional - sage.libs.singular + sage: f.factor().prod() == f # needs sage.libs.singular True We do a factorization over a finite prime field:: - sage: R. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: S. = R[] # optional - sage.rings.finite_rings - sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) # optional - sage.rings.finite_rings - sage: f.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: R. = FunctionField(GF(7)) + sage: S. = R[] + sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) + sage: f.factor() (1/t) * (X + 3*t) * (X + 5*t) * (X + 6*t) * (X^2 + 1/t) * (X^2 + 6/t) - sage: f.factor().prod() == f # optional - sage.rings.finite_rings + sage: f.factor().prod() == f True Factoring over a function field over a non-prime finite field:: - sage: k. = GF(9) # optional - sage.rings.finite_rings - sage: R. = FunctionField(k) # optional - sage.rings.finite_rings - sage: S. = R[] # optional - sage.rings.finite_rings - sage: f = (1/t)*(X^3 - a*t^3) # optional - sage.rings.finite_rings - sage: f.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF(9) + sage: R. = FunctionField(k) + sage: S. = R[] + sage: f = (1/t)*(X^3 - a*t^3) + sage: f.factor() (1/t) * (X + (a + 2)*t)^3 - sage: f.factor().prod() == f # optional - sage.rings.finite_rings + sage: f.factor().prod() == f True Factoring over a function field over a tower of finite fields:: - sage: k. = GF(4) # optional - sage.rings.finite_rings - sage: R. = k[] # optional - sage.rings.finite_rings - sage: l. = k.extension(b^2 + b + a) # optional - sage.rings.finite_rings - sage: K. = FunctionField(l) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: F = t*x # optional - sage.rings.finite_rings - sage: F.factor(proof=False) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF(4) + sage: R. = k[] + sage: l. = k.extension(b^2 + b + a) + sage: K. = FunctionField(l) + sage: R. = K[] + sage: F = t*x + sage: F.factor(proof=False) (x) * t """ @@ -450,18 +456,18 @@ def extension(self, f, names=None): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: K.extension(y^5 - x^3 - 3*x + x*y) # optional - sage.rings.function_field + sage: K.extension(y^5 - x^3 - 3*x + x*y) # needs sage.rings.function_field Function field in y defined by y^5 + x*y - x^3 - 3*x A nonintegral defining polynomial:: sage: K. = FunctionField(QQ); R. = K[] - sage: K.extension(y^3 + (1/t)*y + t^3/(t+1)) # optional - sage.rings.function_field + sage: K.extension(y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field Function field in y defined by y^3 + 1/t*y + t^3/(t + 1) The defining polynomial need not be monic or integral:: - sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # optional - sage.rings.function_field + sage: K.extension(t*y^3 + (1/t)*y + t^3/(t+1)) # needs sage.rings.function_field Function field in y defined by t*y^3 + 1/t*y + t^3/(t + 1) """ from . import constructor @@ -517,7 +523,7 @@ def free_module(self, base=None, basis=None, map=True): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.free_module() # optional - sage.modules + sage: K.free_module() # needs sage.modules (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: From: Vector space of dimension 1 over Rational function field in x over Rational Field To: Rational function field in x over Rational Field, Isomorphism: @@ -526,7 +532,7 @@ def free_module(self, base=None, basis=None, map=True): TESTS:: - sage: K.free_module() # optional - sage.modules + sage: K.free_module() # needs sage.modules (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: From: Vector space of dimension 1 over Rational function field in x over Rational Field To: Rational function field in x over Rational Field, Isomorphism: @@ -625,8 +631,8 @@ def base_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.base_field() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.base_field() Rational function field in t over Finite Field of size 7 """ return self @@ -652,24 +658,25 @@ def hom(self, im_gens, base_morphism=None): We make a map from a rational function field to itself:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.hom((x^4 + 2)/x) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.hom((x^4 + 2)/x) Function Field endomorphism of Rational function field in x over Finite Field of size 7 Defn: x |--> (x^4 + 2)/x We construct a map from a rational function field into a non-rational extension field:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = K.hom(y^2 + y + 2); f # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field + sage: f = K.hom(y^2 + y + 2); f # needs sage.rings.function_field Function Field morphism: From: Rational function field in x over Finite Field of size 7 To: Function field in y defined by y^3 + 6*x^3 + x Defn: x |--> y^2 + y + 2 - sage: f(x) # optional - sage.rings.finite_rings sage.rings.function_field + sage: f(x) # needs sage.rings.function_field y^2 + y + 2 - sage: f(x^2) # optional - sage.rings.finite_rings sage.rings.function_field + sage: f(x^2) # needs sage.rings.function_field 5*y^2 + (x^3 + 6*x + 4)*y + 2*x^3 + 5*x + 4 """ if isinstance(im_gens, CategoryObject): @@ -692,8 +699,8 @@ def field(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: K.field() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: K.field() Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 7 .. SEEALSO:: @@ -770,7 +777,7 @@ def different(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.different() # optional - sage.modules + sage: K.different() # needs sage.modules 0 """ return self.divisor_group().zero() @@ -845,12 +852,13 @@ def residue_field(self, place, name=None): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: p = F.places_finite(2)[0] # optional - sage.rings.finite_rings - sage: R, fr_R, to_R = F.residue_field(p) # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: p = F.places_finite(2)[0] + sage: R, fr_R, to_R = F.residue_field(p) + sage: R Finite Field in z2 of size 5^2 - sage: to_R(x) in R # optional - sage.rings.finite_rings + sage: to_R(x) in R True """ return place.residue_field(name=name) @@ -870,10 +878,10 @@ def higher_derivation(self): EXAMPLES:: sage: F. = FunctionField(QQ) - sage: d = F.higher_derivation() # optional - sage.libs.singular sage.modules - sage: [d(x^5,i) for i in range(10)] # optional - sage.libs.singular sage.modules + sage: d = F.higher_derivation() # needs sage.libs.singular sage.modules + sage: [d(x^5,i) for i in range(10)] # needs sage.libs.singular sage.modules [x^5, 5*x^4, 10*x^3, 10*x^2, 5*x, 1, 0, 0, 0, 0] - sage: [d(x^9,i) for i in range(10)] # optional - sage.libs.singular sage.modules + sage: [d(x^9,i) for i in range(10)] # needs sage.libs.singular sage.modules [x^9, 9*x^8, 36*x^7, 84*x^6, 126*x^5, 126*x^4, 84*x^3, 36*x^2, 9*x, 1] """ from .derivations_polymod import FunctionFieldHigherDerivation_char_zero @@ -896,8 +904,8 @@ def places(self, degree=1): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: F.places() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: F.places() # needs sage.rings.finite_rings [Place (1/x), Place (x), Place (x + 1), @@ -920,8 +928,8 @@ def places_finite(self, degree=1): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: F.places_finite() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: F.places_finite() # needs sage.rings.finite_rings [Place (x), Place (x + 1), Place (x + 2), Place (x + 3), Place (x + 4)] """ return list(self._places_finite(degree)) @@ -936,8 +944,8 @@ def _places_finite(self, degree=1): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: F._places_finite() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: F._places_finite() """ O = self.maximal_order() @@ -955,8 +963,8 @@ def place_infinite(self): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: F.place_infinite() # optional - sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: F.place_infinite() Place (1/x) """ return self.maximal_order_infinite().prime_ideal().place() @@ -971,17 +979,18 @@ def get_place(self, degree): EXAMPLES:: - sage: F. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(F) # optional - sage.rings.finite_rings - sage: K.get_place(1) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = GF(2) + sage: K. = FunctionField(F) + sage: K.get_place(1) Place (x) - sage: K.get_place(2) # optional - sage.rings.finite_rings + sage: K.get_place(2) Place (x^2 + x + 1) - sage: K.get_place(3) # optional - sage.rings.finite_rings + sage: K.get_place(3) Place (x^3 + x + 1) - sage: K.get_place(4) # optional - sage.rings.finite_rings + sage: K.get_place(4) Place (x^4 + x + 1) - sage: K.get_place(5) # optional - sage.rings.finite_rings + sage: K.get_place(5) Place (x^5 + x^2 + 1) """ @@ -999,11 +1008,12 @@ def higher_derivation(self): EXAMPLES:: - sage: F. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: d = F.higher_derivation() # optional - sage.rings.finite_rings - sage: [d(x^5,i) for i in range(10)] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(5)) + sage: d = F.higher_derivation() + sage: [d(x^5,i) for i in range(10)] [x^5, 0, 0, 0, 0, 1, 0, 0, 0, 0] - sage: [d(x^7,i) for i in range(10)] # optional - sage.rings.finite_rings + sage: [d(x^7,i) for i in range(10)] [x^7, 2*x^6, x^5, 0, 0, x^2, 2*x, 1, 0, 0] """ from .derivations_polymod import RationalFunctionFieldHigherDerivation_global diff --git a/src/sage/rings/function_field/ideal.py b/src/sage/rings/function_field/ideal.py index 91e9e0519aa..107b0648942 100644 --- a/src/sage/rings/function_field/ideal.py +++ b/src/sage/rings/function_field/ideal.py @@ -26,46 +26,48 @@ Ideals in the equation order of an extension of a rational function field:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y); I # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y); I # needs sage.rings.function_field Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: I^2 # optional - sage.rings.function_field + sage: I^2 # needs sage.rings.function_field Ideal (x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 Ideals in the maximal order of a global function field:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I^2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I^2 # needs sage.rings.function_field Ideal (x) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: ~I # optional - sage.rings.finite_rings sage.rings.function_field + sage: ~I # needs sage.rings.function_field Ideal (1/x*y) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: ~I * I # optional - sage.rings.finite_rings sage.rings.function_field + sage: ~I * I # needs sage.rings.function_field Ideal (1) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: J = O.ideal(x + y) * I # optional - sage.rings.finite_rings sage.rings.function_field - sage: J.factor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = O.ideal(x + y) * I # needs sage.rings.finite_rings sage.rings.function_field + sage: J.factor() # needs sage.rings.finite_rings sage.rings.function_field (Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x)^2 * (Ideal (x^3 + x + 1, y + x) of Maximal order of Function field in y defined by y^2 + x^3*y + x) Ideals in the maximal infinite order of a global function field:: - sage: K. = FunctionField(GF(3^2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I + I == I # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = K[] + sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field + sage: I = Oinf.ideal(1/y) # needs sage.rings.function_field + sage: I + I == I True - sage: I^2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: I^2 # needs sage.rings.function_field Ideal (1/x^4*y) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: ~I # optional - sage.rings.finite_rings sage.rings.function_field + sage: ~I # needs sage.rings.function_field Ideal (y) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: ~I * I # optional - sage.rings.finite_rings sage.rings.function_field + sage: ~I * I # needs sage.rings.function_field Ideal (1) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: I.factor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: I.factor() # needs sage.rings.function_field (Ideal (1/x^3*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4)^4 AUTHORS: @@ -113,9 +115,9 @@ class FunctionFieldIdeal(Element): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.equation_order() # optional - sage.rings.finite_rings - sage: O.ideal(x^3 + 1) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.equation_order() + sage: O.ideal(x^3 + 1) Ideal (x^3 + 1) of Maximal order of Rational function field in x over Finite Field of size 7 """ def __init__(self, ring): @@ -124,10 +126,11 @@ def __init__(self, ring): TESTS:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.equation_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^3 + 1) # optional - sage.rings.finite_rings - sage: TestSuite(I).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.equation_order() + sage: I = O.ideal(x^3 + 1) + sage: TestSuite(I).run() """ Element.__init__(self, ring.ideal_monoid()) self._ring = ring @@ -139,11 +142,12 @@ def _repr_short(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I._repr_short() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = K[] + sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field + sage: I = Oinf.ideal(1/y) # needs sage.rings.function_field + sage: I._repr_short() # needs sage.rings.function_field '(1/x^4*y^2)' """ if self.is_zero(): @@ -163,41 +167,45 @@ def _repr_(self): Ideal (1/(x + 1)) of Maximal order of Rational function field in x over Rational Field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.ideal(x^2 + 1) # optional - sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.finite_rings sage.rings.function_field + sage: O.ideal(x^2 + 1) # needs sage.rings.finite_rings sage.rings.function_field Ideal (x^2 + 1) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y); I # needs sage.rings.function_field Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.finite_rings sage.rings.function_field + sage: I = O.ideal(y); I # needs sage.rings.finite_rings sage.rings.function_field Ideal (y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2+1)) # optional - sage.rings.finite_rings - sage: I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2+1)) + sage: I Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf.ideal(1/y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field + sage: Oinf.ideal(1/y) # needs sage.rings.function_field Ideal (1/x^4*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf.ideal(1/y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: Oinf = L.maximal_order_infinite() # needs sage.rings.function_field + sage: Oinf.ideal(1/y) # needs sage.rings.function_field Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -212,11 +220,12 @@ def _latex_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: latex(I) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: latex(I) # needs sage.rings.function_field \left(y\right) """ return '\\left(' + ', '.join(latex(g) for g in self.gens_reduced()) + '\\right)' @@ -231,10 +240,11 @@ def _div_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.equation_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^3 + 1) # optional - sage.rings.finite_rings - sage: I / I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.equation_order() + sage: I = O.ideal(x^3 + 1) + sage: I / I Ideal (1) of Maximal order of Rational function field in x over Finite Field of size 7 """ @@ -255,10 +265,11 @@ def gens_reduced(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.equation_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, x^2, x^2 + x) # optional - sage.rings.finite_rings - sage: I.gens_reduced() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.equation_order() + sage: I = O.ideal(x, x^2, x^2 + x) + sage: I.gens_reduced() (x,) """ gens = self.gens() @@ -277,10 +288,11 @@ def ring(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.equation_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, x^2, x^2 + x) # optional - sage.rings.finite_rings - sage: I.ring() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.equation_order() + sage: I = O.ideal(x, x^2, x^2 + x) + sage: I.ring() Maximal order of Rational function field in x over Finite Field of size 7 """ return self._ring @@ -292,10 +304,10 @@ def base_ring(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # optional - sage.rings.function_field - sage: I.base_ring() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field + sage: I.base_ring() # needs sage.rings.function_field Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring() @@ -306,63 +318,69 @@ def place(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: I.place() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 + x + 1) + sage: I.place() Traceback (most recent call last): ... TypeError: not a prime ideal - sage: I = O.ideal(x^3 + x + 1) # optional - sage.rings.finite_rings - sage: I.place() # optional - sage.rings.finite_rings + sage: I = O.ideal(x^3 + x + 1) + sage: I.place() Place (x^3 + x + 1) - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # optional - sage.rings.finite_rings - sage: p = I.factor()[0][0] # optional - sage.rings.finite_rings - sage: p.place() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) + sage: p = I.factor()[0][0] + sage: p.place() Place (1/x) - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: [f.place() for f,_ in I.factor()] # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: [f.place() for f,_ in I.factor()] # needs sage.rings.function_field [Place (x, (1/(x^3 + x^2 + x))*y^2), Place (x^2 + x + 1, (1/(x^3 + x^2 + x))*y^2)] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: [f.place() for f,_ in I.factor()] # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: [f.place() for f,_ in I.factor()] # needs sage.rings.function_field [Place (x, x*y), Place (x + 1, x*y)] - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.factor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field + sage: I = Oinf.ideal(1/x) # needs sage.rings.function_field + sage: I.factor() # needs sage.rings.function_field (Ideal (1/x^3*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4)^3 - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: J.is_prime() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = I.factor()[0][0] # needs sage.rings.function_field + sage: J.is_prime() # needs sage.rings.function_field True - sage: J.place() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J.place() # needs sage.rings.function_field Place (1/x, 1/x^3*y^2) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.factor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: Oinf = L.maximal_order_infinite() # needs sage.rings.function_field + sage: I = Oinf.ideal(1/x) # needs sage.rings.function_field + sage: I.factor() # needs sage.rings.function_field (Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x)^2 - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: J.is_prime() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = I.factor()[0][0] # needs sage.rings.function_field + sage: J.is_prime() # needs sage.rings.function_field True - sage: J.place() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J.place() # needs sage.rings.function_field Place (1/x, 1/x*y) """ if not self.is_prime(): @@ -380,49 +398,52 @@ def factor(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^3*(x + 1)^2) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^3*(x + 1)^2) + sage: I.factor() (Ideal (x) of Maximal order of Rational function field in x over Finite Field in z2 of size 2^2)^3 * (Ideal (x + 1) of Maximal order of Rational function field in x over Finite Field in z2 of size 2^2)^2 - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: Oinf = K.maximal_order_infinite() # needs sage.rings.finite_rings + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # needs sage.rings.finite_rings + sage: I.factor() # needs sage.rings.finite_rings (Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field in z2 of size 2^2)^2 - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I == I.factor().prod() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I == I.factor().prod() # needs sage.rings.function_field True - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: f= 1/x # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(f) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.factor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() + sage: f= 1/x + sage: I = Oinf.ideal(f) + sage: I.factor() (Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1/x^2*y + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2) * (Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2) sage: K. = FunctionField(QQ); _. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: I == I.factor().prod() # optional - sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I == I.factor().prod() # needs sage.rings.function_field True sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: I == I.factor().prod() # optional - sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I == I.factor().prod() # needs sage.rings.function_field True """ @@ -434,42 +455,45 @@ def divisor(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) # optional - sage.rings.finite_rings - sage: I.divisor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) + sage: I.divisor() Place (x) + 2*Place (x + 1) - Place (x + z2) - Place (x + z2 + 1) - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # optional - sage.rings.finite_rings - sage: I.divisor() # optional - sage.rings.finite_rings + sage: Oinf = K.maximal_order_infinite() # needs sage.rings.finite_rings + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # needs sage.rings.finite_rings + sage: I.divisor() # needs sage.rings.finite_rings 2*Place (1/x) - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor() # needs sage.rings.function_field 2*Place (x, (1/(x^3 + x^2 + x))*y^2) + 2*Place (x^2 + x + 1, (1/(x^3 + x^2 + x))*y^2) - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() # needs sage.rings.finite_rings sage.rings.function_field + sage: I = Oinf.ideal(y) # needs sage.rings.finite_rings sage.rings.function_field + sage: I.divisor() # needs sage.rings.finite_rings sage.rings.function_field -2*Place (1/x, 1/x^4*y^2 + 1/x^2*y + 1) - 2*Place (1/x, 1/x^2*y + 1) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor() # needs sage.rings.function_field - Place (x, x*y) + 2*Place (x + 1, x*y) - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: Oinf = L.maximal_order_infinite() # needs sage.rings.finite_rings sage.rings.function_field + sage: I = Oinf.ideal(y) # needs sage.rings.finite_rings sage.rings.function_field + sage: I.divisor() # needs sage.rings.finite_rings sage.rings.function_field - Place (1/x, 1/x*y) """ from .divisor import divisor @@ -487,23 +511,26 @@ def divisor_of_zeros(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) # optional - sage.rings.finite_rings - sage: I.divisor_of_zeros() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) + sage: I.divisor_of_zeros() Place (x) + 2*Place (x + 1) - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # optional - sage.rings.finite_rings - sage: I.divisor_of_zeros() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) + sage: I.divisor_of_zeros() 2*Place (1/x) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor_of_zeros() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor_of_zeros() # needs sage.rings.function_field 2*Place (x + 1, x*y) """ from .divisor import divisor @@ -521,23 +548,26 @@ def divisor_of_poles(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) # optional - sage.rings.finite_rings - sage: I.divisor_of_poles() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) + sage: I.divisor_of_poles() Place (x + z2) + Place (x + z2 + 1) - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # optional - sage.rings.finite_rings - sage: I.divisor_of_poles() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) + sage: I.divisor_of_poles() 0 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I.divisor_of_poles() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I.divisor_of_poles() # needs sage.rings.function_field Place (x, x*y) """ from .divisor import divisor @@ -566,12 +596,12 @@ class FunctionFieldIdeal_module(FunctionFieldIdeal, Ideal_generic): An ideal in an extension of a rational function field:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: I # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: I # needs sage.rings.function_field Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: I^2 # optional - sage.rings.function_field + sage: I^2 # needs sage.rings.function_field Ideal (x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ def __init__(self, ring, module): @@ -581,10 +611,10 @@ def __init__(self, ring, module): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: TestSuite(I).run() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: TestSuite(I).run() # needs sage.rings.function_field """ FunctionFieldIdeal.__init__(self, ring) @@ -604,15 +634,15 @@ def __contains__(self, x): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y); I # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y); I # needs sage.rings.function_field Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: y in I # optional - sage.rings.function_field + sage: y in I # needs sage.rings.function_field True - sage: y/x in I # optional - sage.rings.function_field + sage: y/x in I # needs sage.rings.function_field False - sage: y^2 - 2 in I # optional - sage.rings.function_field + sage: y^2 - 2 in I # needs sage.rings.function_field False """ return self._structure[2](x) in self._module @@ -624,10 +654,10 @@ def __hash__(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: d = {I: 1} # indirect doctest # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: d = {I: 1} # indirect doctest # needs sage.rings.function_field """ return hash((self._ring,self._module)) @@ -638,18 +668,18 @@ def _richcmp_(self, other, op): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(x, y); J = O.ideal(y^2 - 2) # optional - sage.rings.function_field - sage: I + J == J + I # indirect test # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(x, y); J = O.ideal(y^2 - 2) # needs sage.rings.function_field + sage: I + J == J + I # indirect test # needs sage.rings.function_field True - sage: I + I == I # indirect doctest # optional - sage.rings.function_field + sage: I + I == I # indirect doctest # needs sage.rings.function_field True - sage: I == J # optional - sage.rings.function_field + sage: I == J # needs sage.rings.function_field False - sage: I < J # optional - sage.rings.function_field + sage: I < J # needs sage.rings.function_field True - sage: J < I # optional - sage.rings.function_field + sage: J < I # needs sage.rings.function_field False """ return richcmp(self.module().basis(), other.module().basis(), op) @@ -669,20 +699,20 @@ def module(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order(); O # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order(); O # needs sage.rings.function_field Order in Function field in y defined by y^2 - x^3 - 1 - sage: I = O.ideal(x^2 + 1) # optional - sage.rings.function_field - sage: I.gens() # optional - sage.rings.function_field + sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field + sage: I.gens() # needs sage.rings.function_field (x^2 + 1, (x^2 + 1)*y) - sage: I.module() # optional - sage.rings.function_field + sage: I.module() # needs sage.rings.function_field Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Rational Field Echelon basis matrix: [x^2 + 1 0] [ 0 x^2 + 1] - sage: V, from_V, to_V = L.vector_space(); V # optional - sage.rings.function_field + sage: V, from_V, to_V = L.vector_space(); V # needs sage.rings.function_field Vector space of dimension 2 over Rational function field in x over Rational Field - sage: I.module().is_submodule(V) # optional - sage.rings.function_field + sage: I.module().is_submodule(V) # needs sage.rings.function_field True """ return self._module @@ -694,10 +724,10 @@ def gens(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # optional - sage.rings.function_field - sage: I.gens() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field + sage: I.gens() # needs sage.rings.function_field (x^2 + 1, (x^2 + 1)*y) """ return self._gens @@ -709,10 +739,10 @@ def gen(self, i): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # optional - sage.rings.function_field - sage: I.gen(1) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field + sage: I.gen(1) # needs sage.rings.function_field (x^2 + 1)*y """ return self._gens[i] @@ -724,10 +754,10 @@ def ngens(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # optional - sage.rings.function_field - sage: I.ngens() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field + sage: I.ngens() # needs sage.rings.function_field 2 """ return len(self._gens) @@ -739,11 +769,11 @@ def _add_(self, other): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: J = O.ideal(x+y) # optional - sage.rings.function_field - sage: I + J # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: J = O.ideal(x+y) # needs sage.rings.function_field + sage: I + J # needs sage.rings.function_field Ideal ((-x^2 + x)*y + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal(self.gens() + other.gens()) @@ -755,11 +785,11 @@ def _mul_(self, other): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: J = O.ideal(x+y) # optional - sage.rings.function_field - sage: I * J # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: J = O.ideal(x+y) # needs sage.rings.function_field + sage: I * J # needs sage.rings.function_field Ideal ((-x^5 + x^4 - x^2 + x)*y + x^3 + 1, (x^3 - x^2 + 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal([x*y for x in self.gens() for y in other.gens()]) @@ -771,10 +801,10 @@ def _acted_upon_(self, other, on_left): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: x * I # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: x * I # needs sage.rings.function_field Ideal (x^4 + x, -x*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal([other * x for x in self.gens()]) @@ -786,14 +816,14 @@ def intersection(self, other): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y^3); J = O.ideal(y^2) # optional - sage.rings.function_field - sage: Z = I.intersection(J); Z # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y^3); J = O.ideal(y^2) # needs sage.rings.function_field + sage: Z = I.intersection(J); Z # needs sage.rings.function_field Ideal (x^6 + 2*x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: y^2 in Z # optional - sage.rings.function_field + sage: y^2 in Z # needs sage.rings.function_field False - sage: y^3 in Z # optional - sage.rings.function_field + sage: y^3 in Z # needs sage.rings.function_field True """ if not isinstance(other, FunctionFieldIdeal): @@ -816,14 +846,14 @@ def __invert__(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: ~I # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: ~I # needs sage.rings.function_field Ideal (-1, (1/(x^3 + 1))*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: I^-1 # optional - sage.rings.function_field + sage: I^-1 # needs sage.rings.function_field Ideal (-1, (1/(x^3 + 1))*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: ~I * I # optional - sage.rings.function_field + sage: ~I * I # needs sage.rings.function_field Ideal (1) of Order in Function field in y defined by y^2 - x^3 - 1 """ if len(self.gens()) == 0: @@ -862,9 +892,9 @@ class FunctionFieldIdealInfinite_module(FunctionFieldIdealInfinite, Ideal_generi EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: O.ideal(y) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.ideal(y) # needs sage.rings.function_field Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 """ def __init__(self, ring, module): @@ -874,10 +904,10 @@ def __init__(self, ring, module): TESTS:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: I = O.ideal(y) # optional - sage.rings.function_field - sage: TestSuite(I).run() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal(y) # needs sage.rings.function_field + sage: TestSuite(I).run() # needs sage.rings.function_field """ FunctionFieldIdealInfinite.__init__(self, ring) @@ -901,16 +931,17 @@ def __contains__(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y in I # needs sage.rings.function_field True - sage: y/x in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y/x in I # needs sage.rings.function_field False - sage: y^2 - 2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 - 2 in I # needs sage.rings.function_field True """ return self._structure[2](x) in self._module @@ -921,11 +952,12 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]) # optional - sage.rings.finite_rings sage.rings.function_field - sage: d = {I: 2} # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]) # needs sage.rings.function_field + sage: d = {I: 2} # indirect doctest # needs sage.rings.function_field """ return hash((self._ring,self._module)) @@ -939,11 +971,12 @@ def __eq__(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]) # optional - sage.rings.finite_rings sage.rings.function_field - sage: I == I + I # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]) # needs sage.rings.function_field + sage: I == I + I # indirect doctest # needs sage.rings.function_field True """ if not isinstance(other, FunctionFieldIdeal_module): @@ -967,21 +1000,22 @@ def module(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order(); O # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: O = K.maximal_order(); O Maximal order of Rational function field in x over Finite Field of size 7 - sage: K.polynomial_ring() # optional - sage.rings.finite_rings + sage: K.polynomial_ring() Univariate Polynomial Ring in x over Rational function field in x over Finite Field of size 7 - sage: I = O.ideal([x^2 + 1, x*(x^2+1)]) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: I = O.ideal([x^2 + 1, x*(x^2+1)]) + sage: I.gens() (x^2 + 1,) - sage: I.module() # optional - sage.rings.finite_rings + sage: I.module() Free module of degree 1 and rank 1 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: [x^2 + 1] - sage: V, from_V, to_V = K.vector_space(); V # optional - sage.rings.finite_rings + sage: V, from_V, to_V = K.vector_space(); V Vector space of dimension 1 over Rational function field in x over Finite Field of size 7 - sage: I.module().is_submodule(V) # optional - sage.rings.finite_rings + sage: I.module().is_submodule(V) True """ return self._module @@ -997,9 +1031,9 @@ class IdealMonoid(UniqueRepresentation, Parent): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid(); M # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid(); M Monoid of ideals of Maximal order of Rational function field in x over Finite Field of size 2 """ @@ -1009,10 +1043,11 @@ def __init__(self, R): TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid() # optional - sage.rings.finite_rings - sage: TestSuite(M).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid() + sage: TestSuite(M).run() """ self.Element = R._ideal_class Parent.__init__(self, category=Monoids()) @@ -1026,9 +1061,9 @@ def _repr_(self): TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid(); M._repr_() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid(); M._repr_() 'Monoid of ideals of Maximal order of Rational function field in x over Finite Field of size 2' """ return "Monoid of ideals of %s" % self.__R @@ -1039,9 +1074,9 @@ def ring(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid(); M.ring() is O # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid(); M.ring() is O True """ return self.__R @@ -1052,12 +1087,13 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid() # optional - sage.rings.finite_rings - sage: M(x) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid() + sage: M(x) Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2 - sage: M([x-4, 1/x]) # optional - sage.rings.finite_rings + sage: M([x-4, 1/x]) Ideal (1/x) of Maximal order of Rational function field in x over Finite Field of size 2 """ try: # x is an ideal @@ -1072,12 +1108,13 @@ def _coerce_map_from_(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid() # optional - sage.rings.finite_rings - sage: M.has_coerce_map_from(O) # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid() + sage: M.has_coerce_map_from(O) # indirect doctest True - sage: M.has_coerce_map_from(O.ideal_monoid()) # optional - sage.rings.finite_rings + sage: M.has_coerce_map_from(O.ideal_monoid()) True """ if isinstance(x, IdealMonoid): @@ -1091,10 +1128,11 @@ def _an_element_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: M = O.ideal_monoid() # optional - sage.rings.finite_rings - sage: M.an_element() # indirect doctest; random # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: O = K.maximal_order() + sage: M = O.ideal_monoid() + sage: M.an_element() # indirect doctest; random Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2 """ diff --git a/src/sage/rings/function_field/ideal_rational.py b/src/sage/rings/function_field/ideal_rational.py index 06400bf31f1..686fbf4245b 100644 --- a/src/sage/rings/function_field/ideal_rational.py +++ b/src/sage/rings/function_field/ideal_rational.py @@ -207,7 +207,7 @@ def is_prime(self): sage: K. = FunctionField(QQ) sage: O = K.maximal_order() sage: I = O.ideal(x^3 + x^2) - sage: [f.is_prime() for f,m in I.factor()] # optional - sage.rings.finite_rings + sage: [f.is_prime() for f,m in I.factor()] # needs sage.rings.finite_rings [True, True] """ return self._gen.denominator() == 1 and self._gen.numerator().is_prime() @@ -222,13 +222,13 @@ def module(self): sage: K. = FunctionField(QQ) sage: O = K.maximal_order() sage: I = O.ideal(x^3 + x^2) - sage: I.module() # optional - sage.modules + sage: I.module() # needs sage.modules Free module of degree 1 and rank 1 over Maximal order of Rational function field in x over Rational Field Echelon basis matrix: [x^3 + x^2] sage: J = 0*I - sage: J.module() # optional - sage.modules + sage: J.module() # needs sage.modules Free module of degree 1 and rank 0 over Maximal order of Rational function field in x over Rational Field Echelon basis matrix: @@ -243,10 +243,11 @@ def gen(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 + x) # optional - sage.rings.finite_rings - sage: I.gen() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 + x) + sage: I.gen() x^2 + x """ return self._gen @@ -257,10 +258,11 @@ def gens(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 + x) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 + x) + sage: I.gens() (x^2 + x,) """ return (self._gen,) @@ -272,10 +274,11 @@ def gens_over_base(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 + x) # optional - sage.rings.finite_rings - sage: I.gens_over_base() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 + x) + sage: I.gens_over_base() (x^2 + x,) """ return (self._gen,) @@ -293,7 +296,7 @@ def valuation(self, ideal): sage: F. = FunctionField(QQ) sage: O = F.maximal_order() sage: I = O.ideal(x^2*(x^2+x+1)^3) - sage: [f.valuation(I) for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: [f.valuation(I) for f,_ in I.factor()] # needs sage.rings.finite_rings [2, 3] """ if not self.is_prime(): @@ -316,13 +319,13 @@ def _valuation(self, ideal): sage: F. = FunctionField(QQ) sage: O = F.maximal_order() sage: p = O.ideal(x) - sage: p.valuation(O.ideal(x + 1)) # indirect doctest # optional - sage.rings.finite_rings + sage: p.valuation(O.ideal(x + 1)) # indirect doctest # needs sage.rings.finite_rings 0 - sage: p.valuation(O.ideal(x^2)) # indirect doctest # optional - sage.rings.finite_rings + sage: p.valuation(O.ideal(x^2)) # indirect doctest # needs sage.rings.finite_rings 2 - sage: p.valuation(O.ideal(1/x^3)) # indirect doctest # optional - sage.rings.finite_rings + sage: p.valuation(O.ideal(1/x^3)) # indirect doctest # needs sage.rings.finite_rings -3 - sage: p.valuation(O.ideal(0)) # indirect doctest # optional - sage.rings.finite_rings + sage: p.valuation(O.ideal(0)) # indirect doctest # needs sage.rings.finite_rings +Infinity """ return ideal.gen().valuation(self.gen()) @@ -334,10 +337,11 @@ def _factor(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^3*(x+1)^2) # optional - sage.rings.finite_rings - sage: I.factor() # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)) + sage: O = K.maximal_order() + sage: I = O.ideal(x^3*(x+1)^2) + sage: I.factor() # indirect doctest (Ideal (x) of Maximal order of Rational function field in x over Finite Field in z2 of size 2^2)^3 * (Ideal (x + 1) of Maximal order of Rational function field in x @@ -360,9 +364,9 @@ class FunctionFieldIdealInfinite_rational(FunctionFieldIdealInfinite): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.ideal(x) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: Oinf.ideal(x) Ideal (x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ def __init__(self, ring, gen): @@ -371,10 +375,11 @@ def __init__(self, ring, gen): TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x) # optional - sage.rings.finite_rings - sage: TestSuite(I).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x) + sage: TestSuite(I).run() """ FunctionFieldIdealInfinite.__init__(self, ring) self._gen = gen @@ -385,11 +390,12 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: d = { I: 1, J: 2 } # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x) + sage: J = Oinf.ideal(1/x) + sage: d = { I: 1, J: 2 } """ return hash( (self.ring(), self._gen) ) @@ -423,11 +429,12 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + 1) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(x^2 + x) # optional - sage.rings.finite_rings - sage: I + J == J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x + 1) + sage: J = Oinf.ideal(x^2 + x) + sage: I + J == J True """ return richcmp(self._gen, other._gen, op) @@ -442,11 +449,12 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2+1)) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/(x+1)) # optional - sage.rings.finite_rings - sage: I + J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2+1)) + sage: J = Oinf.ideal(1/(x+1)) + sage: I + J Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ @@ -462,11 +470,12 @@ def _mul_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2+1)) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/(x+1)) # optional - sage.rings.finite_rings - sage: I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2+1)) + sage: J = Oinf.ideal(1/(x+1)) + sage: I * J Ideal (1/x^2) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ @@ -482,10 +491,11 @@ def _acted_upon_(self, other, on_left): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2+1)) # optional - sage.rings.finite_rings - sage: x * I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2+1)) + sage: x * I Ideal (1) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ @@ -497,10 +507,11 @@ def __invert__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2 + 1)) # optional - sage.rings.finite_rings - sage: ~I # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2 + 1)) + sage: ~I # indirect doctest Ideal (x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ @@ -512,10 +523,11 @@ def is_prime(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x/(x^2 + 1)) # optional - sage.rings.finite_rings - sage: I.is_prime() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal(x/(x^2 + 1)) + sage: I.is_prime() True """ x = self._ring.fraction_field().gen() @@ -527,10 +539,11 @@ def gen(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) # optional - sage.rings.finite_rings - sage: I.gen() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) + sage: I.gen() 1/x^2 """ return self._gen @@ -541,10 +554,11 @@ def gens(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) + sage: I.gens() (1/x^2,) """ return (self._gen,) @@ -556,10 +570,11 @@ def gens_over_base(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) # optional - sage.rings.finite_rings - sage: I.gens_over_base() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x+1)/(x^3+x), (x^2+1)/x^4) + sage: I.gens_over_base() (1/x^2,) """ return (self._gen,) @@ -597,10 +612,11 @@ def _factor(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: Oinf = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal((x+1)/(x^3+1)) # optional - sage.rings.finite_rings - sage: I._factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x+1)/(x^3+1)) + sage: I._factor() [(Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field of size 2, 2)] """ diff --git a/src/sage/rings/function_field/maps.py b/src/sage/rings/function_field/maps.py index fc1768df310..c90a532d6c5 100644 --- a/src/sage/rings/function_field/maps.py +++ b/src/sage/rings/function_field/maps.py @@ -9,17 +9,17 @@ sage: K.hom(1/x) Function Field endomorphism of Rational function field in x over Rational Field Defn: x |--> 1/x - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: K.hom(y) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: K.hom(y) # needs sage.rings.function_field Function Field morphism: From: Rational function field in x over Rational Field To: Function field in y defined by y^2 - x Defn: x |--> y - sage: L.hom([y,x]) # optional - sage.rings.function_field + sage: L.hom([y,x]) # needs sage.rings.function_field Function Field endomorphism of Function field in y defined by y^2 - x Defn: y |--> y x |--> x - sage: L.hom([x,y]) # optional - sage.rings.function_field + sage: L.hom([x,y]) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: invalid morphism @@ -72,9 +72,9 @@ class FunctionFieldVectorSpaceIsomorphism(Morphism): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: isinstance(f, sage.rings.function_field.maps.FunctionFieldVectorSpaceIsomorphism) # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: isinstance(f, sage.rings.function_field.maps.FunctionFieldVectorSpaceIsomorphism) # needs sage.modules sage.rings.function_field True """ def _repr_(self) -> str: @@ -84,13 +84,13 @@ def _repr_(self) -> str: EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f # needs sage.modules sage.rings.function_field Isomorphism: From: Vector space of dimension 2 over Rational function field in x over Rational Field To: Function field in y defined by y^2 - x*y + 4*x^3 - sage: t # optional - sage.modules sage.rings.function_field + sage: t # needs sage.modules sage.rings.function_field Isomorphism: From: Function field in y defined by y^2 - x*y + 4*x^3 To: Vector space of dimension 2 over Rational function field in x over Rational Field @@ -107,9 +107,9 @@ def is_injective(self) -> bool: EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f.is_injective() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f.is_injective() # needs sage.modules sage.rings.function_field True """ return True @@ -121,9 +121,9 @@ def is_surjective(self) -> bool: EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f.is_surjective() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f.is_surjective() # needs sage.modules sage.rings.function_field True """ return True @@ -144,11 +144,11 @@ def _richcmp_(self, other, op): sage: L = K.function_field() sage: f = K.coerce_map_from(L) - sage: K = QQbar['x'].fraction_field() # optional - sage.rings.number_field - sage: L = K.function_field() # optional - sage.rings.number_field - sage: g = K.coerce_map_from(L) # optional - sage.rings.number_field + sage: K = QQbar['x'].fraction_field() # needs sage.rings.number_field + sage: L = K.function_field() + sage: g = K.coerce_map_from(L) - sage: f == g # optional - sage.rings.number_field + sage: f == g # needs sage.rings.number_field False sage: f == f True @@ -187,8 +187,8 @@ class MapVectorSpaceToFunctionField(FunctionFieldVectorSpaceIsomorphism): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space(); f # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space(); f # needs sage.modules sage.rings.function_field Isomorphism: From: Vector space of dimension 2 over Rational function field in x over Rational Field To: Function field in y defined by y^2 - x*y + 4*x^3 @@ -198,8 +198,8 @@ def __init__(self, V, K): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space(); type(f) # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space(); type(f) # needs sage.modules sage.rings.function_field """ self._V = V @@ -219,18 +219,18 @@ def _call_(self, v): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f(x*V.0 + (1/x^3)*V.1) # indirect doctest # needs sage.modules sage.rings.function_field 1/x^3*y + x TESTS: Test that this map is a bijection for some random inputs:: - sage: R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^3 - y - x) # optional - sage.rings.function_field - sage: for F in [K, L, M]: # optional - sage.modules sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^3 - y - x) # needs sage.rings.function_field + sage: for F in [K, L, M]: # needs sage.modules sage.rings.function_field ....: for base in F._intermediate_fields(K): ....: V, f, t = F.vector_space(base) ....: for i in range(100): @@ -262,9 +262,9 @@ def domain(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f.domain() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f.domain() # needs sage.modules sage.rings.function_field Vector space of dimension 2 over Rational function field in x over Rational Field """ return self._V @@ -276,9 +276,9 @@ def codomain(self): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: f.codomain() # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: f.codomain() # needs sage.modules sage.rings.function_field Function field in y defined by y^2 - x*y + 4*x^3 """ return self._K @@ -291,8 +291,8 @@ class MapFunctionFieldToVectorSpace(FunctionFieldVectorSpaceIsomorphism): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space(); t # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space(); t # needs sage.modules sage.rings.function_field Isomorphism: From: Function field in y defined by y^2 - x*y + 4*x^3 To: Vector space of dimension 2 over Rational function field in x over Rational Field @@ -310,9 +310,9 @@ def __init__(self, K, V): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: TestSuite(t).run(skip="_test_category") # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: TestSuite(t).run(skip="_test_category") # needs sage.modules sage.rings.function_field """ self._V = V self._K = K @@ -327,18 +327,18 @@ def _call_(self, x): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # optional - sage.rings.function_field - sage: V, f, t = L.vector_space() # optional - sage.modules sage.rings.function_field - sage: t(x + (1/x^3)*y) # indirect doctest # optional - sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field + sage: V, f, t = L.vector_space() # needs sage.modules sage.rings.function_field + sage: t(x + (1/x^3)*y) # indirect doctest # needs sage.modules sage.rings.function_field (x, 1/x^3) TESTS: Test that this map is a bijection for some random inputs:: - sage: R. = L[] # optional - sage.rings.function_field - sage: M. = L.extension(z^3 - y - x) # optional - sage.rings.function_field - sage: for F in [K, L, M]: # optional - sage.modules sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^3 - y - x) # needs sage.rings.function_field + sage: for F in [K, L, M]: # needs sage.modules sage.rings.function_field ....: for base in F._intermediate_fields(K): ....: V, f, t = F.vector_space(base) ....: for i in range(100): @@ -391,10 +391,11 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = L.hom(y*2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f._repr_type() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field + sage: f = L.hom(y*2) # needs sage.rings.function_field + sage: f._repr_type() # needs sage.rings.function_field 'Function Field' """ return "Function Field" @@ -405,10 +406,11 @@ def _repr_defn(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = L.hom(y*2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f._repr_defn() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field + sage: f = L.hom(y*2) # needs sage.rings.function_field + sage: f._repr_defn() # needs sage.rings.function_field 'y |--> 2*y' """ a = '%s |--> %s' % (self.domain().variable_name(), self._im_gen) @@ -423,14 +425,15 @@ class FunctionFieldMorphism_polymod(FunctionFieldMorphism): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = L.hom(y*2); f # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field + sage: f = L.hom(y*2); f # needs sage.rings.function_field Function Field endomorphism of Function field in y defined by y^3 + 6*x^3 + x Defn: y |--> 2*y - sage: factor(L.polynomial()) # optional - sage.rings.finite_rings sage.rings.function_field + sage: factor(L.polynomial()) # needs sage.rings.function_field y^3 + 6*x^3 + x - sage: f(y).charpoly('y') # optional - sage.rings.finite_rings sage.rings.function_field + sage: f(y).charpoly('y') # needs sage.rings.function_field y^3 + 6*x^3 + x """ def __init__(self, parent, im_gen, base_morphism): @@ -439,10 +442,11 @@ def __init__(self, parent, im_gen, base_morphism): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = L.hom(y*2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(f).run(skip="_test_category") # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field + sage: f = L.hom(y*2) # needs sage.rings.function_field + sage: TestSuite(f).run(skip="_test_category") # needs sage.rings.function_field """ FunctionFieldMorphism.__init__(self, parent, im_gen, base_morphism) # Verify that the morphism is valid: @@ -458,11 +462,12 @@ def _call_(self, x): """ EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 + 6*x^3 + x); f = L.hom(y*2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: f(y/x + x^2/(x+1)) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^3 + 6*x^3 + x); f = L.hom(y*2) # needs sage.rings.function_field + sage: f(y/x + x^2/(x+1)) # indirect doctest # needs sage.rings.function_field 2/x*y + x^2/(x + 1) - sage: f(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: f(y) # needs sage.rings.function_field 2*y """ v = x.list() @@ -482,8 +487,8 @@ def __init__(self, parent, im_gen, base_morphism): EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: f = K.hom(1/x); f # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: f = K.hom(1/x); f Function Field endomorphism of Rational function field in x over Finite Field of size 7 Defn: x |--> 1/x """ @@ -493,27 +498,29 @@ def _call_(self, x): """ EXAMPLES:: - sage: K. = FunctionField(GF(7)) # optional - sage.rings.finite_rings - sage: f = K.hom(1/x); f # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)) + sage: f = K.hom(1/x); f Function Field endomorphism of Rational function field in x over Finite Field of size 7 Defn: x |--> 1/x - sage: f(x+1) # indirect doctest # optional - sage.rings.finite_rings + sage: f(x+1) # indirect doctest (x + 1)/x - sage: 1/x + 1 # optional - sage.rings.finite_rings + sage: 1/x + 1 (x + 1)/x You can specify a morphism on the base ring:: - sage: Qi = GaussianIntegers().fraction_field() # optional - sage.rings.number_field - sage: i = Qi.gen() # optional - sage.rings.number_field - sage: K. = FunctionField(Qi) # optional - sage.rings.number_field - sage: phi1 = Qi.hom([CC.gen()]) # optional - sage.rings.number_field - sage: phi2 = Qi.hom([-CC.gen()]) # optional - sage.rings.number_field - sage: f = K.hom(CC.pi(), phi1) # optional - sage.rings.number_field - sage: f(1 + i + x) # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: Qi = GaussianIntegers().fraction_field() + sage: i = Qi.gen() + sage: K. = FunctionField(Qi) + sage: phi1 = Qi.hom([CC.gen()]) + sage: phi2 = Qi.hom([-CC.gen()]) + sage: f = K.hom(CC.pi(), phi1) + sage: f(1 + i + x) 4.14159265358979 + 1.00000000000000*I - sage: g = K.hom(CC.pi(), phi2) # optional - sage.rings.number_field - sage: g(1 + i + x) # optional - sage.rings.number_field + sage: g = K.hom(CC.pi(), phi2) + sage: g(1 + i + x) 4.14159265358979 - 1.00000000000000*I """ a = x.element() @@ -717,35 +724,37 @@ class FunctionFieldCompletion(Map): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(x) # needs sage.rings.function_field s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + s^12 + s^13 + s^15 + s^16 + s^17 + s^19 + O(s^22) - sage: m(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(y) # needs sage.rings.function_field s^-1 + 1 + s^3 + s^5 + s^7 + s^9 + s^13 + s^15 + s^17 + O(s^19) - sage: m(x*y) == m(x) * m(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(x*y) == m(x) * m(y) # needs sage.rings.function_field True - sage: m(x+y) == m(x) + m(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(x+y) == m(x) + m(y) # needs sage.rings.function_field True The variable name of the series can be supplied. If the place is not rational such that the residue field is a proper extension of the constant field, you can also specify the generator name of the extension:: - sage: p2 = L.places_finite(2)[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: p2 = L.places_finite(2)[0] + sage: p2 Place (x^2 + x + 1, x*y + 1) - sage: m2 = L.completion(p2, 't', gen_name='b') # optional - sage.rings.finite_rings sage.rings.function_field - sage: m2(x) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m2 = L.completion(p2, 't', gen_name='b') + sage: m2(x) (b + 1) + t + t^2 + t^4 + t^8 + t^16 + O(t^20) - sage: m2(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m2(y) b + b*t + b*t^3 + b*t^4 + (b + 1)*t^5 + (b + 1)*t^7 + b*t^9 + b*t^11 + b*t^12 + b*t^13 + b*t^15 + b*t^16 + (b + 1)*t^17 + (b + 1)*t^19 + O(t^20) """ @@ -755,11 +764,12 @@ def __init__(self, field, place, name=None, prec=None, gen_name=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 @@ -793,11 +803,12 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m # indirect doctest # needs sage.rings.function_field Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 @@ -810,11 +821,12 @@ def _call_(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m(y) # needs sage.rings.function_field s^-1 + 1 + s^3 + s^5 + s^7 + s^9 + s^13 + s^15 + s^17 + O(s^19) """ if self._precision == infinity: @@ -828,11 +840,12 @@ def _call_with_args(self, f, args, kwds): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m(x+y, 10) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m(x+y, 10) # indirect doctest # needs sage.rings.function_field s^-1 + 1 + s^2 + s^4 + s^8 + O(s^9) """ if self._precision == infinity: @@ -852,11 +865,12 @@ def _expand(self, f, prec=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m(x, prec=20) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m(x, prec=20) # indirect doctest # needs sage.rings.function_field s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + s^12 + s^13 + s^15 + s^16 + s^17 + s^19 + O(s^22) """ @@ -886,15 +900,16 @@ def _expand_lazy(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p, prec=infinity) # optional - sage.rings.finite_rings sage.rings.function_field - sage: e = m(x); e # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p, prec=infinity) # needs sage.rings.function_field + sage: e = m(x); e # needs sage.rings.function_field s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + ... - sage: e.coefficient(99) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: e.coefficient(99) # indirect doctest # needs sage.rings.function_field 0 - sage: e.coefficient(100) # optional - sage.rings.finite_rings sage.rings.function_field + sage: e.coefficient(100) # needs sage.rings.function_field 1 """ place = self._place @@ -918,11 +933,12 @@ def default_precision(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: m = L.completion(p) # optional - sage.rings.finite_rings sage.rings.function_field - sage: m.default_precision() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: m = L.completion(p) # needs sage.rings.function_field + sage: m.default_precision() # needs sage.rings.function_field 20 """ return self._precision @@ -938,14 +954,15 @@ def _repr_(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: R = p.valuation_ring() # optional - sage.rings.finite_rings sage.rings.function_field - sage: k, fr_k, to_k = R.residue_field() # optional - sage.rings.finite_rings sage.rings.function_field - sage: k # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: R = p.valuation_ring() # needs sage.rings.function_field + sage: k, fr_k, to_k = R.residue_field() # needs sage.rings.function_field + sage: k # needs sage.rings.function_field Finite Field of size 2 - sage: fr_k # optional - sage.rings.finite_rings sage.rings.function_field + sage: fr_k # needs sage.rings.function_field Ring morphism: From: Finite Field of size 2 To: Valuation ring at Place (x, x*y) @@ -966,13 +983,14 @@ def _repr_(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^2-x^3-1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(x - 2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: D = I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field - sage: V, from_V, to_V = D.function_space() # optional - sage.rings.finite_rings sage.rings.function_field - sage: from_V # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + sage: F. = K.extension(t^2-x^3-1) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(x - 2) # needs sage.rings.function_field + sage: D = I.divisor() # needs sage.rings.function_field + sage: V, from_V, to_V = D.function_space() # needs sage.rings.function_field + sage: from_V # needs sage.rings.function_field Linear map: From: Vector space of dimension 2 over Finite Field of size 5 To: Function field in y defined by y^2 + 4*x^3 + 4 @@ -993,13 +1011,14 @@ def _repr_(self) -> str: EXAMPLES:: - sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(x - 2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: D = I.divisor() # optional - sage.rings.finite_rings sage.rings.function_field - sage: V, from_V, to_V = D.function_space() # optional - sage.rings.finite_rings sage.rings.function_field - sage: to_V # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + sage: F. = K.extension(t^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(x - 2) # needs sage.rings.function_field + sage: D = I.divisor() # needs sage.rings.function_field + sage: V, from_V, to_V = D.function_space() # needs sage.rings.function_field + sage: to_V # needs sage.rings.function_field Section of linear map: From: Function field in y defined by y^2 + 4*x^3 + 4 To: Vector space of dimension 2 over Finite Field of size 5 diff --git a/src/sage/rings/function_field/order.py b/src/sage/rings/function_field/order.py index 47d85622146..b0858eba2ab 100644 --- a/src/sage/rings/function_field/order.py +++ b/src/sage/rings/function_field/order.py @@ -30,49 +30,53 @@ `O` and one maximal infinite order `O_\infty`. There are other non-maximal orders such as equation orders:: - sage: K. = FunctionField(GF(3)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^3 - y - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: 1/y in O # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)); R. = K[] + sage: L. = K.extension(y^3 - y - x) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: 1/y in O # needs sage.rings.function_field False - sage: x/y in O # optional - sage.rings.finite_rings sage.rings.function_field + sage: x/y in O # needs sage.rings.function_field True Sage provides an extensive functionality for computations in maximal orders of function fields. For example, you can decompose a prime ideal of a rational function field in an extension:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: o = K.maximal_order() # optional - sage.rings.finite_rings - sage: p = o.ideal(x + 1) # optional - sage.rings.finite_rings - sage: p.is_prime() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: o = K.maximal_order() + sage: p = o.ideal(x + 1) + sage: p.is_prime() True - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.decomposition(p) # optional - sage.rings.finite_rings sage.rings.function_field + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.finite_rings sage.rings.function_field + sage: O.decomposition(p) # needs sage.rings.finite_rings sage.rings.function_field [(Ideal (x + 1, y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 1, 1), (Ideal (x + 1, (1/(x^3 + x^2 + x))*y^2 + y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 2, 1)] - sage: p1, relative_degree,ramification_index = O.decomposition(p)[1] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1.parent() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: p1, relative_degree,ramification_index = O.decomposition(p)[1] + sage: p1.parent() Monoid of ideals of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2 - sage: relative_degree # optional - sage.rings.finite_rings sage.rings.function_field + sage: relative_degree 2 - sage: ramification_index # optional - sage.rings.finite_rings sage.rings.function_field + sage: ramification_index 1 When the base constant field is the algebraic field `\QQbar`, the only prime ideals of the maximal order of the rational function field are linear polynomials. :: - sage: K. = FunctionField(QQbar) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: L. = K.extension(y^2 - (x^3-x^2)) # optional - sage.rings.function_field sage.rings.number_field - sage: p = K.maximal_order().ideal(x) # optional - sage.rings.function_field sage.rings.number_field - sage: L.maximal_order().decomposition(p) # optional - sage.rings.function_field sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = FunctionField(QQbar) + sage: R. = K[] + sage: L. = K.extension(y^2 - (x^3-x^2)) # needs sage.rings.function_field + sage: p = K.maximal_order().ideal(x) + sage: L.maximal_order().decomposition(p) # needs sage.rings.function_field [(Ideal (1/x*y - I) of Maximal order of Function field in y defined by y^2 - x^3 + x^2, 1, 1), @@ -269,9 +273,9 @@ def _repr_(self): sage: FunctionField(QQ,'y').maximal_order_infinite() Maximal infinite order of Rational function field in y over Rational Field - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings sage.rings.function_field - sage: F.maximal_order_infinite() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.finite_rings sage.rings.function_field + sage: F.maximal_order_infinite() # needs sage.modules sage.rings.finite_rings sage.rings.function_field Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 """ return "Maximal infinite order of %s"%(self.function_field(),) diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index 1b0a4434d2c..98f758ea088 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -34,9 +34,9 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order(); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.equation_order(); O # needs sage.rings.finite_rings sage.rings.function_field Order in Function field in y defined by y^4 + x*y + 4*x + 1 The basis only defines an order if the module it generates is closed under @@ -44,10 +44,10 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # optional - sage.rings.function_field - sage: y.is_integral() # optional - sage.rings.function_field + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.function_field + sage: y.is_integral() # needs sage.rings.function_field False - sage: L.order(y) # optional - sage.rings.function_field + sage: L.order(y) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: the module generated by basis (1, y, y^2, y^3, y^4) must be closed under multiplication @@ -56,11 +56,11 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): degree of the function field of its elements (only checked when ``check`` is ``True``):: - sage: L.order(L(x)) # optional - sage.rings.function_field + sage: L.order(L(x)) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: basis (1, x, x^2, x^3, x^4) is not linearly independent - sage: sage.rings.function_field.order_basis.FunctionFieldOrder_basis((y,y,y^3,y^4,y^5)) # optional - sage.rings.function_field + sage: sage.rings.function_field.order_basis.FunctionFieldOrder_basis((y,y,y^3,y^4,y^5)) # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: basis (y, y, y^3, y^4, 2*x*y + (x^4 + 1)/x) is not linearly independent @@ -71,10 +71,11 @@ def __init__(self, basis, check=True): TESTS:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(O).run() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: TestSuite(O).run() # needs sage.rings.function_field """ if len(basis) == 0: raise ValueError("basis must have positive length") @@ -156,13 +157,14 @@ def ideal_with_gens_over_base(self, gens): We construct some ideals in a nontrivial function field:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order(); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order(); O # needs sage.rings.function_field Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I = O.ideal_with_gens_over_base([1, y]); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I.module() # optional - sage.rings.finite_rings sage.rings.function_field + sage: I.module() # needs sage.rings.function_field Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -171,14 +173,15 @@ def ideal_with_gens_over_base(self, gens): There is no check if the resulting object is really an ideal:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([y]); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y in I # needs sage.rings.function_field True - sage: y^2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 in I # needs sage.rings.function_field False """ F = self.function_field() @@ -211,16 +214,17 @@ def ideal(self, *gens): A fractional ideal of a nontrivial extension:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 - 4) # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: S = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: S.ideal(1/y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 - 4) + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: S = L.equation_order() # needs sage.rings.function_field + sage: S.ideal(1/y) # needs sage.rings.function_field Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 = S.ideal(x^2 - 4); I2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: I2 = S.ideal(x^2 - 4); I2 # needs sage.rings.function_field Ideal (x^2 + 3) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 == S.ideal(I) # optional - sage.rings.finite_rings sage.rings.function_field + sage: I2 == S.ideal(I) # needs sage.rings.function_field True """ if len(gens) == 1: @@ -240,10 +244,11 @@ def polynomial(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.polynomial() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.polynomial() # needs sage.rings.function_field y^4 + x*y + 4*x + 1 """ return self._field.polynomial() @@ -254,10 +259,11 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, y, y^2, y^3) """ return self._basis @@ -269,10 +275,11 @@ def free_module(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.free_module() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.free_module() # needs sage.rings.function_field Free module of degree 4 and rank 4 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -293,11 +300,12 @@ def coordinate_vector(self, e): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: f = (x + y)^3 # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.coordinate_vector(f) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: f = (x + y)^3 # needs sage.rings.function_field + sage: O.coordinate_vector(f) # needs sage.rings.function_field (x^3, 3*x^2, 3*x, 1) """ return self._module.coordinate_vector(self._to_module(e), check=False) @@ -316,16 +324,16 @@ class FunctionFieldOrderInfinite_basis(FunctionFieldOrderInfinite): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order_infinite(); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.equation_order_infinite(); O # needs sage.rings.finite_rings sage.rings.function_field Infinite order in Function field in y defined by y^4 + x*y + 4*x + 1 The basis only defines an order if the module it generates is closed under multiplication and contains the identity element (only checked when ``check`` is ``True``):: - sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, y^3]); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, y^3]); O # needs sage.rings.finite_rings sage.rings.function_field Traceback (most recent call last): ... ValueError: the module generated by basis (1, y, 1/x^2*y^2, y^3) must be closed under multiplication @@ -334,7 +342,7 @@ class FunctionFieldOrderInfinite_basis(FunctionFieldOrderInfinite): degree of the function field of its elements (only checked when ``check`` is ``True``):: - sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, 1 + y]); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, 1 + y]); O # needs sage.rings.finite_rings sage.rings.function_field Traceback (most recent call last): ... ValueError: The given basis vectors must be linearly independent. @@ -342,9 +350,9 @@ class FunctionFieldOrderInfinite_basis(FunctionFieldOrderInfinite): Note that 1 does not need to be an element of the basis, as long as it is in the module spanned by it:: - sage: O = L.order_infinite_with_basis([1 + 1/x*y, 1/x*y, 1/x^2*y^2, 1/x^3*y^3]); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: O = L.order_infinite_with_basis([1 + 1/x*y, 1/x*y, 1/x^2*y^2, 1/x^3*y^3]); O # needs sage.rings.finite_rings sage.rings.function_field Infinite order in Function field in y defined by y^4 + x*y + 4*x + 1 - sage: O.basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: O.basis() # needs sage.rings.finite_rings sage.rings.function_field (1/x*y + 1, 1/x*y, 1/x^2*y^2, 1/x^3*y^3) """ def __init__(self, basis, check=True): @@ -353,10 +361,11 @@ def __init__(self, basis, check=True): TESTS:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order_infinite() # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(O).run() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order_infinite() # needs sage.rings.function_field + sage: TestSuite(O).run() # needs sage.rings.function_field """ if len(basis) == 0: raise ValueError("basis must have positive length") @@ -446,13 +455,14 @@ def ideal_with_gens_over_base(self, gens): We construct some ideals in a nontrivial function field:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order(); O # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order(); O # needs sage.rings.function_field Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I = O.ideal_with_gens_over_base([1, y]); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I.module() # optional - sage.rings.finite_rings sage.rings.function_field + sage: I.module() # needs sage.rings.function_field Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: [1 0] @@ -460,14 +470,15 @@ def ideal_with_gens_over_base(self, gens): There is no check if the resulting object is really an ideal:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([y]); I # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y in I # needs sage.rings.function_field True - sage: y^2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 in I # needs sage.rings.function_field False """ F = self.function_field() @@ -503,8 +514,8 @@ def ideal(self, *gens): sage: K. = FunctionField(QQ); R. = K[] sage: O = K.maximal_order_infinite() sage: I = O.ideal(x^2 - 4) - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: S = L.order_infinite_with_basis([1, 1/x^2*y]) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: S = L.order_infinite_with_basis([1, 1/x^2*y]) # needs sage.rings.function_field """ if len(gens) == 1: gens = gens[0] @@ -523,10 +534,11 @@ def polynomial(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.polynomial() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.polynomial() # needs sage.rings.function_field y^4 + x*y + 4*x + 1 """ return self._field.polynomial() @@ -537,10 +549,11 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.basis() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, y, y^2, y^3) """ return self._basis @@ -552,10 +565,11 @@ def free_module(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O.free_module() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.free_module() # needs sage.rings.function_field Free module of degree 4 and rank 4 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: diff --git a/src/sage/rings/function_field/order_polymod.py b/src/sage/rings/function_field/order_polymod.py index a95c003188f..e4f7d6eece8 100644 --- a/src/sage/rings/function_field/order_polymod.py +++ b/src/sage/rings/function_field/order_polymod.py @@ -40,10 +40,11 @@ def __init__(self, field, ideal_class=FunctionFieldIdeal_polymod): TESTS:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: TestSuite(O).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: TestSuite(O).run() """ FunctionFieldMaximalOrder.__init__(self, field, ideal_class) @@ -135,26 +136,27 @@ def _element_constructor_(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x*Y + x^2 + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: y in O # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^2 - x*Y + x^2 + 1) + sage: O = L.maximal_order() + sage: y in O True - sage: 1/y in O # optional - sage.rings.finite_rings + sage: 1/y in O False - sage: x in O # optional - sage.rings.finite_rings + sage: x in O True - sage: 1/x in O # optional - sage.rings.finite_rings + sage: 1/x in O False - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: 1 in O # optional - sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: 1 in O True - sage: y in O # optional - sage.rings.finite_rings + sage: y in O False - sage: x*y in O # optional - sage.rings.finite_rings + sage: x*y in O True - sage: x^2*y in O # optional - sage.rings.finite_rings + sage: x^2*y in O True """ F = self.function_field() @@ -177,13 +179,14 @@ def ideal_with_gens_over_base(self, gens): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order(); O # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.maximal_order(); O Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: I = O.ideal_with_gens_over_base([1, y]); I # optional - sage.rings.finite_rings + sage: I = O.ideal_with_gens_over_base([1, y]); I Ideal (1) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: I.module() # optional - sage.rings.finite_rings + sage: I.module() Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -192,14 +195,15 @@ def ideal_with_gens_over_base(self, gens): There is no check if the resulting object is really an ideal:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.equation_order() # optional - sage.rings.finite_rings - sage: I = O.ideal_with_gens_over_base([y]); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([y]); I Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # optional - sage.rings.finite_rings + sage: y in I True - sage: y^2 in I # optional - sage.rings.finite_rings + sage: y^2 in I False """ return self._ideal_from_vectors([self.coordinate_vector(g) for g in gens]) @@ -215,16 +219,17 @@ def _ideal_from_vectors(self, vecs): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: v1 = O.coordinate_vector(x^3 + 1) # optional - sage.rings.finite_rings - sage: v2 = O.coordinate_vector(y) # optional - sage.rings.finite_rings - sage: v1 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: v1 = O.coordinate_vector(x^3 + 1) + sage: v2 = O.coordinate_vector(y) + sage: v1 (x^3 + 1, 0) - sage: v2 # optional - sage.rings.finite_rings + sage: v2 (0, 1) - sage: O._ideal_from_vectors([v1, v2]) # optional - sage.rings.finite_rings + sage: O._ideal_from_vectors([v1, v2]) Ideal (y) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 """ @@ -248,18 +253,19 @@ def _ideal_from_vectors_and_denominator(self, vecs, d=1, check=True): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y^2) # optional - sage.rings.finite_rings - sage: m = I.basis_matrix() # optional - sage.rings.finite_rings - sage: v1 = m[0] # optional - sage.rings.finite_rings - sage: v2 = m[1] # optional - sage.rings.finite_rings - sage: v1 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal(y^2) + sage: m = I.basis_matrix() + sage: v1 = m[0] + sage: v2 = m[1] + sage: v1 (x^3 + 1, 0) - sage: v2 # optional - sage.rings.finite_rings + sage: v2 (0, x^3 + 1) - sage: O._ideal_from_vectors([v1, v2]) # indirect doctest # optional - sage.rings.finite_rings + sage: O._ideal_from_vectors([v1, v2]) # indirect doctest Ideal (x^3 + 1) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 """ @@ -312,17 +318,18 @@ def ideal(self, *gens, **kwargs): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 - 4) # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: S = L.maximal_order() # optional - sage.rings.finite_rings - sage: S.ideal(1/y) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 - 4) + sage: L. = K.extension(y^2 - x^3 - 1) + sage: S = L.maximal_order() + sage: S.ideal(1/y) Ideal ((1/(x^3 + 1))*y) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 = S.ideal(x^2 - 4); I2 # optional - sage.rings.finite_rings + sage: I2 = S.ideal(x^2 - 4); I2 Ideal (x^2 + 3) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 == S.ideal(I) # optional - sage.rings.finite_rings + sage: I2 == S.ideal(I) True sage: K. = FunctionField(QQ); R. = K[] @@ -355,10 +362,11 @@ def polynomial(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.equation_order() # optional - sage.rings.finite_rings - sage: O.polynomial() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: O.polynomial() y^4 + x*y + 4*x + 1 sage: K. = FunctionField(QQ); R. = K[] @@ -376,10 +384,11 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.equation_order() # optional - sage.rings.finite_rings - sage: O.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: O.basis() (1, y, y^2, y^3) sage: K. = FunctionField(QQ) @@ -399,16 +408,17 @@ def gen(self, n=0): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.gen() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: O = L.maximal_order() + sage: O.gen() 1 - sage: O.gen(1) # optional - sage.rings.finite_rings + sage: O.gen(1) y - sage: O.gen(2) # optional - sage.rings.finite_rings + sage: O.gen(2) (1/(x^3 + x^2 + x))*y^2 - sage: O.gen(3) # optional - sage.rings.finite_rings + sage: O.gen(3) Traceback (most recent call last): ... IndexError: there are only 3 generators @@ -424,10 +434,11 @@ def ngens(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order() # optional - sage.rings.finite_rings - sage: Oinf.ngens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = L.maximal_order() + sage: Oinf.ngens() 3 """ return len(self._basis) @@ -438,10 +449,11 @@ def free_module(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.free_module() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: O.free_module() Free module of degree 4 and rank 4 over Maximal order of Rational function field in x over Finite Field of size 7 User basis matrix: @@ -458,12 +470,13 @@ def coordinate_vector(self, e): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.coordinate_vector(y) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: O.coordinate_vector(y) (0, 1, 0, 0) - sage: O.coordinate_vector(x*y) # optional - sage.rings.finite_rings + sage: O.coordinate_vector(x*y) (0, x, 0, 0) sage: K. = FunctionField(QQ); R. = K[] @@ -506,10 +519,11 @@ def different(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.different() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: O.different() Ideal (y^3 + 2*x) of Maximal order of Function field in y defined by y^4 + x*y + 4*x + 1 """ @@ -522,10 +536,11 @@ def codifferent(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.codifferent() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: O.codifferent() Ideal (1, (1/(x^4 + 4*x^3 + 3*x^2 + 6*x + 4))*y^3 + ((5*x^3 + 6*x^2 + x + 6)/(x^4 + 4*x^3 + 3*x^2 + 6*x + 4))*y^2 + ((x^3 + 2*x^2 + 2*x + 2)/(x^4 + 4*x^3 + 3*x^2 + 6*x + 4))*y @@ -542,10 +557,11 @@ def _codifferent_matrix(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O._codifferent_matrix() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: O._codifferent_matrix() [ 4 0 0 4*x] [ 0 0 4*x 5*x + 3] [ 0 4*x 5*x + 3 0] @@ -573,12 +589,13 @@ def decomposition(self, ideal): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: o = K.maximal_order() # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: p = o.ideal(x + 1) # optional - sage.rings.finite_rings - sage: O.decomposition(p) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: o = K.maximal_order() + sage: O = F.maximal_order() + sage: p = o.ideal(x + 1) + sage: O.decomposition(p) [(Ideal (x + 1, y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 1, 1), (Ideal (x + 1, (1/(x^3 + x^2 + x))*y^2 + y + 1) of Maximal order @@ -701,14 +718,14 @@ class FunctionFieldMaximalOrderInfinite_polymod(FunctionFieldMaximalOrderInfinit EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: F.maximal_order_infinite() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # needs sage.rings.finite_rings + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.finite_rings + sage: F.maximal_order_infinite() # needs sage.rings.finite_rings Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: L.maximal_order_infinite() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings + sage: L.maximal_order_infinite() # needs sage.rings.finite_rings Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ def __init__(self, field, category=None): @@ -717,10 +734,11 @@ def __init__(self, field, category=None): TESTS:: - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: TestSuite(O).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order_infinite() + sage: TestSuite(O).run() """ FunctionFieldMaximalOrderInfinite.__init__(self, field, ideal_class=FunctionFieldIdealInfinite_polymod) @@ -741,18 +759,19 @@ def _element_constructor_(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.basis() (1, 1/x*y) - sage: 1 in Oinf # optional - sage.rings.finite_rings + sage: 1 in Oinf True - sage: 1/x*y in Oinf # optional - sage.rings.finite_rings + sage: 1/x*y in Oinf True - sage: x*y in Oinf # optional - sage.rings.finite_rings + sage: x*y in Oinf False - sage: 1/x in Oinf # optional - sage.rings.finite_rings + sage: 1/x in Oinf True """ F = self.function_field() @@ -776,18 +795,20 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.basis() (1, 1/x^2*y, (1/(x^4 + x^3 + x^2))*y^2) :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.basis() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.basis() (1, 1/x*y) """ return self._basis @@ -800,16 +821,17 @@ def gen(self, n=0): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.gen() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.gen() 1 - sage: Oinf.gen(1) # optional - sage.rings.finite_rings + sage: Oinf.gen(1) 1/x^2*y - sage: Oinf.gen(2) # optional - sage.rings.finite_rings + sage: Oinf.gen(2) (1/(x^4 + x^3 + x^2))*y^2 - sage: Oinf.gen(3) # optional - sage.rings.finite_rings + sage: Oinf.gen(3) Traceback (most recent call last): ... IndexError: there are only 3 generators @@ -825,10 +847,11 @@ def ngens(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.ngens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.ngens() 3 """ return len(self._basis) @@ -843,19 +866,21 @@ def ideal(self, *gens): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x, y); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(x, y); I Ideal (y) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x, y); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(x, y); I Ideal (x) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -944,11 +969,12 @@ def _to_iF(self, I): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(y) # optional - sage.rings.finite_rings - sage: Oinf._to_iF(I) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(y) + sage: Oinf._to_iF(I) Ideal (1, 1/x*s) of Maximal order of Function field in s defined by s^2 + x*s + x^3 + x """ @@ -965,10 +991,11 @@ def decomposition(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.decomposition() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: Oinf = F.maximal_order_infinite() + sage: Oinf.decomposition() [(Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 1, 1), (Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1/x^2*y + 1) of Maximal infinite order @@ -976,10 +1003,11 @@ def decomposition(self): :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.decomposition() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.decomposition() [(Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x, 1, 2)] @@ -1023,10 +1051,11 @@ def different(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.different() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.different() Ideal (1/x) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -1044,10 +1073,11 @@ def _codifferent_matrix(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf._codifferent_matrix() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf._codifferent_matrix() [ 0 1/x] [ 1/x 1/x^2] """ @@ -1075,13 +1105,14 @@ def coordinate_vector(self, e): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: f = 1/y^2 # optional - sage.rings.finite_rings - sage: f in Oinf # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: f = 1/y^2 + sage: f in Oinf True - sage: Oinf.coordinate_vector(f) # optional - sage.rings.finite_rings + sage: Oinf.coordinate_vector(f) ((x^3 + x^2 + x)/(x^4 + 1), x^3/(x^4 + 1)) """ return self._module.coordinate_vector(self._to_module(e)) @@ -1097,9 +1128,9 @@ class FunctionFieldMaximalOrder_global(FunctionFieldMaximalOrder_polymod): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: L.maximal_order() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.finite_rings + sage: L.maximal_order() # needs sage.rings.finite_rings Maximal order of Function field in y defined by y^4 + x*y + 4*x + 1 """ @@ -1109,10 +1140,11 @@ def __init__(self, field): TESTS:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: TestSuite(O).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.maximal_order() + sage: TestSuite(O).run() """ FunctionFieldMaximalOrder_polymod.__init__(self, field, ideal_class=FunctionFieldIdeal_global) @@ -1130,12 +1162,13 @@ def p_radical(self, prime): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2 * (x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: o = K.maximal_order() # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: p = o.ideal(x + 1) # optional - sage.rings.finite_rings - sage: O.p_radical(p) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2 * (x^2 + x + 1)^2) + sage: o = K.maximal_order() + sage: O = F.maximal_order() + sage: p = o.ideal(x + 1) + sage: O.p_radical(p) Ideal (x + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2 """ @@ -1192,12 +1225,13 @@ def decomposition(self, ideal): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: o = K.maximal_order() # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: p = o.ideal(x + 1) # optional - sage.rings.finite_rings - sage: O.decomposition(p) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: o = K.maximal_order() + sage: O = F.maximal_order() + sage: p = o.ideal(x + 1) + sage: O.decomposition(p) [(Ideal (x + 1, y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 1, 1), (Ideal (x + 1, (1/(x^3 + x^2 + x))*y^2 + y + 1) of Maximal order diff --git a/src/sage/rings/function_field/order_rational.py b/src/sage/rings/function_field/order_rational.py index 6bb49b6eaa4..ff701315f0f 100644 --- a/src/sage/rings/function_field/order_rational.py +++ b/src/sage/rings/function_field/order_rational.py @@ -38,9 +38,9 @@ class FunctionFieldMaximalOrder_rational(FunctionFieldMaximalOrder): EXAMPLES:: - sage: K. = FunctionField(GF(19)); K # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)); K Rational function field in t over Finite Field of size 19 - sage: R = K.maximal_order(); R # optional - sage.rings.finite_rings + sage: R = K.maximal_order(); R Maximal order of Rational function field in t over Finite Field of size 19 """ def __init__(self, field): @@ -99,9 +99,9 @@ def ideal_with_gens_over_base(self, gens): EXAMPLES:: sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.function_field - sage: O = L.equation_order() # optional - sage.rings.function_field - sage: O.ideal_with_gens_over_base([x^3 + 1, -y]) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.ideal_with_gens_over_base([x^3 + 1, -y]) # needs sage.rings.function_field Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ideal(gens) @@ -129,60 +129,62 @@ def _residue_field(self, ideal, name=None): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: R, fr_R, to_R = O._residue_field(I) # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: O = F.maximal_order() + sage: I = O.ideal(x^2 + x + 1) + sage: R, fr_R, to_R = O._residue_field(I) + sage: R Finite Field in z2 of size 2^2 - sage: [to_R(fr_R(e)) == e for e in R] # optional - sage.rings.finite_rings + sage: [to_R(fr_R(e)) == e for e in R] [True, True, True, True] - sage: [to_R(fr_R(e)).parent() is R for e in R] # optional - sage.rings.finite_rings + sage: [to_R(fr_R(e)).parent() is R for e in R] [True, True, True, True] - sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) # optional - sage.rings.finite_rings - sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) # optional - sage.rings.finite_rings + sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) + sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) True - sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) # optional - sage.rings.finite_rings + sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) True - sage: to_R(e1).parent() is R # optional - sage.rings.finite_rings + sage: to_R(e1).parent() is R True - sage: to_R(e2).parent() is R # optional - sage.rings.finite_rings + sage: to_R(e2).parent() is R True - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + 1) # optional - sage.rings.finite_rings - sage: R, fr_R, to_R = O._residue_field(I) # optional - sage.rings.finite_rings - sage: R # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: O = F.maximal_order() + sage: I = O.ideal(x + 1) + sage: R, fr_R, to_R = O._residue_field(I) + sage: R Finite Field of size 2 - sage: [to_R(fr_R(e)) == e for e in R] # optional - sage.rings.finite_rings + sage: [to_R(fr_R(e)) == e for e in R] [True, True] - sage: [to_R(fr_R(e)).parent() is R for e in R] # optional - sage.rings.finite_rings + sage: [to_R(fr_R(e)).parent() is R for e in R] [True, True] - sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) # optional - sage.rings.finite_rings - sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) # optional - sage.rings.finite_rings + sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) + sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) True - sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) # optional - sage.rings.finite_rings + sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) True - sage: to_R(e1).parent() is R # optional - sage.rings.finite_rings + sage: to_R(e1).parent() is R True - sage: to_R(e2).parent() is R # optional - sage.rings.finite_rings + sage: to_R(e2).parent() is R True sage: F. = FunctionField(QQ) sage: O = F.maximal_order() sage: I = O.ideal(x^2 + x + 1) - sage: R, fr_R, to_R = O._residue_field(I) # optional - sage.rings.number_field - sage: R # optional - sage.rings.number_field + sage: R, fr_R, to_R = O._residue_field(I) # needs sage.rings.number_field + sage: R # needs sage.rings.number_field Number Field in a with defining polynomial x^2 + x + 1 - sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) # optional - sage.rings.number_field - sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) # optional - sage.rings.number_field + sage: e1, e2 = fr_R(R.random_element()), fr_R(R.random_element()) # needs sage.rings.number_field + sage: to_R(e1 * e2) == to_R(e1) * to_R(e2) # needs sage.rings.number_field True - sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) # optional - sage.rings.number_field + sage: to_R(e1 + e2) == to_R(e1) + to_R(e2) # needs sage.rings.number_field True - sage: to_R(e1).parent() is R # optional - sage.rings.number_field + sage: to_R(e1).parent() is R # needs sage.rings.number_field True - sage: to_R(e2).parent() is R # optional - sage.rings.number_field + sage: to_R(e2).parent() is R # needs sage.rings.number_field True sage: F. = FunctionField(QQ) @@ -255,32 +257,34 @@ def _residue_field_global(self, q, name=None): EXAMPLES:: - sage: k. = GF(4) # optional - sage.rings.finite_rings - sage: F. = FunctionField(k) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: O._ring # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: k. = GF(4) + sage: F. = FunctionField(k) + sage: O = F.maximal_order() + sage: O._ring Univariate Polynomial Ring in x over Finite Field in a of size 2^2 - sage: f = x^3 + x + 1 # optional - sage.rings.finite_rings - sage: _f = f.numerator() # optional - sage.rings.finite_rings - sage: _f.is_irreducible() # optional - sage.rings.finite_rings + sage: f = x^3 + x + 1 + sage: _f = f.numerator() + sage: _f.is_irreducible() True - sage: K, fr_K, to_K = O._residue_field_global(_f) # optional - sage.rings.finite_rings sage.modules - sage: K # optional - sage.rings.finite_rings sage.modules + sage: K, fr_K, to_K = O._residue_field_global(_f) # needs sage.modules + sage: K # needs sage.modules Finite Field in z6 of size 2^6 - sage: all(to_K(fr_K(e)) == e for e in K) # optional - sage.rings.finite_rings sage.modules + sage: all(to_K(fr_K(e)) == e for e in K) # needs sage.modules True - sage: k. = GF(2) # optional - sage.rings.finite_rings - sage: F. = FunctionField(k) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: O._ring # optional - sage.rings.finite_rings sage.libs.ntl + sage: # needs sage.rings.finite_rings + sage: k. = GF(2) + sage: F. = FunctionField(k) + sage: O = F.maximal_order() + sage: O._ring # needs sage.libs.ntl Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X) - sage: f = x^3 + x + 1 # optional - sage.rings.finite_rings - sage: _f = f.numerator() # optional - sage.rings.finite_rings - sage: _f.is_irreducible() # optional - sage.rings.finite_rings + sage: f = x^3 + x + 1 + sage: _f = f.numerator() + sage: _f.is_irreducible() True - sage: K, fr_K, to_K = O._residue_field_global(_f) # optional - sage.rings.finite_rings sage.modules - sage: all(to_K(fr_K(e)) == e for e in K) # optional - sage.rings.finite_rings sage.modules + sage: K, fr_K, to_K = O._residue_field_global(_f) # needs sage.modules + sage: all(to_K(fr_K(e)) == e for e in K) # needs sage.modules True """ @@ -341,9 +345,9 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(19)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: O.basis() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)) + sage: O = K.maximal_order() + sage: O.basis() (1,) """ return self._basis @@ -429,9 +433,9 @@ class FunctionFieldMaximalOrderInfinite_rational(FunctionFieldMaximalOrderInfini EXAMPLES:: - sage: K. = FunctionField(GF(19)); K # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)); K Rational function field in t over Finite Field of size 19 - sage: R = K.maximal_order_infinite(); R # optional - sage.rings.finite_rings + sage: R = K.maximal_order_infinite(); R Maximal infinite order of Rational function field in t over Finite Field of size 19 """ def __init__(self, field, category=None): @@ -440,9 +444,9 @@ def __init__(self, field, category=None): TESTS:: - sage: K. = FunctionField(GF(19)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: TestSuite(O).run(skip='_test_gcd_vs_xgcd') # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)) + sage: O = K.maximal_order_infinite() + sage: TestSuite(O).run(skip='_test_gcd_vs_xgcd') """ FunctionFieldMaximalOrderInfinite.__init__(self, field, ideal_class=FunctionFieldIdealInfinite_rational, category=PrincipalIdealDomains().or_subcategory(category)) @@ -480,9 +484,9 @@ def basis(self): EXAMPLES:: - sage: K. = FunctionField(GF(19)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order() # optional - sage.rings.finite_rings - sage: O.basis() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)) + sage: O = K.maximal_order() + sage: O.basis() (1,) """ return 1/self.function_field().gen() @@ -522,9 +526,9 @@ def prime_ideal(self): EXAMPLES:: - sage: K. = FunctionField(GF(19)) # optional - sage.rings.finite_rings - sage: O = K.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: O.prime_ideal() # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(19)) + sage: O = K.maximal_order_infinite() + sage: O.prime_ideal() Ideal (1/t) of Maximal infinite order of Rational function field in t over Finite Field of size 19 """ diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index a1f5f101475..f79d0c08d56 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -11,9 +11,9 @@ All rational places of a function field can be computed:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.places() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.places() # needs sage.rings.finite_rings sage.rings.function_field [Place (1/x, 1/x^3*y^2 + 1/x), Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1), Place (x, y)] @@ -21,20 +21,21 @@ The residue field associated with a place is given as an extension of the constant field:: - sage: F. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: p = O.ideal(x^2 + x + 1).place() # optional - sage.rings.finite_rings - sage: k, fr_k, to_k = p.residue_field() # optional - sage.rings.finite_rings - sage: k # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: O = F.maximal_order() + sage: p = O.ideal(x^2 + x + 1).place() + sage: k, fr_k, to_k = p.residue_field() + sage: k Finite Field in z2 of size 2^2 The homomorphisms are between the valuation ring and the residue field:: - sage: fr_k # optional - sage.rings.finite_rings + sage: fr_k # needs sage.rings.finite_rings Ring morphism: From: Finite Field in z2 of size 2^2 To: Valuation ring at Place (x^2 + x + 1) - sage: to_k # optional - sage.rings.finite_rings + sage: to_k # needs sage.rings.finite_rings Ring morphism: From: Valuation ring at Place (x^2 + x + 1) To: Finite Field in z2 of size 2^2 @@ -77,9 +78,9 @@ class FunctionFieldPlace(Element): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.places_finite()[0] # needs sage.rings.finite_rings sage.rings.function_field Place (x, y) """ def __init__(self, parent, prime): @@ -88,10 +89,11 @@ def __init__(self, parent, prime): TESTS:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(p).run() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: TestSuite(p).run() # needs sage.rings.function_field """ Element.__init__(self, parent) @@ -103,10 +105,11 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: {p: 1} # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: {p: 1} # needs sage.rings.function_field {Place (x, y): 1} """ return hash((self.function_field(), self._prime)) @@ -117,10 +120,11 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: p # needs sage.rings.function_field Place (x, y) """ try: @@ -136,10 +140,11 @@ def _latex_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: latex(p) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: p = L.places_finite()[0] # needs sage.rings.function_field + sage: latex(p) # needs sage.rings.function_field \left(y\right) """ return self._prime._latex_() @@ -150,14 +155,15 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x + x^3*Y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1 < p2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field + sage: p1 < p2 # needs sage.rings.function_field True - sage: p2 < p1 # optional - sage.rings.finite_rings sage.rings.function_field + sage: p2 < p1 # needs sage.rings.function_field False - sage: p1 == p3 # optional - sage.rings.finite_rings sage.rings.function_field + sage: p1 == p3 # needs sage.rings.function_field False """ from sage.rings.function_field.order import FunctionFieldOrderInfinite @@ -176,12 +182,13 @@ def _acted_upon_(self, other, self_on_left): EXAMPLES:: - sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(x + 1, y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: P = I.place() # optional - sage.rings.finite_rings sage.rings.function_field - sage: -3*P + 5*P # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + sage: F. = K.extension(Y^2 - x^3 - 1) + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(x + 1, y) # needs sage.rings.function_field + sage: P = I.place() # needs sage.rings.function_field + sage: -3*P + 5*P # needs sage.rings.function_field 2*Place (x + 1, y) """ if self_on_left: @@ -194,10 +201,11 @@ def _neg_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # optional - sage.rings.finite_rings sage.rings.function_field - sage: -p1 + p2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field + sage: -p1 + p2 # needs sage.rings.function_field - Place (1/x, 1/x^3*y^2 + 1/x) + Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) """ @@ -210,10 +218,11 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1 + p2 + p3 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field + sage: p1 + p2 + p3 # needs sage.rings.function_field Place (1/x, 1/x^3*y^2 + 1/x) + Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) + Place (x, y) @@ -227,10 +236,11 @@ def _sub_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1, p2 = L.places()[:2] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p1 - p2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p1, p2 = L.places()[:2] # needs sage.rings.function_field + sage: p1 - p2 # needs sage.rings.function_field Place (1/x, 1/x^3*y^2 + 1/x) - Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) """ @@ -246,14 +256,14 @@ def __radd__(self, other): EXAMPLES:: - sage: k. = GF(2) # optional - sage.rings.finite_rings - sage: K. = FunctionField(k) # optional - sage.rings.finite_rings - sage: sum(K.places_finite()) # optional - sage.rings.finite_rings + sage: k. = GF(2) + sage: K. = FunctionField(k) + sage: sum(K.places_finite()) # needs sage.rings.finite_rings Place (x) + Place (x + 1) Note that this does not work, as wanted:: - sage: 0 + K.place_infinite() # optional - sage.rings.finite_rings + sage: 0 + K.place_infinite() Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for +: ... @@ -272,10 +282,11 @@ def function_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p.function_field() == L # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p = L.places()[0] # needs sage.rings.function_field + sage: p.function_field() == L # needs sage.rings.function_field True """ return self.parent()._field @@ -286,10 +297,11 @@ def prime_ideal(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: p = L.places()[0] # optional - sage.rings.finite_rings sage.rings.function_field - sage: p.prime_ideal() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: p = L.places()[0] # needs sage.rings.function_field + sage: p.prime_ideal() # needs sage.rings.function_field Ideal (1/x^3*y^2 + 1/x) of Maximal infinite order of Function field in y defined by y^3 + x^3*y + x """ @@ -301,12 +313,13 @@ def divisor(self, multiplicity=1): EXAMPLES:: - sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^2 - x^3 - 1) # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(x + 1, y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: P = I.place() # optional - sage.rings.finite_rings sage.rings.function_field - sage: P.divisor() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + sage: F. = K.extension(Y^2 - x^3 - 1) # needs sage.rings.function_field + sage: O = F.maximal_order() # needs sage.rings.function_field + sage: I = O.ideal(x + 1, y) # needs sage.rings.function_field + sage: P = I.place() # needs sage.rings.function_field + sage: P.divisor() # needs sage.rings.function_field Place (x + 1, y) """ from .divisor import prime_divisor @@ -323,9 +336,9 @@ class PlaceSet(UniqueRepresentation, Parent): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field Set of places of Function field in y defined by y^3 + x^3*y + x """ Element = FunctionFieldPlace @@ -336,10 +349,11 @@ def __init__(self, field): TESTS:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: places = L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field - sage: TestSuite(places).run() # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: places = L.place_set() # needs sage.rings.function_field + sage: TestSuite(places).run() # needs sage.rings.function_field """ self.Element = field._place_class Parent.__init__(self, category=Sets().Infinite()) @@ -352,9 +366,9 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field + sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field Set of places of Function field in y defined by y^3 + x^3*y + x """ return "Set of places of {}".format(self._field) @@ -365,11 +379,12 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: places = L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # optional - sage.rings.finite_rings sage.rings.function_field - sage: places(O.ideal(x, y)) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: places = L.place_set() # needs sage.rings.function_field + sage: O = L.maximal_order() # needs sage.rings.function_field + sage: places(O.ideal(x, y)) # needs sage.rings.function_field Place (x, y) """ from .ideal import FunctionFieldIdeal @@ -385,10 +400,11 @@ def _an_element_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: places = L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field - sage: places.an_element() # random # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: places = L.place_set() # needs sage.rings.function_field + sage: places.an_element() # random # needs sage.rings.function_field Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2 """ @@ -408,10 +424,11 @@ def function_field(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: PS = L.place_set() # optional - sage.rings.finite_rings sage.rings.function_field - sage: PS.function_field() == L # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: PS = L.place_set() # needs sage.rings.function_field + sage: PS.function_field() == L # needs sage.rings.function_field True """ return self._field diff --git a/src/sage/rings/function_field/place_polymod.py b/src/sage/rings/function_field/place_polymod.py index f3f7778b6aa..b1d525152f0 100644 --- a/src/sage/rings/function_field/place_polymod.py +++ b/src/sage/rings/function_field/place_polymod.py @@ -33,14 +33,15 @@ def place_below(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: OK = K.maximal_order() # optional - sage.rings.finite_rings - sage: OL = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = OK.ideal(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: dec = OL.decomposition(p) # optional - sage.rings.finite_rings - sage: q = dec[0][0].place() # optional - sage.rings.finite_rings - sage: q.place_below() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: OK = K.maximal_order() + sage: OL = L.maximal_order() + sage: p = OK.ideal(x^2 + x + 1) + sage: dec = OL.decomposition(p) + sage: q = dec[0][0].place() + sage: q.place_below() Place (x^2 + x + 1) """ return self.prime_ideal().prime_below().place() @@ -51,14 +52,15 @@ def relative_degree(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: OK = K.maximal_order() # optional - sage.rings.finite_rings - sage: OL = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = OK.ideal(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: dec = OL.decomposition(p) # optional - sage.rings.finite_rings - sage: q = dec[0][0].place() # optional - sage.rings.finite_rings - sage: q.relative_degree() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: OK = K.maximal_order() + sage: OL = L.maximal_order() + sage: p = OK.ideal(x^2 + x + 1) + sage: dec = OL.decomposition(p) + sage: q = dec[0][0].place() + sage: q.relative_degree() 1 """ return self._prime._relative_degree @@ -69,14 +71,15 @@ def degree(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: OK = K.maximal_order() # optional - sage.rings.finite_rings - sage: OL = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = OK.ideal(x^2 + x + 1) # optional - sage.rings.finite_rings - sage: dec = OL.decomposition(p) # optional - sage.rings.finite_rings - sage: q = dec[0][0].place() # optional - sage.rings.finite_rings - sage: q.degree() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: OK = K.maximal_order() + sage: OL = L.maximal_order() + sage: p = OK.ideal(x^2 + x + 1) + sage: dec = OL.decomposition(p) + sage: q = dec[0][0].place() + sage: q.degree() 2 """ return self.relative_degree() * self.place_below().degree() @@ -88,12 +91,13 @@ def is_infinite_place(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: pls = L.places() # optional - sage.rings.finite_rings - sage: [p.is_infinite_place() for p in pls] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: pls = L.places() + sage: [p.is_infinite_place() for p in pls] [True, True, False] - sage: [p.place_below() for p in pls] # optional - sage.rings.finite_rings + sage: [p.place_below() for p in pls] [Place (1/x), Place (1/x), Place (x)] """ return self.place_below().is_infinite_place() @@ -105,10 +109,11 @@ def local_uniformizer(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: pls = L.places() # optional - sage.rings.finite_rings - sage: [p.local_uniformizer().valuation(p) for p in pls] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: pls = L.places() + sage: [p.local_uniformizer().valuation(p) for p in pls] [1, 1, 1, 1, 1] """ gens = self._prime.gens() @@ -123,16 +128,17 @@ def gaps(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = O.ideal(x,y).place() # optional - sage.rings.finite_rings - sage: p.gaps() # a Weierstrass place # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: O = L.maximal_order() + sage: p = O.ideal(x,y).place() + sage: p.gaps() # a Weierstrass place [1, 2, 4] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3 * Y + x) # optional - sage.rings.finite_rings - sage: [p.gaps() for p in L.places()] # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3 * Y + x) # needs sage.rings.finite_rings + sage: [p.gaps() for p in L.places()] # needs sage.rings.finite_rings [[1, 2, 4], [1, 2, 4], [1, 2, 4]] """ if self.degree() == 1: @@ -150,16 +156,17 @@ def _gaps_rational(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = O.ideal(x, y).place() # optional - sage.rings.finite_rings - sage: p.gaps() # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: O = L.maximal_order() + sage: p = O.ideal(x, y).place() + sage: p.gaps() # indirect doctest [1, 2, 4] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: [p.gaps() for p in L.places()] # indirect doctest # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings + sage: [p.gaps() for p in L.places()] # indirect doctest # needs sage.rings.finite_rings [[1, 2, 4], [1, 2, 4], [1, 2, 4]] """ from sage.matrix.constructor import matrix @@ -281,16 +288,17 @@ def _gaps_wronskian(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: p = O.ideal(x, y).place() # optional - sage.rings.finite_rings - sage: p._gaps_wronskian() # a Weierstrass place # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: O = L.maximal_order() + sage: p = O.ideal(x, y).place() + sage: p._gaps_wronskian() # a Weierstrass place [1, 2, 4] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + x^3 * Y + x) # optional - sage.rings.finite_rings - sage: [p._gaps_wronskian() for p in L.places()] # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] # needs sage.rings.finite_rings + sage: L. = K.extension(Y^3 + x^3 * Y + x) # needs sage.rings.finite_rings + sage: [p._gaps_wronskian() for p in L.places()] # needs sage.rings.finite_rings [[1, 2, 4], [1, 2, 4], [1, 2, 4]] """ from sage.matrix.constructor import matrix @@ -344,28 +352,29 @@ def residue_field(self, name=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings - sage: k, fr_k, to_k = p.residue_field() # optional - sage.rings.finite_rings - sage: k # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: k, fr_k, to_k = p.residue_field() + sage: k Finite Field of size 2 - sage: fr_k # optional - sage.rings.finite_rings + sage: fr_k Ring morphism: From: Finite Field of size 2 To: Valuation ring at Place (x, x*y) - sage: to_k # optional - sage.rings.finite_rings + sage: to_k Ring morphism: From: Valuation ring at Place (x, x*y) To: Finite Field of size 2 - sage: to_k(y) # optional - sage.rings.finite_rings + sage: to_k(y) Traceback (most recent call last): ... TypeError: y fails to convert into the map's domain Valuation ring at Place (x, x*y)... - sage: to_k(1/y) # optional - sage.rings.finite_rings + sage: to_k(1/y) 0 - sage: to_k(y/(1+y)) # optional - sage.rings.finite_rings + sage: to_k(y/(1+y)) 1 """ return self.valuation_ring().residue_field(name=name) @@ -383,21 +392,23 @@ def _residue_field(self, name=None): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings - sage: k,fr_k,to_k = p._residue_field() # optional - sage.rings.finite_rings - sage: k # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: k,fr_k,to_k = p._residue_field() + sage: k Finite Field of size 2 - sage: [fr_k(e) for e in k] # optional - sage.rings.finite_rings + sage: [fr_k(e) for e in k] [0, 1] :: - sage: K. = FunctionField(GF(9)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^3 + Y - x^4) # optional - sage.rings.finite_rings - sage: p = L.places()[-1] # optional - sage.rings.finite_rings - sage: p.residue_field() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(9)); _. = K[] + sage: L. = K.extension(Y^3 + Y - x^4) + sage: p = L.places()[-1] + sage: p.residue_field() (Finite Field in z2 of size 3^2, Ring morphism: From: Finite Field in z2 of size 3^2 To: Valuation ring at Place (x + 1, y + 2*z2), Ring morphism: @@ -428,11 +439,12 @@ def _residue_field(self, name=None): :: - sage: K. = FunctionField(QQbar); _. = K[] # optional - sage.rings.number_field - sage: L. = K.extension(Y^3 + Y - x^4) # optional - sage.rings.number_field - sage: O = K.maximal_order() # optional - sage.rings.number_field - sage: I = O.ideal(x) # optional - sage.rings.number_field - sage: [p.residue_field() for p in L.places_above(I.place())] # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: K. = FunctionField(QQbar); _. = K[] + sage: L. = K.extension(Y^3 + Y - x^4) + sage: O = K.maximal_order() + sage: I = O.ideal(x) + sage: [p.residue_field() for p in L.places_above(I.place())] [(Algebraic Field, Ring morphism: From: Algebraic Field To: Valuation ring at Place (x, y - I, y^2 + 1), Ring morphism: @@ -656,10 +668,11 @@ def valuation_ring(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: p = L.places_finite()[0] # optional - sage.rings.finite_rings - sage: p.valuation_ring() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: p.valuation_ring() Valuation ring at Place (x, x*y) """ from .valuation_ring import FunctionFieldValuationRing diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 9df6b5ffe73..5199ffdafd4 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -32,8 +32,8 @@ sage: v = K.valuation(x - 1); v (x - 1)-adic valuation sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: w = v.extensions(L); w # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: w = v.extensions(L); w # needs sage.rings.function_field [[ (x - 1)-adic valuation, v(y + 1) = 1 ]-adic valuation, [ (x - 1)-adic valuation, v(y - 1) = 1 ]-adic valuation] @@ -56,9 +56,9 @@ sage: K. = FunctionField(QQ) sage: v = K.valuation(x - 1) sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: ws = v.extensions(L) # optional - sage.rings.function_field - sage: for w in ws: TestSuite(w).run(max_runs=100) # long time # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: ws = v.extensions(L) # needs sage.rings.function_field + sage: for w in ws: TestSuite(w).run(max_runs=100) # long time # needs sage.rings.function_field Run test suite for valuations that do not correspond to a classical place:: @@ -77,19 +77,20 @@ Run test suite for some other classical places over large ground fields:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: M. = FunctionField(K) # optional - sage.rings.finite_rings - sage: v = M.valuation(x^3 - t) # optional - sage.rings.finite_rings - sage: TestSuite(v).run(max_runs=10) # long time # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: M. = FunctionField(K) + sage: v = M.valuation(x^3 - t) + sage: TestSuite(v).run(max_runs=10) # long time Run test suite for extensions over the infinite place:: sage: K. = FunctionField(QQ) sage: v = K.valuation(1/x) sage: R. = K[] - sage: L. = K.extension(y^2 - 1/(x^2 + 1)) # optional - sage.rings.function_field - sage: w = v.extensions(L) # optional - sage.rings.function_field - sage: TestSuite(w).run() # long time # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - 1/(x^2 + 1)) # needs sage.rings.function_field + sage: w = v.extensions(L) # needs sage.rings.function_field + sage: TestSuite(w).run() # long time # needs sage.rings.function_field Run test suite for a valuation with `v(1/x) > 0` which does not come from a classical valuation of the infinite place:: @@ -106,14 +107,14 @@ sage: K. = FunctionField(QQ) sage: v = K.valuation(x^2 + 1) sage: L. = FunctionField(GaussianIntegers().fraction_field()) - sage: ws = v.extensions(L) # optional - sage.rings.function_field - sage: for w in ws: TestSuite(w).run(max_runs=100) # long time # optional - sage.rings.function_field + sage: ws = v.extensions(L) # needs sage.rings.function_field + sage: for w in ws: TestSuite(w).run(max_runs=100) # long time # needs sage.rings.function_field Run test suite for a finite place with residual degree and ramification:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: L. = FunctionField(K) # optional - sage.rings.finite_rings - sage: v = L.valuation(x^6 - t) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) # needs sage.rings.finite_rings + sage: L. = FunctionField(K) # needs sage.rings.finite_rings + sage: v = L.valuation(x^6 - t) # needs sage.rings.finite_rings sage: TestSuite(v).run(max_runs=10) # long time Run test suite for a valuation which is backed by limit valuation:: @@ -122,8 +123,8 @@ sage: R. = K[] sage: L. = K.extension(y^2 - (x^2 + x + 1)) sage: v = K.valuation(x - 1) - sage: w = v.extension(L) # optional - sage.rings.function_field - sage: TestSuite(w).run() # long time # optional - sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: TestSuite(w).run() # long time # needs sage.rings.function_field Run test suite for a valuation which sends an element to `-\infty`:: @@ -307,9 +308,9 @@ def create_key_and_extra_args_from_valuation(self, domain, valuation): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^3 + 1/x^3*y + 2/x^4) # optional - sage.rings.function_field - sage: v = K.valuation(x) # optional - sage.rings.function_field - sage: v.extensions(L) # optional - sage.rings.function_field + sage: L. = K.extension(y^3 + 1/x^3*y + 2/x^4) # needs sage.rings.function_field + sage: v = K.valuation(x) # needs sage.rings.function_field + sage: v.extensions(L) # needs sage.rings.function_field [[ (x)-adic valuation, v(y) = 1 ]-adic valuation (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y), [ (x)-adic valuation, v(y) = 1/2 ]-adic valuation (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y)] @@ -352,11 +353,12 @@ def create_key_and_extra_args_from_valuation_on_isomorphic_field(self, domain, v TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = v.extension(L) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) # needs sage.rings.function_field + sage: w = v.extension(L) # indirect doctest # needs sage.rings.function_field """ from sage.categories.function_fields import FunctionFields @@ -493,8 +495,8 @@ def extensions(self, L): sage: K. = FunctionField(QQ) sage: v = K.valuation(x) sage: R. = K[] - sage: L. = K.extension(y^2 - x) # optional - sage.rings.function_field - sage: v.extensions(L) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: v.extensions(L) # needs sage.rings.function_field [(x)-adic valuation] TESTS: @@ -503,21 +505,22 @@ def extensions(self, L): sage: v = K.valuation(1/x) sage: R. = K[] - sage: L. = K.extension(y^2 - 1/(x^2 + 1)) # optional - sage.rings.function_field - sage: sorted(v.extensions(L), key=str) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - 1/(x^2 + 1)) # needs sage.rings.function_field + sage: sorted(v.extensions(L), key=str) # needs sage.rings.function_field [[ Valuation at the infinite place, v(y + 1/x) = 3 ]-adic valuation, [ Valuation at the infinite place, v(y - 1/x) = 3 ]-adic valuation] Iterated extensions over the infinite place:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: R. = L[] # optional - sage.rings.finite_rings sage.rings.function_field - sage: M. = L.extension(z^2 - y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.extension(M) # squarefreeness is not implemented here # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: M. = L.extension(z^2 - y) # needs sage.rings.function_field + sage: w.extension(M) # not implemented # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError @@ -531,19 +534,20 @@ def extensions(self, L): sage: v = K.valuation(v) sage: R. = K[] - sage: L. = K.extension(y^3 - x^4 - 1) # optional - sage.rings.function_field - sage: v.extensions(L) # optional - sage.rings.function_field + sage: L. = K.extension(y^3 - x^4 - 1) # needs sage.rings.function_field + sage: v.extensions(L) # needs sage.rings.function_field [2-adic valuation] Test that this works in towers:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y - x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: R. = L[] # optional - sage.rings.finite_rings sage.rings.function_field - sage: L. = L.extension(z - y) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v.extensions(L) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y - x) # needs sage.rings.function_field + sage: R. = L[] # needs sage.rings.function_field + sage: L. = L.extension(z - y) # needs sage.rings.function_field + sage: v = K.valuation(x) # needs sage.rings.function_field + sage: v.extensions(L) # needs sage.rings.function_field [(x)-adic valuation] """ K = self.domain() @@ -588,10 +592,10 @@ class RationalFunctionFieldValuation_base(FunctionFieldValuation_base): TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: v = K.valuation(x) # indirect doctest # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: v = K.valuation(x) # indirect doctest # needs sage.rings.finite_rings sage: from sage.rings.function_field.valuation import RationalFunctionFieldValuation_base - sage: isinstance(v, RationalFunctionFieldValuation_base) # optional - sage.rings.finite_rings + sage: isinstance(v, RationalFunctionFieldValuation_base) # needs sage.rings.finite_rings True """ @@ -603,15 +607,15 @@ def element_with_valuation(self, s): EXAMPLES:: sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 + 6) # optional - sage.rings.number_field - sage: v = K.valuation(2) # optional - sage.rings.number_field - sage: R. = K[] # optional - sage.rings.number_field - sage: w = GaussValuation(R, v).augmentation(x, 1/123) # optional - sage.rings.number_field - sage: K. = FunctionField(K) # optional - sage.rings.number_field - sage: w = w.extension(K) # optional - sage.rings.number_field - sage: w.element_with_valuation(122/123) # optional - sage.rings.number_field + sage: K. = NumberField(x^3 + 6) # needs sage.rings.number_field + sage: v = K.valuation(2) # needs sage.rings.number_field + sage: R. = K[] # needs sage.rings.number_field + sage: w = GaussValuation(R, v).augmentation(x, 1/123) # needs sage.rings.number_field + sage: K. = FunctionField(K) # needs sage.rings.number_field + sage: w = w.extension(K) # needs sage.rings.number_field + sage: w.element_with_valuation(122/123) # needs sage.rings.number_field 2/x - sage: w.element_with_valuation(1) # optional - sage.rings.number_field + sage: w.element_with_valuation(1) # needs sage.rings.number_field 2 """ @@ -632,10 +636,10 @@ class ClassicalFunctionFieldValuation_base(DiscreteFunctionFieldValuation_base): TESTS:: - sage: K. = FunctionField(GF(5)) # optional - sage.rings.finite_rings - sage: v = K.valuation(x) # indirect doctest # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) # needs sage.rings.finite_rings + sage: v = K.valuation(x) # indirect doctest # needs sage.rings.finite_rings sage: from sage.rings.function_field.valuation import ClassicalFunctionFieldValuation_base - sage: isinstance(v, ClassicalFunctionFieldValuation_base) # optional - sage.rings.finite_rings + sage: isinstance(v, ClassicalFunctionFieldValuation_base) # needs sage.rings.finite_rings True """ @@ -1000,14 +1004,14 @@ class FiniteRationalFunctionFieldValuation(InducedRationalFunctionFieldValuation A finite place with ramification:: - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: L. = FunctionField(K) # optional - sage.rings.finite_rings - sage: u = L.valuation(x^3 - t); u # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) # needs sage.rings.finite_rings + sage: L. = FunctionField(K) # needs sage.rings.finite_rings + sage: u = L.valuation(x^3 - t); u # needs sage.rings.finite_rings (x^3 + 2*t)-adic valuation A finite place with residual degree and ramification:: - sage: q = L.valuation(x^6 - t); q # optional - sage.rings.finite_rings + sage: q = L.valuation(x^6 - t); q # needs sage.rings.finite_rings (x^6 + 2*t)-adic valuation """ @@ -1079,8 +1083,8 @@ def residue_ring(self): Rational function field in x over Finite Field of size 2 sage: R. = K[] - sage: L. = K.extension(y^2 + 2*x) # optional - sage.rings.function_field - sage: w.extension(L).residue_ring() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 + 2*x) # needs sage.rings.function_field + sage: w.extension(L).residue_ring() # needs sage.rings.function_field Function field in u2 defined by u2^2 + x TESTS: @@ -1111,9 +1115,9 @@ class FunctionFieldFromLimitValuation(FiniteExtensionFromLimitValuation, Discret sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # optional - sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # optional - sage.rings.function_field - sage: w = v.extension(L); w # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field + sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field + sage: w = v.extension(L); w # needs sage.rings.function_field (x - 1)-adic valuation """ @@ -1123,11 +1127,11 @@ def __init__(self, parent, approximant, G, approximants): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # optional - sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # optional - sage.rings.function_field - sage: w = v.extension(L) # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field + sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field sage: from sage.rings.function_field.valuation import FunctionFieldFromLimitValuation - sage: isinstance(w, FunctionFieldFromLimitValuation) # optional - sage.rings.function_field + sage: isinstance(w, FunctionFieldFromLimitValuation) # needs sage.rings.function_field True """ @@ -1142,10 +1146,10 @@ def _to_base_domain(self, f): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # optional - sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # optional - sage.rings.function_field - sage: w = v.extension(L) # optional - sage.rings.function_field - sage: w._to_base_domain(y).parent() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field + sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w._to_base_domain(y).parent() # needs sage.rings.function_field Univariate Polynomial Ring in y over Rational function field in x over Rational Field """ @@ -1159,10 +1163,10 @@ def scale(self, scalar): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # optional - sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # optional - sage.rings.function_field - sage: w = v.extension(L) # optional - sage.rings.function_field - sage: 3*w # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field + sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: 3*w # needs sage.rings.function_field 3 * (x - 1)-adic valuation """ @@ -1178,8 +1182,8 @@ class FunctionFieldMappedValuation_base(FunctionFieldValuation_base, MappedValua EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: v = K.valuation(1/x); v # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: v = K.valuation(1/x); v # needs sage.rings.finite_rings Valuation at the infinite place """ @@ -1187,10 +1191,10 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v r""" TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: v = K.valuation(1/x) # needs sage.rings.finite_rings sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuation_base - sage: isinstance(v, FunctionFieldMappedValuation_base) # optional - sage.rings.finite_rings + sage: isinstance(v, FunctionFieldMappedValuation_base) # needs sage.rings.finite_rings True """ @@ -1206,12 +1210,13 @@ def _to_base_domain(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w._to_base_domain(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w._to_base_domain(y) # needs sage.rings.function_field x^2*y """ @@ -1223,12 +1228,13 @@ def _from_base_domain(self, f): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w._from_base_domain(w._to_base_domain(y)) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w._from_base_domain(w._to_base_domain(y)) # needs sage.rings.function_field y r""" @@ -1240,12 +1246,13 @@ def scale(self, scalar): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: 3*w # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field + sage: 3*w # needs sage.rings.function_field 3 * (x)-adic valuation (in Rational function field in x over Finite Field of size 2 after x |--> 1/x) """ @@ -1260,11 +1267,12 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: v.extension(L) # indirect doctest # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: v.extension(L) # indirect doctest # needs sage.rings.function_field Valuation at the infinite place """ @@ -1281,10 +1289,10 @@ def is_discrete_valuation(self): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x^4 - 1) # optional - sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.function_field - sage: w0,w1 = v.extensions(L) # optional - sage.rings.function_field - sage: w0.is_discrete_valuation() # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - x^4 - 1) # needs sage.rings.function_field + sage: v = K.valuation(1/x) # needs sage.rings.function_field + sage: w0,w1 = v.extensions(L) # needs sage.rings.function_field + sage: w0.is_discrete_valuation() # needs sage.rings.function_field True """ @@ -1299,8 +1307,8 @@ class FunctionFieldMappedValuationRelative_base(FunctionFieldMappedValuation_bas EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: v = K.valuation(1/x); v # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: v = K.valuation(1/x); v # needs sage.rings.finite_rings Valuation at the infinite place """ @@ -1308,10 +1316,10 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v r""" TESTS:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: v = K.valuation(1/x) # needs sage.rings.finite_rings sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuationRelative_base - sage: isinstance(v, FunctionFieldMappedValuationRelative_base) # optional - sage.rings.finite_rings + sage: isinstance(v, FunctionFieldMappedValuationRelative_base) # needs sage.rings.finite_rings True """ @@ -1325,8 +1333,8 @@ def restriction(self, ring): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: K.valuation(1/x).restriction(GF(2)) # optional - sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings + sage: K.valuation(1/x).restriction(GF(2)) # needs sage.rings.finite_rings Trivial valuation on Finite Field of size 2 """ @@ -1420,23 +1428,24 @@ class FunctionFieldExtensionMappedValuation(FunctionFieldMappedValuationRelative EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field - sage: w(x) # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(x) # needs sage.rings.finite_rings sage.rings.function_field -1 - sage: w(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(y) # needs sage.rings.finite_rings sage.rings.function_field -3/2 - sage: w.uniformizer() # optional - sage.rings.finite_rings sage.rings.function_field + sage: w.uniformizer() # needs sage.rings.finite_rings sage.rings.function_field 1/x^2*y TESTS:: sage: from sage.rings.function_field.valuation import FunctionFieldExtensionMappedValuation - sage: isinstance(w, FunctionFieldExtensionMappedValuation) # optional - sage.rings.finite_rings sage.rings.function_field + sage: isinstance(w, FunctionFieldExtensionMappedValuation) # needs sage.rings.finite_rings sage.rings.function_field True """ @@ -1446,18 +1455,19 @@ def _repr_(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w = v.extension(L); w # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) # needs sage.rings.function_field + sage: w = v.extension(L); w # needs sage.rings.function_field Valuation at the infinite place sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - 1/x^2 - 1) # optional - sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.function_field - sage: w = v.extensions(L); w # optional - sage.rings.function_field + sage: L. = K.extension(y^2 - 1/x^2 - 1) # needs sage.rings.function_field + sage: v = K.valuation(1/x) # needs sage.rings.function_field + sage: w = v.extensions(L); w # needs sage.rings.function_field [[ Valuation at the infinite place, v(y + 1) = 2 ]-adic valuation, [ Valuation at the infinite place, v(y - 1) = 2 ]-adic valuation] @@ -1473,12 +1483,13 @@ def restriction(self, ring): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # optional - sage.rings.finite_rings - sage: R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 + y + x^3) # optional - sage.rings.finite_rings sage.rings.function_field - sage: v = K.valuation(1/x) # optional - sage.rings.finite_rings - sage: w = v.extension(L) # optional - sage.rings.finite_rings sage.rings.function_field - sage: w.restriction(K) is v # optional - sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: v = K.valuation(1/x) + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w.restriction(K) is v # needs sage.rings.function_field True """ if ring.is_subring(self.domain().base()): From 72a72770d40b55f624c9776339f79e16bc1d1b18 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 13 Jul 2023 22:27:33 -0700 Subject: [PATCH 06/20] sage.rings: Update # needs --- src/sage/rings/function_field/order_basis.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index 98f758ea088..fb4adf0c5c1 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -71,11 +71,11 @@ def __init__(self, basis, check=True): TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: TestSuite(O).run() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: TestSuite(O).run() """ if len(basis) == 0: raise ValueError("basis must have positive length") @@ -361,11 +361,11 @@ def __init__(self, basis, check=True): TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order_infinite() # needs sage.rings.function_field - sage: TestSuite(O).run() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order_infinite() + sage: TestSuite(O).run() """ if len(basis) == 0: raise ValueError("basis must have positive length") From 744e1f1f520b7e2348785c0e9845bd50099eef14 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 14 Jul 2023 09:25:35 -0700 Subject: [PATCH 07/20] ./sage -fixdoctests --only-tags src/sage/rings/function_field --- src/sage/rings/function_field/valuation.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 5199ffdafd4..11b1194aa4e 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -606,16 +606,17 @@ def element_with_valuation(self, s): EXAMPLES:: + sage: # needs sage.rings.number_field sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^3 + 6) # needs sage.rings.number_field - sage: v = K.valuation(2) # needs sage.rings.number_field - sage: R. = K[] # needs sage.rings.number_field - sage: w = GaussValuation(R, v).augmentation(x, 1/123) # needs sage.rings.number_field - sage: K. = FunctionField(K) # needs sage.rings.number_field - sage: w = w.extension(K) # needs sage.rings.number_field - sage: w.element_with_valuation(122/123) # needs sage.rings.number_field + sage: K. = NumberField(x^3 + 6) + sage: v = K.valuation(2) + sage: R. = K[] + sage: w = GaussValuation(R, v).augmentation(x, 1/123) + sage: K. = FunctionField(K) + sage: w = w.extension(K) + sage: w.element_with_valuation(122/123) 2/x - sage: w.element_with_valuation(1) # needs sage.rings.number_field + sage: w.element_with_valuation(1) 2 """ From 71382a640831c0409412f50c34f854c7d2b4a69f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 14 Jul 2023 09:28:08 -0700 Subject: [PATCH 08/20] sage.rings.function_field: Update from #35095 --- .../drinfeld_modules/drinfeld_module.py | 2 +- .../rings/function_field/function_field.py | 8 - .../rings/function_field/ideal_polymod.py | 997 ++++++++++-------- 3 files changed, 538 insertions(+), 469 deletions(-) diff --git a/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py b/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py index f100429903b..959c3aeab3b 100644 --- a/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py +++ b/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py @@ -36,12 +36,12 @@ from sage.rings.integer_ring import ZZ from sage.rings.polynomial.ore_polynomial_element import OrePolynomial from sage.rings.polynomial.polynomial_ring import PolynomialRing_general -from sage.rings.ring_extension import RingExtension_generic from sage.structure.parent import Parent from sage.structure.sage_object import SageObject from sage.structure.sequence import Sequence from sage.structure.unique_representation import UniqueRepresentation +lazy_import('sage.rings.ring_extension', 'RingExtension_generic') lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing') diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 6739e722df2..ab230b3e76b 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -1015,11 +1015,7 @@ def space_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) -<<<<<<< HEAD - sage: K.space_of_holomorphic_differentials() # optional - sage.modules -======= sage: K.space_of_holomorphic_differentials() # needs sage.libs.pari sage.modules ->>>>>>> 0e22212ec9 (./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/function_field) (Vector space of dimension 0 over Rational Field, Linear map: From: Vector space of dimension 0 over Rational Field @@ -1052,11 +1048,7 @@ def basis_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) -<<<<<<< HEAD - sage: K.basis_of_holomorphic_differentials() # optional - sage.modules -======= sage: K.basis_of_holomorphic_differentials() # needs sage.libs.pari sage.modules ->>>>>>> 0e22212ec9 (./sage -fixdoctests --distribution sagemath-categories --probe all --only-tags src/sage/rings/function_field) [] sage: K. = FunctionField(GF(5)); _. = K[] diff --git a/src/sage/rings/function_field/ideal_polymod.py b/src/sage/rings/function_field/ideal_polymod.py index 936b63b48fe..6735dd6a8fa 100644 --- a/src/sage/rings/function_field/ideal_polymod.py +++ b/src/sage/rings/function_field/ideal_polymod.py @@ -44,10 +44,11 @@ class FunctionFieldIdeal_polymod(FunctionFieldIdeal): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.ideal(y) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: O.ideal(y) Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x """ def __init__(self, ring, hnf, denominator=1): @@ -56,11 +57,12 @@ def __init__(self, ring, hnf, denominator=1): TESTS:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: TestSuite(I).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdeal.__init__(self, ring) @@ -96,29 +98,31 @@ def __bool__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y); I Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: I.is_zero() # optional - sage.rings.finite_rings + sage: I.is_zero() False - sage: J = 0*I; J # optional - sage.rings.finite_rings + sage: J = 0*I; J Zero ideal of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: J.is_zero() # optional - sage.rings.finite_rings + sage: J.is_zero() True - sage: K. = FunctionField(GF(2)); _.=K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _.=K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y); I Ideal (y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: I.is_zero() # optional - sage.rings.finite_rings + sage: I.is_zero() False - sage: J = 0*I; J # optional - sage.rings.finite_rings + sage: J = 0*I; J Zero ideal of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: J.is_zero() # optional - sage.rings.finite_rings + sage: J.is_zero() True """ return self._hnf.nrows() != 0 @@ -129,17 +133,19 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(1/y) # optional - sage.rings.finite_rings - sage: { I: 2 }[I] == 2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(1/y) + sage: { I: 2 }[I] == 2 True - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(1/y) # optional - sage.rings.finite_rings - sage: { I: 2 }[I] == 2 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(1/y) + sage: { I: 2 }[I] == 2 True """ return hash((self._ring, self._hnf, self._denominator)) @@ -150,30 +156,32 @@ def __contains__(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(7)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal([y]); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); _. = K[] + sage: L. = K.extension(Y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal([y]); I Ideal (y) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: x * y in I # optional - sage.rings.finite_rings + sage: x * y in I True - sage: y / x in I # optional - sage.rings.finite_rings + sage: y / x in I False - sage: y^2 - 2 in I # optional - sage.rings.finite_rings + sage: y^2 - 2 in I False - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal([y]); I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal([y]); I Ideal (y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: x * y in I # optional - sage.rings.finite_rings + sage: x * y in I True - sage: y / x in I # optional - sage.rings.finite_rings + sage: y / x in I False - sage: y^2 - 2 in I # optional - sage.rings.finite_rings + sage: y^2 - 2 in I False sage: K. = FunctionField(QQ); _. = K[] @@ -219,30 +227,32 @@ def __invert__(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: ~I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); _. = K[] + sage: L. = K.extension(Y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: ~I Ideal ((1/(x^3 + 1))*y) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: I^(-1) # optional - sage.rings.finite_rings + sage: I^(-1) Ideal ((1/(x^3 + 1))*y) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 - sage: ~I * I # optional - sage.rings.finite_rings + sage: ~I * I Ideal (1) of Maximal order of Function field in y defined by y^2 + 6*x^3 + 6 :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: ~I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: ~I Ideal ((x/(x^2 + 1))*y + x/(x^2 + 1)) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: I^(-1) # optional - sage.rings.finite_rings + sage: I^(-1) Ideal ((x/(x^2 + 1))*y + x/(x^2 + 1)) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: ~I * I # optional - sage.rings.finite_rings + sage: ~I * I Ideal (1) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x :: @@ -291,28 +301,30 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(1/y) # optional - sage.rings.finite_rings - sage: I == I + I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(1/y) + sage: I == I + I True - sage: I == I * I # optional - sage.rings.finite_rings + sage: I == I * I False :: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(1/y) # optional - sage.rings.finite_rings - sage: I == I + I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(1/y) + sage: I == I + I True - sage: I == I * I # optional - sage.rings.finite_rings + sage: I == I * I False - sage: I < I * I # optional - sage.rings.finite_rings + sage: I < I * I True - sage: I > I * I # optional - sage.rings.finite_rings + sage: I > I * I False """ return richcmp((self._denominator, self._hnf), (other._denominator, other._hnf), op) @@ -323,19 +335,21 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I + J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x + y) + sage: I + J Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I + J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x + y) + sage: I + J Ideal (1, y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ ds = self._denominator @@ -350,20 +364,22 @@ def _mul_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x + y) + sage: I * J Ideal (x^4 + x^2 + x, x*y + x^2) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x + y) + sage: I * J Ideal ((x + 1)*y + (x^2 + 1)/x) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -401,19 +417,21 @@ def _acted_upon_(self, other, on_left): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x) # optional - sage.rings.finite_rings - sage: x * I == I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: J = O.ideal(x) + sage: x * I == I * J True - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x) # optional - sage.rings.finite_rings - sage: x * I == I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: J = O.ideal(x) + sage: x * I == I * J True """ from sage.modules.free_module_element import vector @@ -441,12 +459,13 @@ def intersect(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x) # optional - sage.rings.finite_rings - sage: I.intersect(J) == I * J * (I + J)^-1 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: J = O.ideal(x) + sage: I.intersect(J) == I * J * (I + J)^-1 True """ @@ -486,10 +505,11 @@ def hnf(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y*(y+1)); I.hnf() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal(y*(y+1)); I.hnf() [x^6 + x^3 0] [ x^3 + 1 1] @@ -510,13 +530,14 @@ def denominator(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y/(y+1)) # optional - sage.rings.finite_rings - sage: d = I.denominator(); d # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal(y/(y+1)) + sage: d = I.denominator(); d x^3 - sage: d in O # optional - sage.rings.finite_rings + sage: d in O True :: @@ -540,11 +561,12 @@ def module(self): EXAMPLES:: - sage: K. = FunctionField(GF(7)); R. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(y^2 - x^3 - 1) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.module() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(7)); R. = K[] + sage: F. = K.extension(y^2 - x^3 - 1) + sage: O = F.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.module() Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -564,17 +586,19 @@ def gens_over_base(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens_over_base() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens_over_base() (x^4 + x^2 + x, y + x) - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens_over_base() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens_over_base() (x^3 + 1, y + x) """ gens, d = self._gens_over_base @@ -588,11 +612,12 @@ def _gens_over_base(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(1/y) # optional - sage.rings.finite_rings - sage: I._gens_over_base # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(1/y) + sage: I._gens_over_base ([x, y], x) """ gens = [] @@ -609,17 +634,19 @@ def gens(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens() (x^4 + x^2 + x, y + x) - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens() (x^3 + 1, y + x) """ return self.gens_over_base() @@ -634,11 +661,12 @@ def basis_matrix(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.denominator() * I.basis_matrix() == I.hnf() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.denominator() * I.basis_matrix() == I.hnf() True """ d = self.denominator() @@ -654,24 +682,26 @@ def is_integral(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.is_integral() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.is_integral() False - sage: J = I.denominator() * I # optional - sage.rings.finite_rings - sage: J.is_integral() # optional - sage.rings.finite_rings + sage: J = I.denominator() * I + sage: J.is_integral() True - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.is_integral() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.is_integral() False - sage: J = I.denominator() * I # optional - sage.rings.finite_rings - sage: J.is_integral() # optional - sage.rings.finite_rings + sage: J = I.denominator() * I + sage: J.is_integral() True sage: K. = FunctionField(QQ); _. = PolynomialRing(K) @@ -694,29 +724,31 @@ def ideal_below(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.ideal_below() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.ideal_below() Traceback (most recent call last): ... TypeError: not an integral ideal - sage: J = I.denominator() * I # optional - sage.rings.finite_rings - sage: J.ideal_below() # optional - sage.rings.finite_rings + sage: J = I.denominator() * I + sage: J.ideal_below() Ideal (x^3 + x^2 + x) of Maximal order of Rational function field in x over Finite Field of size 2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, 1/y) # optional - sage.rings.finite_rings - sage: I.ideal_below() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x, 1/y) + sage: I.ideal_below() Traceback (most recent call last): ... TypeError: not an integral ideal - sage: J = I.denominator() * I # optional - sage.rings.finite_rings - sage: J.ideal_below() # optional - sage.rings.finite_rings + sage: J = I.denominator() * I + sage: J.ideal_below() Ideal (x^3 + x) of Maximal order of Rational function field in x over Finite Field of size 2 @@ -760,38 +792,40 @@ def norm(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: i1 = O.ideal(x) # optional - sage.rings.finite_rings - sage: i2 = O.ideal(y) # optional - sage.rings.finite_rings - sage: i3 = i1 * i2 # optional - sage.rings.finite_rings - sage: i3.norm() == i1.norm() * i2.norm() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: i1 = O.ideal(x) + sage: i2 = O.ideal(y) + sage: i3 = i1 * i2 + sage: i3.norm() == i1.norm() * i2.norm() True - sage: i1.norm() # optional - sage.rings.finite_rings + sage: i1.norm() x^3 - sage: i1.norm() == x ** F.degree() # optional - sage.rings.finite_rings + sage: i1.norm() == x ** F.degree() True - sage: i2.norm() # optional - sage.rings.finite_rings + sage: i2.norm() x^6 + x^4 + x^2 - sage: i2.norm() == y.norm() # optional - sage.rings.finite_rings + sage: i2.norm() == y.norm() True - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: i1 = O.ideal(x) # optional - sage.rings.finite_rings - sage: i2 = O.ideal(y) # optional - sage.rings.finite_rings - sage: i3 = i1 * i2 # optional - sage.rings.finite_rings - sage: i3.norm() == i1.norm() * i2.norm() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: i1 = O.ideal(x) + sage: i2 = O.ideal(y) + sage: i3 = i1 * i2 + sage: i3.norm() == i1.norm() * i2.norm() True - sage: i1.norm() # optional - sage.rings.finite_rings + sage: i1.norm() x^2 - sage: i1.norm() == x ** L.degree() # optional - sage.rings.finite_rings + sage: i1.norm() == x ** L.degree() True - sage: i2.norm() # optional - sage.rings.finite_rings + sage: i2.norm() (x^2 + 1)/x - sage: i2.norm() == y.norm() # optional - sage.rings.finite_rings + sage: i2.norm() == y.norm() True """ n = 1 @@ -806,18 +840,20 @@ def is_prime(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: [f.is_prime() for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: [f.is_prime() for f,_ in I.factor()] [True, True] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: [f.is_prime() for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: [f.is_prime() for f,_ in I.factor()] [True, True] sage: K. = FunctionField(QQ); _. = PolynomialRing(K) @@ -854,21 +890,23 @@ def valuation(self, ideal): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x, (1/(x^3 + x^2 + x))*y^2) # optional - sage.rings.finite_rings - sage: I.is_prime() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(x, (1/(x^3 + x^2 + x))*y^2) + sage: I.is_prime() True - sage: J = O.ideal(y) # optional - sage.rings.finite_rings - sage: I.valuation(J) # optional - sage.rings.finite_rings + sage: J = O.ideal(y) + sage: I.valuation(J) 2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: [f.valuation(I) for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: [f.valuation(I) for f,_ in I.factor()] [-1, 2] The method closely follows Algorithm 4.8.17 of [Coh1993]_. @@ -923,20 +961,22 @@ def prime_below(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: [f.prime_below() for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: [f.prime_below() for f,_ in I.factor()] [Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2, Ideal (x^2 + x + 1) of Maximal order of Rational function field in x over Finite Field of size 2] - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: [f.prime_below() for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: [f.prime_below() for f,_ in I.factor()] [Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2, Ideal (x + 1) of Maximal order of Rational function field in x over Finite Field of size 2] @@ -956,11 +996,12 @@ def _factor(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: I == I.factor().prod() # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: I == I.factor().prod() # indirect doctest True """ O = self.ring() @@ -999,10 +1040,11 @@ class FunctionFieldIdeal_global(FunctionFieldIdeal_polymod): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: O.ideal(y) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: O.ideal(y) Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x """ def __init__(self, ring, hnf, denominator=1): @@ -1011,11 +1053,12 @@ def __init__(self, ring, hnf, denominator=1): TESTS:: - sage: K. = FunctionField(GF(5)); R. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(y^2 - x^3*y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: TestSuite(I).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)); R. = K[] + sage: L. = K.extension(y^2 - x^3*y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdeal_polymod.__init__(self, ring, hnf, denominator) @@ -1028,18 +1071,19 @@ def __pow__(self, mod): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^7 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: J = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: S = I / J # optional - sage.rings.finite_rings - sage: a = S^100 # optional - sage.rings.finite_rings - sage: _ = S.gens_two() # optional - sage.rings.finite_rings - sage: b = S^100 # faster # optional - sage.rings.finite_rings - sage: b == I^100 / J^100 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^7 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x + y) + sage: S = I / J + sage: a = S^100 + sage: _ = S.gens_two() + sage: b = S^100 # faster + sage: b == I^100 / J^100 True - sage: b == a # optional - sage.rings.finite_rings + sage: b == a True """ if mod > 2 and self._gens_two_vecs is not None: @@ -1074,17 +1118,19 @@ def gens(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 - x^3*Y - x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens() (x^4 + x^2 + x, y + x) - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(x + y) + sage: I.gens() (x^3 + 1, y + x) """ if self._gens_two.is_in_cache(): @@ -1100,25 +1146,27 @@ def gens_two(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: I # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: I # indirect doctest Ideal (y) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2 - sage: ~I # indirect doctest # optional - sage.rings.finite_rings + sage: ~I # indirect doctest Ideal ((1/(x^6 + x^4 + x^2))*y^2) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: O = L.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(y) # optional - sage.rings.finite_rings - sage: I # indirect doctest # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I # indirect doctest Ideal (y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: ~I # indirect doctest # optional - sage.rings.finite_rings + sage: ~I # indirect doctest Ideal ((x/(x^2 + 1))*y + x/(x^2 + 1)) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -1153,17 +1201,19 @@ def _gens_two(self): EXAMPLES:: - sage: K. = FunctionField(GF(4)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(Y^3 + x^3*Y + x) # optional - sage.rings.finite_rings - sage: O = F.maximal_order() # optional - sage.rings.finite_rings - sage: I = O.ideal(x^2, x*y, x + y) # optional - sage.rings.finite_rings - sage: I._gens_two() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(4)); _. = K[] + sage: F. = K.extension(Y^3 + x^3*Y + x) + sage: O = F.maximal_order() + sage: I = O.ideal(x^2, x*y, x + y) + sage: I._gens_two() (x, y) - sage: K. = FunctionField(GF(3)) # optional - sage.rings.finite_rings - sage: _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y - x) # optional - sage.rings.finite_rings - sage: y.zeros()[0].prime_ideal()._gens_two() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: _. = K[] + sage: L. = K.extension(Y - x) + sage: y.zeros()[0].prime_ideal()._gens_two() (x,) """ O = self.ring() @@ -1264,10 +1314,11 @@ class FunctionFieldIdealInfinite_polymod(FunctionFieldIdealInfinite): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: Oinf.ideal(1/y) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: Oinf.ideal(1/y) Ideal (1/x^4*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 """ @@ -1277,11 +1328,12 @@ def __init__(self, ring, ideal): TESTS:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings - sage: TestSuite(I).run() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/y) + sage: TestSuite(I).run() """ FunctionFieldIdealInfinite.__init__(self, ring) self._ideal = ideal @@ -1292,17 +1344,19 @@ def __hash__(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings - sage: d = { I: 1 } # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/y) + sage: d = { I: 1 } - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings - sage: d = { I: 1 } # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/y) + sage: d = { I: 1 } """ return hash((self.ring(), self._ideal)) @@ -1316,15 +1370,16 @@ def __contains__(self, x): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/y) # optional - sage.rings.finite_rings - sage: 1/y in I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/y) + sage: 1/y in I True - sage: 1/x in I # optional - sage.rings.finite_rings + sage: 1/x in I False - sage: 1/x^2 in I # optional - sage.rings.finite_rings + sage: 1/x^2 in I True """ F = self.ring().fraction_field() @@ -1341,21 +1396,23 @@ def _add_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I + J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I + J Ideal (1/x) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I + J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I + J Ideal (1/x) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -1371,21 +1428,23 @@ def _mul_(self, other): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I * J Ideal (1/x^7*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I * J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I * J Ideal (1/x^4*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -1397,11 +1456,12 @@ def __pow__(self, n): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: J^3 # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: J = Oinf.ideal(1/x) + sage: J^3 Ideal (1/x^3) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 """ @@ -1413,25 +1473,27 @@ def __invert__(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(y) # optional - sage.rings.finite_rings - sage: ~J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: J = Oinf.ideal(y) + sage: ~J Ideal (1/x^4*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: J * ~J # optional - sage.rings.finite_rings + sage: J * ~J Ideal (1) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(y) # optional - sage.rings.finite_rings - sage: ~J # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: J = Oinf.ideal(y) + sage: ~J Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: J * ~J # optional - sage.rings.finite_rings + sage: J * ~J Ideal (1) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -1443,32 +1505,34 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I * J == J * I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I * J == J * I True - sage: I + J == J # optional - sage.rings.finite_rings + sage: I + J == J True - sage: I + J == I # optional - sage.rings.finite_rings + sage: I + J == I False - sage: (I < J) == (not J < I) # optional - sage.rings.finite_rings + sage: (I < J) == (not J < I) True - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x^2*1/y) # optional - sage.rings.finite_rings - sage: J = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I * J == J * I # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x^2*1/y) + sage: J = Oinf.ideal(1/x) + sage: I * J == J * I True - sage: I + J == J # optional - sage.rings.finite_rings + sage: I + J == J True - sage: I + J == I # optional - sage.rings.finite_rings + sage: I + J == I False - sage: (I < J) == (not J < I) # optional - sage.rings.finite_rings + sage: (I < J) == (not J < I) True """ return richcmp(self._ideal, other._ideal, op) @@ -1480,11 +1544,12 @@ def _relative_degree(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: [J._relative_degree for J,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: [J._relative_degree for J,_ in I.factor()] [1] """ if not self.is_prime(): @@ -1498,18 +1563,20 @@ def gens(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(x + y) + sage: I.gens() (x, y, 1/x^2*y^2) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(x + y) + sage: I.gens() (x, y) """ F = self.ring().fraction_field() @@ -1522,18 +1589,20 @@ def gens_two(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens_two() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(x + y) + sage: I.gens_two() (x, y) - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens_two() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(x + y) + sage: I.gens_two() (x,) """ F = self.ring().fraction_field() @@ -1546,11 +1615,12 @@ def gens_over_base(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(x + y) # optional - sage.rings.finite_rings - sage: I.gens_over_base() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = K[] + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(x + y) + sage: I.gens_over_base() (x, y, 1/x^2*y^2) """ F = self.ring().fraction_field() @@ -1563,11 +1633,12 @@ def ideal_below(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = K[] # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/y^2) # optional - sage.rings.finite_rings - sage: I.ideal_below() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = K[] + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/y^2) + sage: I.ideal_below() Ideal (x^3) of Maximal order of Rational function field in x over Finite Field in z2 of size 3^2 """ @@ -1579,30 +1650,32 @@ def is_prime(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x^3*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4)^3 - sage: I.is_prime() # optional - sage.rings.finite_rings + sage: I.is_prime() False - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings - sage: J.is_prime() # optional - sage.rings.finite_rings + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x)^2 - sage: I.is_prime() # optional - sage.rings.finite_rings + sage: I.is_prime() False - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings - sage: J.is_prime() # optional - sage.rings.finite_rings + sage: J = I.factor()[0][0] + sage: J.is_prime() True """ return self._ideal.is_prime() @@ -1614,31 +1687,33 @@ def prime_below(self): EXAMPLES:: - sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 + t^2 - x^4) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x^3*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4)^3 - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings - sage: J.is_prime() # optional - sage.rings.finite_rings + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.prime_below() # optional - sage.rings.finite_rings + sage: J.prime_below() Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field in z2 of size 3^2 - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(1/x) # optional - sage.rings.finite_rings - sage: I.factor() # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x)^2 - sage: J = I.factor()[0][0] # optional - sage.rings.finite_rings - sage: J.is_prime() # optional - sage.rings.finite_rings + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.prime_below() # optional - sage.rings.finite_rings + sage: J.prime_below() Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 """ @@ -1659,11 +1734,12 @@ def valuation(self, ideal): EXAMPLES:: - sage: K. = FunctionField(GF(2)); _. = K[] # optional - sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # optional - sage.rings.finite_rings - sage: Oinf = L.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(y) # optional - sage.rings.finite_rings - sage: [f.valuation(I) for f,_ in I.factor()] # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(y) + sage: [f.valuation(I) for f,_ in I.factor()] [-1] """ if not self.is_prime(): @@ -1677,16 +1753,17 @@ def _factor(self): EXAMPLES:: - sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) # optional - sage.rings.finite_rings - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # optional - sage.rings.finite_rings - sage: Oinf = F.maximal_order_infinite() # optional - sage.rings.finite_rings - sage: f = 1/x # optional - sage.rings.finite_rings - sage: I = Oinf.ideal(f) # optional - sage.rings.finite_rings - sage: I._factor() # optional - sage.rings.finite_rings - [(Ideal (1/x, 1/x^4*y^2 + 1/x^2*y + 1) of Maximal infinite order of Function field in y - defined by y^3 + x^6 + x^4 + x^2, 1), - (Ideal (1/x, 1/x^2*y + 1) of Maximal infinite order of Function field in y - defined by y^3 + x^6 + x^4 + x^2, 1)] + sage: # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: Oinf = F.maximal_order_infinite() + sage: f = 1/x + sage: I = Oinf.ideal(f) + sage: I._factor() + [(Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1/x^2*y + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2, + 1), + (Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2, + 1)] """ if self._ideal.is_prime.is_in_cache() and self._ideal.is_prime(): return [(self, 1)] From 660276747349ffb8bf0bee38d4cd912aff7dd73f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 16:40:25 -0700 Subject: [PATCH 09/20] sage.rings.function_field: Update # needs using sage-fixdoctests --distribution sagemath-pari, sagemath-modules, sagemath-modules[pari] --- src/sage/rings/function_field/differential.py | 252 +++++++++--------- src/sage/rings/function_field/element.pyx | 14 +- .../rings/function_field/element_rational.pyx | 20 +- src/sage/rings/function_field/extensions.py | 6 +- .../rings/function_field/function_field.py | 2 +- .../function_field/function_field_rational.py | 4 +- .../rings/function_field/ideal_rational.py | 12 +- src/sage/rings/function_field/order_basis.py | 4 +- src/sage/rings/function_field/place.py | 2 +- 9 files changed, 160 insertions(+), 156 deletions(-) diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index ea25dbaf207..0b3063c6a1f 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -9,36 +9,38 @@ The module of differentials on a function field forms an one-dimensional vector space over the function field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: f = x + y # needs sage.rings.function_field - sage: g = 1 / y # needs sage.rings.function_field - sage: df = f.differential() # needs sage.rings.function_field - sage: dg = g.differential() # needs sage.rings.function_field - sage: dfdg = f.derivative() / g.derivative() # needs sage.rings.function_field - sage: df == dfdg * dg # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: f = x + y + sage: g = 1 / y + sage: df = f.differential() + sage: dg = g.differential() + sage: dfdg = f.derivative() / g.derivative() + sage: df == dfdg * dg True - sage: df # needs sage.rings.function_field + sage: df (x*y^2 + 1/x*y + 1) d(x) - sage: df.parent() # needs sage.rings.function_field + sage: df.parent() Space of differentials of Function field in y defined by y^3 + x^3*y + x We can compute a canonical divisor:: - sage: k = df.divisor() # needs sage.rings.finite_rings sage.rings.function_field - sage: k.degree() # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: k = df.divisor() + sage: k.degree() 4 - sage: k.degree() == 2 * L.genus() - 2 # needs sage.rings.finite_rings sage.rings.function_field + sage: k.degree() == 2 * L.genus() - 2 True Exact differentials vanish and logarithmic differentials are stable under the Cartier operation:: - sage: df.cartier() # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: df.cartier() 0 - sage: w = 1/f * df # needs sage.rings.finite_rings sage.rings.function_field - sage: w.cartier() == w # needs sage.rings.finite_rings sage.rings.function_field + sage: w = 1/f * df + sage: w.cartier() == w True AUTHORS: @@ -194,17 +196,17 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w1 = y.differential() # needs sage.rings.function_field - sage: w2 = L(x).differential() # needs sage.rings.function_field - sage: w3 = (x*y).differential() # needs sage.rings.function_field - sage: w1 < w2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w1 = y.differential() + sage: w2 = L(x).differential() + sage: w3 = (x*y).differential() + sage: w1 < w2 False - sage: w2 < w1 # needs sage.rings.function_field + sage: w2 < w1 True - sage: w3 == x * w1 + y * w2 # needs sage.rings.function_field + sage: w3 == x * w1 + y * w2 True sage: F. = FunctionField(QQ) @@ -229,12 +231,12 @@ def _add_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w1 = y.differential() # needs sage.rings.function_field - sage: w2 = (1/y).differential() # needs sage.rings.function_field - sage: w1 + w2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w1 = y.differential() + sage: w2 = (1/y).differential() + sage: w1 + w2 (((x^3 + 1)/x^2)*y^2 + 1/x*y) d(x) sage: F. = FunctionField(QQ) @@ -258,12 +260,12 @@ def _div_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w1 = y.differential() # needs sage.rings.function_field - sage: w2 = (1/y).differential() # needs sage.rings.function_field - sage: w1 / w2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w1 = y.differential() + sage: w2 = (1/y).differential() + sage: w1 / w2 y^2 sage: F. = FunctionField(QQ) @@ -283,12 +285,12 @@ def _neg_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w1 = y.differential() # needs sage.rings.function_field - sage: w2 = (-y).differential() # needs sage.rings.function_field - sage: -w1 == w2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w1 = y.differential() + sage: w2 = (-y).differential() + sage: -w1 == w2 True sage: F. = FunctionField(QQ) @@ -311,12 +313,12 @@ def _rmul_(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w1 = (1/y).differential() # needs sage.rings.function_field - sage: w2 = (-1/y^2) * y.differential() # needs sage.rings.function_field - sage: w1 == w2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w1 = (1/y).differential() + sage: w2 = (-1/y^2) * y.differential() + sage: w1 == w2 True sage: F. = FunctionField(QQ) @@ -341,20 +343,21 @@ def _acted_upon_(self, f, self_on_left): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(31)); _. = K[] - sage: L. = K.extension(Y^2 - x); _. = L[] # needs sage.rings.function_field - sage: M. = L.extension(Z^2 - y) # needs sage.rings.function_field - sage: z.differential() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 - x); _. = L[] + sage: M. = L.extension(Z^2 - y) + sage: z.differential() (8/x*z) d(x) - sage: 1/(2*z) * y.differential() # needs sage.rings.function_field + sage: 1/(2*z) * y.differential() (8/x*z) d(x) - sage: z * x.differential() # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: z * x.differential() (z) d(x) - sage: z * (y^2).differential() # needs sage.rings.finite_rings sage.rings.function_field + sage: z * (y^2).differential() (z) d(x) - sage: z * (z^4).differential() # needs sage.rings.finite_rings sage.rings.function_field + sage: z * (z^4).differential() (z) d(x) :: @@ -377,7 +380,6 @@ def divisor(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(5)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: w = (1/y) * y.differential() # needs sage.rings.function_field @@ -392,7 +394,7 @@ def divisor(self): sage: F. = FunctionField(QQ) sage: w = (1/x).differential() - sage: w.divisor() + sage: w.divisor() # needs sage.libs.pari -2*Place (x) """ F = self.parent().function_field() @@ -450,28 +452,29 @@ def residue(self, place): and in an extension field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: f = 0 # needs sage.rings.function_field - sage: while f == 0: # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: f = 0 + sage: while f == 0: ....: f = L.random_element() - sage: w = 1/f * f.differential() # needs sage.rings.function_field - sage: d = f.divisor() # needs sage.rings.function_field - sage: s = d.support() # needs sage.rings.function_field - sage: sum([w.residue(p).trace() for p in s]) # needs sage.rings.function_field + sage: w = 1/f * f.differential() + sage: d = f.divisor() + sage: s = d.support() + sage: sum([w.residue(p).trace() for p in s]) 0 and also in a function field of characteristic zero:: + sage: # needs sage.rings.function_field sage: R. = FunctionField(QQ) sage: L. = R[] - sage: F. = R.extension(Y^2 - x^4 - 4*x^3 - 2*x^2 - 1) # needs sage.rings.function_field - sage: a = 6*x^2 + 5*x + 7 # needs sage.rings.function_field - sage: b = 2*x^6 + 8*x^5 + 3*x^4 - 4*x^3 - 1 # needs sage.rings.function_field - sage: w = y*a/b*x.differential() # needs sage.rings.function_field - sage: d = w.divisor() # needs sage.rings.function_field - sage: sum([QQ(w.residue(p)) for p in d.support()]) # needs sage.rings.function_field + sage: F. = R.extension(Y^2 - x^4 - 4*x^3 - 2*x^2 - 1) + sage: a = 6*x^2 + 5*x + 7 + sage: b = 2*x^6 + 8*x^5 + 3*x^4 - 4*x^3 - 1 + sage: w = y*a/b*x.differential() + sage: d = w.divisor() + sage: sum([QQ(w.residue(p)) for p in d.support()]) 0 """ @@ -517,9 +520,9 @@ class FunctionFieldDifferential_global(FunctionFieldDifferential): EXAMPLES:: - sage: F. = FunctionField(GF(7)) # needs sage.rings.finite_rings - sage: f = x/(x^2 + x + 1) # needs sage.rings.finite_rings - sage: f.differential() # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(7)) + sage: f = x/(x^2 + x + 1) + sage: f.differential() ((6*x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x) :: @@ -546,12 +549,12 @@ def cartier(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: f = x/y # needs sage.rings.function_field - sage: w = 1/f*f.differential() # needs sage.rings.function_field - sage: w.cartier() == w # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: f = x/y + sage: w = 1/f*f.differential() + sage: w.cartier() == w True :: @@ -592,15 +595,15 @@ class DifferentialsSpace(UniqueRepresentation, Parent): element is automatically found and used to generate the base differential relative to which other differentials are denoted:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(5)) sage: R. = K[] - sage: L. = K.extension(y^5 - 1/x) # needs sage.rings.function_field - sage: L(x).differential() # needs sage.rings.function_field + sage: L. = K.extension(y^5 - 1/x) + sage: L(x).differential() 0 - sage: y.differential() # needs sage.rings.function_field + sage: y.differential() d(y) - sage: (y^2).differential() # needs sage.rings.function_field + sage: (y^2).differential() (2*y) d(y) """ Element = FunctionFieldDifferential @@ -611,11 +614,11 @@ def __init__(self, field, category=None): TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _.=K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: W = L.space_of_differentials() # needs sage.rings.function_field - sage: TestSuite(W).run() # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: W = L.space_of_differentials() + sage: TestSuite(W).run() """ Parent.__init__(self, base=field, category=Modules(field).FiniteDimensional().WithBasis().or_subcategory(category)) @@ -638,11 +641,11 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: w = y.differential() # needs sage.rings.function_field - sage: w.parent() # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: w = y.differential() + sage: w.parent() Space of differentials of Function field in y defined by y^3 + x^3*y + x """ return "Space of differentials of {}".format(self.base()) @@ -657,15 +660,15 @@ def _element_constructor_(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: S = L.space_of_differentials() # needs sage.rings.function_field - sage: S(y) # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: S = L.space_of_differentials() + sage: S(y) (x*y^2 + 1/x*y) d(x) - sage: S(y) in S # needs sage.rings.function_field + sage: S(y) in S True - sage: S(1) # needs sage.rings.function_field + sage: S(1) 0 """ if f in self.base(): @@ -700,11 +703,11 @@ def function_field(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: S = L.space_of_differentials() # needs sage.rings.function_field - sage: S.function_field() # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: S = L.space_of_differentials() + sage: S.function_field() Function field in y defined by y^3 + x^3*y + x """ return self.base() @@ -715,11 +718,11 @@ def _an_element_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: S = L.space_of_differentials() # needs sage.rings.function_field - sage: S.an_element() # random # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: S = L.space_of_differentials() + sage: S.an_element() # random (x*y^2 + 1/x*y) d(x) """ F = self.base() @@ -731,11 +734,11 @@ def basis(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: S = L.space_of_differentials() # needs sage.rings.function_field - sage: S.basis() # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: S = L.space_of_differentials() + sage: S.basis() Family (d(x),) """ return Family([self.element_class(self, self.base().one())]) @@ -767,7 +770,7 @@ class DifferentialsSpaceInclusion(Morphism): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OK = K.space_of_differentials() sage: OL = L.space_of_differentials() # needs sage.rings.function_field sage: OL.coerce_map_from(OK) # needs sage.rings.function_field Inclusion morphism: @@ -783,7 +786,7 @@ def _repr_(self): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OK = K.space_of_differentials() sage: OL = L.space_of_differentials() # needs sage.rings.function_field sage: OL.coerce_map_from(OK) # needs sage.rings.function_field Inclusion morphism: @@ -803,7 +806,7 @@ def is_injective(self): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: OK = K.space_of_differentials() # needs sage.rings.function_field + sage: OK = K.space_of_differentials() sage: OL = L.space_of_differentials() # needs sage.rings.function_field sage: OL.coerce_map_from(OK).is_injective() # needs sage.rings.function_field True @@ -816,16 +819,17 @@ def is_surjective(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: OK = K.space_of_differentials() # needs sage.rings.function_field - sage: OL = L.space_of_differentials() # needs sage.rings.function_field - sage: OL.coerce_map_from(OK).is_surjective() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: OK = K.space_of_differentials() + sage: OL = L.space_of_differentials() + sage: OL.coerce_map_from(OK).is_surjective() False - sage: S. = L[] # needs sage.rings.function_field - sage: M. = L.extension(z - 1) # needs sage.rings.function_field - sage: OM = M.space_of_differentials() # needs sage.rings.function_field - sage: OM.coerce_map_from(OL).is_surjective() # needs sage.rings.function_field + sage: S. = L[] + sage: M. = L.extension(z - 1) + sage: OM = M.space_of_differentials() + sage: OM.coerce_map_from(OL).is_surjective() True """ K = self.domain().function_field() @@ -842,13 +846,13 @@ def _call_(self, v): EXAMPLES:: - sage: # needs sage.rings.number_field + sage: # needs sage.rings.function_field sage.rings.number_field sage: K. = FunctionField(QQbar); _. = K[] - sage: L. = K.extension(Y^2 - x*Y + 4*x^3) # needs sage.rings.function_field - sage: OK = K.space_of_differentials() # needs sage.rings.function_field - sage: OL = L.space_of_differentials() # needs sage.rings.function_field - sage: mor = OL.coerce_map_from(OK) # needs sage.rings.function_field - sage: mor(x.differential()).parent() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 - x*Y + 4*x^3) + sage: OK = K.space_of_differentials() + sage: OL = L.space_of_differentials() + sage: mor = OL.coerce_map_from(OK) + sage: mor(x.differential()).parent() Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3 """ domain = self.domain() diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 092b1887bf3..0c5bd09d274 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -325,7 +325,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # needs sage.rings.function_field sage: M. = L.extension(z^3 - y^2*z + x) # needs sage.rings.function_field - sage: x.characteristic_polynomial('W') # needs sage.modules sage.rings.function_field + sage: x.characteristic_polynomial('W') # needs sage.modules W - x sage: y.characteristic_polynomial('W') # needs sage.modules sage.rings.function_field W^2 - x*W + 4*x^3 @@ -346,7 +346,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3); R. = L[] # needs sage.rings.function_field sage: M. = L.extension(z^3 - y^2*z + x) # needs sage.rings.function_field - sage: x.minimal_polynomial('W') # needs sage.modules sage.rings.function_field + sage: x.minimal_polynomial('W') # needs sage.modules W - x sage: y.minimal_polynomial('W') # needs sage.modules sage.rings.function_field W^2 - x*W + 4*x^3 @@ -477,7 +477,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = 1/(x^3 + x^2 + x) - sage: f.divisor() # needs sage.modules sage.rings.finite_rings + sage: f.divisor() # needs sage.libs.pari sage.modules 3*Place (1/x) - Place (x) - Place (x^2 + x + 1) @@ -507,7 +507,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = 1/(x^3 + x^2 + x) - sage: f.divisor_of_zeros() # needs sage.modules sage.rings.finite_rings + sage: f.divisor_of_zeros() # needs sage.libs.pari sage.modules 3*Place (1/x) :: @@ -533,7 +533,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = 1/(x^3 + x^2 + x) - sage: f.divisor_of_poles() # needs sage.modules sage.rings.finite_rings + sage: f.divisor_of_poles() # needs sage.libs.pari sage.modules Place (x) + Place (x^2 + x + 1) @@ -560,7 +560,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = 1/(x^3 + x^2 + x) - sage: f.zeros() # needs sage.modules sage.rings.finite_rings + sage: f.zeros() # needs sage.libs.pari sage.modules [Place (1/x)] :: @@ -580,7 +580,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = 1/(x^3 + x^2 + x) - sage: f.poles() # needs sage.modules sage.rings.finite_rings + sage: f.poles() # needs sage.libs.pari sage.modules [Place (x), Place (x^2 + x + 1)] :: diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index 07d1f0da766..a35ad5ef318 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -59,7 +59,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: ((a+1)/(a-1)).__pari__() # needs sage.rings.finite_rings + sage: ((a+1)/(a-1)).__pari__() # needs sage.libs.pari (a + 1)/(a - 1) """ @@ -77,7 +77,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: type(t.element()) # needs sage.rings.finite_rings <... 'sage.rings.fraction_field_FpT.FpTElement'> - sage: K. = FunctionField(GF(131101)) # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(131101)) # needs sage.libs.pari sage: t.element() t sage: type(t.element()) @@ -298,8 +298,8 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): -3 sage: K. = FunctionField(GF(2)) - sage: p = K.places_finite()[0] # needs sage.rings.finite_rings - sage: (1/x^2).valuation(p) # needs sage.rings.finite_rings + sage: p = K.places_finite()[0] # needs sage.libs.pari + sage: (1/x^2).valuation(p) # needs sage.libs.pari -2 """ from .place import FunctionFieldPlace @@ -328,9 +328,9 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): True sage: K. = FunctionField(GF(5)) - sage: (-t^2).is_square() # needs sage.rings.finite_rings + sage: (-t^2).is_square() # needs sage.libs.pari True - sage: (-t^2).sqrt() # needs sage.rings.finite_rings + sage: (-t^2).sqrt() # needs sage.libs.pari 2*t """ return self._x.is_square() @@ -477,13 +477,13 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: K. = FunctionField(QQ) sage: f = (t+1) / (t^2 - 1/3) - sage: f.factor() # needs sage.rings.finite_rings + sage: f.factor() # needs sage.libs.pari (t + 1) * (t^2 - 1/3)^-1 - sage: (7*f).factor() # needs sage.rings.finite_rings + sage: (7*f).factor() # needs sage.libs.pari (7) * (t + 1) * (t^2 - 1/3)^-1 - sage: ((7*f).factor()).unit() # needs sage.rings.finite_rings + sage: ((7*f).factor()).unit() # needs sage.libs.pari 7 - sage: (f^3).factor() # needs sage.rings.finite_rings + sage: (f^3).factor() # needs sage.libs.pari (t + 1)^3 * (t^2 - 1/3)^-3 """ P = self.parent() diff --git a/src/sage/rings/function_field/extensions.py b/src/sage/rings/function_field/extensions.py index 335293ebdd6..ee415ddf5ff 100644 --- a/src/sage/rings/function_field/extensions.py +++ b/src/sage/rings/function_field/extensions.py @@ -16,11 +16,11 @@ sage: L # needs sage.rings.number_field Rational function field in x over Number Field in a with defining polynomial x^2 - 2 with a = 1.4142... over its base - sage: d = (x^2 - 2).divisor() # needs sage.rings.number_field - sage: d # needs sage.rings.number_field + sage: d = (x^2 - 2).divisor() # needs sage.libs.pari + sage: d # needs sage.libs.pari -2*Place (1/x) + Place (x^2 - 2) - sage: L.conorm_divisor(d) # needs sage.rings.number_field + sage: L.conorm_divisor(d) # needs sage.libs.pari sage.rings.number_field -2*Place (1/x) + Place (x - a) + Place (x + a) diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index ab230b3e76b..5b7c3b5b7cc 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -121,7 +121,7 @@ TESTS:: - sage: TestSuite(J).run() # needs sage.rings.finite_rings + sage: TestSuite(J).run() sage: TestSuite(K).run(max_runs=256) # long time (10s) # needs sage.rings.number_field sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index 63aae7c5835..e6920007298 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -905,7 +905,7 @@ def places(self, degree=1): EXAMPLES:: sage: F. = FunctionField(GF(5)) - sage: F.places() # needs sage.rings.finite_rings + sage: F.places() # needs sage.libs.pari [Place (1/x), Place (x), Place (x + 1), @@ -929,7 +929,7 @@ def places_finite(self, degree=1): EXAMPLES:: sage: F. = FunctionField(GF(5)) - sage: F.places_finite() # needs sage.rings.finite_rings + sage: F.places_finite() # needs sage.libs.pari [Place (x), Place (x + 1), Place (x + 2), Place (x + 3), Place (x + 4)] """ return list(self._places_finite(degree)) diff --git a/src/sage/rings/function_field/ideal_rational.py b/src/sage/rings/function_field/ideal_rational.py index 686fbf4245b..e6abe1ff605 100644 --- a/src/sage/rings/function_field/ideal_rational.py +++ b/src/sage/rings/function_field/ideal_rational.py @@ -207,7 +207,7 @@ def is_prime(self): sage: K. = FunctionField(QQ) sage: O = K.maximal_order() sage: I = O.ideal(x^3 + x^2) - sage: [f.is_prime() for f,m in I.factor()] # needs sage.rings.finite_rings + sage: [f.is_prime() for f,m in I.factor()] # needs sage.libs.pari [True, True] """ return self._gen.denominator() == 1 and self._gen.numerator().is_prime() @@ -296,7 +296,7 @@ def valuation(self, ideal): sage: F. = FunctionField(QQ) sage: O = F.maximal_order() sage: I = O.ideal(x^2*(x^2+x+1)^3) - sage: [f.valuation(I) for f,_ in I.factor()] # needs sage.rings.finite_rings + sage: [f.valuation(I) for f,_ in I.factor()] # needs sage.libs.pari [2, 3] """ if not self.is_prime(): @@ -319,13 +319,13 @@ def _valuation(self, ideal): sage: F. = FunctionField(QQ) sage: O = F.maximal_order() sage: p = O.ideal(x) - sage: p.valuation(O.ideal(x + 1)) # indirect doctest # needs sage.rings.finite_rings + sage: p.valuation(O.ideal(x + 1)) # indirect doctest # needs sage.libs.pari 0 - sage: p.valuation(O.ideal(x^2)) # indirect doctest # needs sage.rings.finite_rings + sage: p.valuation(O.ideal(x^2)) # indirect doctest # needs sage.libs.pari 2 - sage: p.valuation(O.ideal(1/x^3)) # indirect doctest # needs sage.rings.finite_rings + sage: p.valuation(O.ideal(1/x^3)) # indirect doctest # needs sage.libs.pari -3 - sage: p.valuation(O.ideal(0)) # indirect doctest # needs sage.rings.finite_rings + sage: p.valuation(O.ideal(0)) # indirect doctest # needs sage.libs.pari +Infinity """ return ideal.gen().valuation(self.gen()) diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index fb4adf0c5c1..9151a4445f3 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -179,7 +179,7 @@ def ideal_with_gens_over_base(self, gens): sage: O = L.equation_order() # needs sage.rings.function_field sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # needs sage.rings.function_field + sage: y in I True sage: y^2 in I # needs sage.rings.function_field False @@ -476,7 +476,7 @@ def ideal_with_gens_over_base(self, gens): sage: O = L.equation_order() # needs sage.rings.function_field sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # needs sage.rings.function_field + sage: y in I True sage: y^2 in I # needs sage.rings.function_field False diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index f79d0c08d56..9139d9a19e2 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -258,7 +258,7 @@ def __radd__(self, other): sage: k. = GF(2) sage: K. = FunctionField(k) - sage: sum(K.places_finite()) # needs sage.rings.finite_rings + sage: sum(K.places_finite()) # needs sage.libs.pari Place (x) + Place (x + 1) Note that this does not work, as wanted:: From e061052b4ad5572dcc1ecb366ceff2ae1b65a51f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 16:57:49 -0700 Subject: [PATCH 10/20] src/sage/rings/function_field/function_field.py: Remove tag sage.rings.finite_rings when only prime finite fields are used; use more block tags --- .../rings/function_field/function_field.py | 243 +++++++++--------- 1 file changed, 125 insertions(+), 118 deletions(-) diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 5b7c3b5b7cc..187c0bc9c30 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -23,17 +23,17 @@ Then we create an extension of the rational function field, and do some simple arithmetic in it:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: R. = K[] - sage: L. = K.extension(y^3 - (x^3 + 2*x*y + 1/x)); L # needs sage.rings.function_field + sage: L. = K.extension(y^3 - (x^3 + 2*x*y + 1/x)); L Function field in y defined by y^3 + 3*x*y + (4*x^4 + 4)/x - sage: y^2 # needs sage.rings.function_field + sage: y^2 y^2 - sage: y^3 # needs sage.rings.function_field + sage: y^3 2*x*y + (x^4 + 1)/x - sage: a = 1/y; a # needs sage.rings.function_field + sage: a = 1/y; a (x/(x^4 + 1))*y^2 + 3*x^2/(x^4 + 1) - sage: a * y # needs sage.rings.function_field + sage: a * y 1 We next make an extension of the above function field, illustrating @@ -62,61 +62,64 @@ sage: J. = FunctionField(GF(5)); J Rational function field in x over Finite Field of size 5 sage: T. = J[] - sage: O. = J.extension(v^5 - x); O # needs sage.rings.finite_rings sage.rings.function_field + sage: O. = J.extension(v^5 - x); O # needs sage.rings.function_field Function field in v defined by v^5 + 4*x Function fields over the rational field are supported:: + sage: # needs sage.rings.function_field sage: F. = FunctionField(QQ) sage: R. = F[] - sage: L. = F.extension(Y^2 - x^8 - 1) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(x, y - 1) # needs sage.rings.function_field - sage: P = I.place() # needs sage.rings.function_field - sage: D = P.divisor() # needs sage.rings.function_field - sage: D.basis_function_space() # needs sage.rings.function_field + sage: L. = F.extension(Y^2 - x^8 - 1) + sage: O = L.maximal_order() + sage: I = O.ideal(x, y - 1) + sage: P = I.place() + sage: D = P.divisor() + sage: D.basis_function_space() [1] - sage: (2*D).basis_function_space() # needs sage.rings.function_field + sage: (2*D).basis_function_space() [1] - sage: (3*D).basis_function_space() # needs sage.rings.function_field + sage: (3*D).basis_function_space() [1] - sage: (4*D).basis_function_space() # needs sage.rings.function_field + sage: (4*D).basis_function_space() [1, 1/x^4*y + 1/x^4] + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) sage: O = F.maximal_order() - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor() # needs sage.rings.function_field + sage: I = O.ideal(y) + sage: I.divisor() 2*Place (x, y, (1/(x^3 + x^2 + x))*y^2) + 2*Place (x^2 + x + 1, y, (1/(x^3 + x^2 + x))*y^2) + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor() - Place (x, x*y) + Place (x^2 + 1, x*y) Function fields over the algebraic field are supported:: - sage: # needs sage.rings.number_field + sage: # optional - rings.number_field, needs sage.rings.function_field sage: K. = FunctionField(QQbar); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor() Place (x - I, x*y) - Place (x, x*y) + Place (x + I, x*y) - sage: pl = I.divisor().support()[0] # needs sage.rings.function_field - sage: m = L.completion(pl, prec=5) # needs sage.rings.function_field - sage: m(x) # needs sage.rings.function_field + sage: pl = I.divisor().support()[0] + sage: m = L.completion(pl, prec=5) + sage: m(x) I + s + O(s^5) - sage: m(y) # long time (4s) # needs sage.rings.function_field + sage: m(y) # long time (4s) -2*s + (-4 - I)*s^2 + (-15 - 4*I)*s^3 + (-75 - 23*I)*s^4 + (-413 - 154*I)*s^5 + O(s^6) - sage: m(y)^2 + m(y) + m(x) + 1/m(x) # long time (8s) # needs sage.rings.function_field + sage: m(y)^2 + m(y) + m(x) + 1/m(x) # long time (8s) O(s^5) TESTS:: @@ -127,7 +130,7 @@ sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings sage: TestSuite(O).run() # needs sage.rings.function_field sage.rings.number_field - sage: TestSuite(R).run() + sage: TestSuite(R).run() # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field Global function fields @@ -143,33 +146,33 @@ of its maximal order and maximal infinite order, and then do arithmetic with ideals of those maximal orders:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(3)); _. = K[] - sage: L. = K.extension(t^4 + t - x^5) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: O.basis() # needs sage.rings.function_field + sage: L. = K.extension(t^4 + t - x^5) + sage: O = L.maximal_order() + sage: O.basis() (1, y, 1/x*y^2 + 1/x*y, 1/x^3*y^3 + 2/x^3*y^2 + 1/x^3*y) - sage: I = O.ideal(x,y); I # needs sage.rings.function_field + sage: I = O.ideal(x,y); I Ideal (x, y) of Maximal order of Function field in y defined by y^4 + y + 2*x^5 - sage: J = I^-1 # needs sage.rings.function_field - sage: J.basis_matrix() # needs sage.rings.function_field + sage: J = I^-1 + sage: J.basis_matrix() [ 1 0 0 0] [1/x 1/x 0 0] [ 0 0 1 0] [ 0 0 0 1] - sage: L.maximal_order_infinite().basis() # needs sage.rings.function_field + sage: L.maximal_order_infinite().basis() (1, 1/x^2*y, 1/x^3*y^2, 1/x^4*y^3) As an example of the most sophisticated computations that Sage can do with a global function field, we compute all the Weierstrass places of the Klein quartic over `\GF{2}` and gap numbers for ordinary places:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: L.genus() # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: L.genus() 3 - sage: L.weierstrass_places() # needs sage.modules sage.rings.function_field + sage: L.weierstrass_places() # needs sage.modules [Place (1/x, 1/x^3*y^2 + 1/x), Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1), Place (x, y), @@ -180,12 +183,12 @@ Place (x^3 + x^2 + 1, y + x), Place (x^3 + x^2 + 1, y + x^2 + 1), Place (x^3 + x^2 + 1, y + x^2 + x + 1)] - sage: L.gaps() # needs sage.modules sage.rings.function_field + sage: L.gaps() # needs sage.modules [1, 2, 3] The gap numbers for Weierstrass places are of course not ordinary:: - sage: # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.modules sage.rings.function_field sage: p1,p2,p3 = L.weierstrass_places()[:3] sage: p1.gaps() [1, 2, 4] @@ -380,8 +383,8 @@ def characteristic(self): sage: K.characteristic() 7 sage: R. = K[] - sage: L. = K.extension(y^2 - x) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.characteristic() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field + sage: L.characteristic() # needs sage.rings.function_field 7 """ return self.constant_base_field().characteristic() @@ -517,21 +520,22 @@ def order(self, x, check=True): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field - sage: O = L.order(y); O # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) + sage: O = L.order(y); O # needs sage.modules Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # needs sage.modules sage.rings.function_field + sage: O.basis() # needs sage.modules (1, y, y^2) - sage: Z = K.order(x); Z # needs sage.modules + sage: Z = K.order(x); Z # needs sage.modules sage.rings.function_field Order in Rational function field in x over Rational Field - sage: Z.basis() # needs sage.modules + sage: Z.basis() # needs sage.modules sage.rings.function_field (1,) Orders with multiple generators are not yet supported:: - sage: Z = K.order([x, x^2]); Z + sage: Z = K.order([x, x^2]); Z # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError @@ -562,11 +566,12 @@ def order_infinite_with_basis(self, basis, check=True): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field - sage: O = L.order_infinite_with_basis([1, 1/x*y, 1/x^2*y^2]); O # needs sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) + sage: O = L.order_infinite_with_basis([1, 1/x*y, 1/x^2*y^2]); O Infinite order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: O.basis() # needs sage.rings.function_field + sage: O.basis() (1, 1/x*y, 1/x^2*y^2) Note that 1 does not need to be an element of the basis, as long it is @@ -645,15 +650,16 @@ def _coerce_map_from_(self, source): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^3 + x^3 + 4*x + 1) # needs sage.rings.function_field - sage: L.equation_order() # needs sage.rings.function_field + sage: L. = K.extension(y^3 + x^3 + 4*x + 1) + sage: L.equation_order() Order in Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: L._coerce_map_from_(L.equation_order()) # needs sage.rings.function_field + sage: L._coerce_map_from_(L.equation_order()) Conversion map: From: Order in Function field in y defined by y^3 + x^3 + 4*x + 1 To: Function field in y defined by y^3 + x^3 + 4*x + 1 - sage: L._coerce_map_from_(GF(7)) # needs sage.rings.finite_rings sage.rings.function_field + sage: L._coerce_map_from_(GF(7)) sage: K. = FunctionField(QQ) sage: L. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field @@ -662,7 +668,7 @@ def _coerce_map_from_(self, source): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^3 + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^3 + 1) # needs sage.rings.function_field sage: K. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field sage: R. = K[] sage: M. = K.extension(y^3 + 1) # needs sage.rings.function_field @@ -671,9 +677,9 @@ def _coerce_map_from_(self, source): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(I^2 + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(I^2 + 1) # needs sage.rings.function_field sage: M. = FunctionField(GaussianIntegers().fraction_field()) # needs sage.rings.number_field - sage: M.has_coerce_map_from(L) # needs sage.rings.finite_rings sage.rings.function_field sage.rings.number_field + sage: M.has_coerce_map_from(L) # needs sage.rings.function_field sage.rings.number_field True Check that :trac:`31072` is fixed:: @@ -938,9 +944,10 @@ def valuation(self, prime): applying the substitution `x \mapsto 1/x` (here, the inverse map is also `x \mapsto 1/x`):: - sage: w = valuations.GaussValuation(R, QQ.valuation(2)).augmentation(x, 1) # needs sage.rings.function_field - sage: w = K.valuation(w) # needs sage.rings.function_field - sage: v = K.valuation((w, K.hom([~K.gen()]), K.hom([~K.gen()]))); v # needs sage.rings.function_field + sage: # needs sage.rings.function_field + sage: w = valuations.GaussValuation(R, QQ.valuation(2)).augmentation(x, 1) + sage: w = K.valuation(w) + sage: v = K.valuation((w, K.hom([~K.gen()]), K.hom([~K.gen()]))); v Valuation on rational function field induced by [ Gauss valuation induced by 2-adic valuation, v(x) = 1 ] (in Rational function field in x over Rational Field after x |--> 1/x) @@ -948,7 +955,7 @@ def valuation(self, prime): Note that classical valuations at finite places or the infinite place are always normalized such that the uniformizing element has valuation 1:: - sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(3)) sage: M. = FunctionField(K) sage: v = M.valuation(x^3 - t) @@ -960,17 +967,17 @@ def valuation(self, prime): extension of ``v`` to ``L`` still has valuation 1 on `x^3 - t` but it has valuation ``1/3`` on its uniformizing element `x - w`:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: R. = K[] - sage: L. = K.extension(w^3 - t) # needs sage.rings.function_field - sage: N. = FunctionField(L) # needs sage.rings.function_field - sage: w = v.extension(N) # missing factorization, :trac:`16572` # needs sage.rings.function_field + sage: L. = K.extension(w^3 - t) + sage: N. = FunctionField(L) + sage: w = v.extension(N) # missing factorization, :trac:`16572` Traceback (most recent call last): ... NotImplementedError - sage: w(x^3 - t) # not tested # needs sage.rings.function_field + sage: w(x^3 - t) # not tested 1 - sage: w(x - w) # not tested # needs sage.rings.function_field + sage: w(x - w) # not tested 1/3 There are several ways to create valuations on extensions of rational @@ -1001,8 +1008,8 @@ def space_of_differentials(self): Space of differentials of Rational function field in t over Rational Field sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.function_field + sage: L.space_of_differentials() # needs sage.modules sage.rings.function_field Space of differentials of Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) """ @@ -1025,8 +1032,8 @@ def space_of_holomorphic_differentials(self): To: Vector space of dimension 0 over Rational Field) sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.space_of_holomorphic_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.function_field + sage: L.space_of_holomorphic_differentials() # needs sage.modules sage.rings.function_field (Vector space of dimension 4 over Finite Field of size 5, Linear map: From: Vector space of dimension 4 over Finite Field of size 5 @@ -1052,8 +1059,8 @@ def basis_of_holomorphic_differentials(self): [] sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.basis_of_holomorphic_differentials() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.function_field + sage: L.basis_of_holomorphic_differentials() # needs sage.modules sage.rings.function_field [((x/(x^3 + 4))*y) d(x), ((1/(x^3 + 4))*y) d(x), ((x/(x^3 + 4))*y^2) d(x), @@ -1079,8 +1086,8 @@ def divisor_group(self): Divisor group of Function field in y defined by y^3 + (-t^3 + 1)/(t^3 - 2) sage: K. = FunctionField(GF(5)); _. = K[] - sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.divisor_group() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 - (x^3 - 1)/(x^3 - 2)) # needs sage.rings.function_field + sage: L.divisor_group() # needs sage.modules sage.rings.function_field Divisor group of Function field in y defined by y^3 + (4*x^3 + 1)/(x^3 + 3) """ from .divisor import DivisorGroup @@ -1101,8 +1108,8 @@ def place_set(self): Set of places of Rational function field in t over Rational Field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: L.place_set() # needs sage.rings.function_field Set of places of Function field in y defined by y^2 + y + (x^2 + 1)/x """ from .place import PlaceSet @@ -1126,33 +1133,32 @@ def completion(self, place, name=None, prec=None, gen_name=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p); m # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p); m Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x, 10) # needs sage.rings.function_field + sage: m(x, 10) s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + O(s^12) - sage: m(y, 10) # needs sage.rings.function_field + sage: m(y, 10) s^-1 + 1 + s^3 + s^5 + s^7 + O(s^9) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p = L.places_finite()[0] # needs sage.rings.function_field - sage: m = L.completion(p); m # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p = L.places_finite()[0] + sage: m = L.completion(p); m Completion map: From: Function field in y defined by y^2 + y + (x^2 + 1)/x To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x, 10) # needs sage.rings.function_field + sage: m(x, 10) s^2 + s^3 + s^4 + s^5 + s^7 + s^8 + s^9 + s^10 + O(s^12) - sage: m(y, 10) # needs sage.rings.function_field + sage: m(y, 10) s^-1 + 1 + s^3 + s^5 + s^7 + O(s^9) - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: p = K.places_finite()[0]; p Place (x) @@ -1164,36 +1170,37 @@ def completion(self, place, name=None, prec=None, gen_name=None): 1 + s + s^2 + s^3 + s^4 + s^5 + s^6 + s^7 + s^8 + s^9 + s^10 + s^11 + s^12 + s^13 + s^14 + s^15 + s^16 + s^17 + s^18 + s^19 + O(s^20) - sage: p = K.place_infinite(); p # needs sage.rings.finite_rings + sage: p = K.place_infinite(); p Place (1/x) - sage: m = K.completion(p); m # needs sage.rings.finite_rings + sage: m = K.completion(p); m Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x) # needs sage.rings.finite_rings + sage: m(x) s^-1 + O(s^19) - sage: m = K.completion(p, prec=infinity); m # needs sage.rings.finite_rings + sage: m = K.completion(p, prec=infinity); m Completion map: From: Rational function field in x over Finite Field of size 2 To: Lazy Laurent Series Ring in s over Finite Field of size 2 - sage: f = m(x); f # needs sage.rings.finite_rings + sage: f = m(x); f s^-1 + ... - sage: f.coefficient(100) # needs sage.rings.finite_rings + sage: f.coefficient(100) 0 + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 - x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: decomp = O.decomposition(K.maximal_order().ideal(x - 1)) # needs sage.rings.function_field - sage: pls = (decomp[0][0].place(), decomp[1][0].place()) # needs sage.rings.function_field - sage: m = L.completion(pls[0]); m # needs sage.rings.function_field + sage: L. = K.extension(Y^2 - x) + sage: O = L.maximal_order() + sage: decomp = O.decomposition(K.maximal_order().ideal(x - 1)) + sage: pls = (decomp[0][0].place(), decomp[1][0].place()) + sage: m = L.completion(pls[0]); m Completion map: From: Function field in y defined by y^2 - x To: Laurent Series Ring in s over Rational Field - sage: xe = m(x) # needs sage.rings.function_field - sage: ye = m(y) # needs sage.rings.function_field - sage: ye^2 - xe == 0 # needs sage.rings.function_field + sage: xe = m(x) + sage: ye = m(y) + sage: ye^2 - xe == 0 True sage: # needs sage.rings.function_field @@ -1222,13 +1229,13 @@ def extension_constant_field(self, k): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: F. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^4)) # needs sage.rings.function_field - sage: E # needs sage.rings.function_field + sage: F. = K.extension(Y^2 + Y + x + 1/x) + sage: E = F.extension_constant_field(GF(2^4)) + sage: E Function field in y defined by y^2 + y + (x^2 + 1)/x over its base - sage: E.constant_base_field() # needs sage.rings.function_field + sage: E.constant_base_field() Finite Field in z4 of size 2^4 """ from .extensions import ConstantFieldExtension From 9736edd51d2e6ae6024cd9ffd4acc8bb50b3bc62 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 17:19:13 -0700 Subject: [PATCH 11/20] src/sage/rings/function_field/ideal.py: Remove tag sage.rings.finite_rings when only prime finite fields are used; use more block tags --- src/sage/rings/function_field/ideal.py | 427 +++++++++++++------------ 1 file changed, 220 insertions(+), 207 deletions(-) diff --git a/src/sage/rings/function_field/ideal.py b/src/sage/rings/function_field/ideal.py index 107b0648942..22c6fb7539b 100644 --- a/src/sage/rings/function_field/ideal.py +++ b/src/sage/rings/function_field/ideal.py @@ -166,26 +166,27 @@ def _repr_(self): sage: I = O.ideal(x, 1/(x+1)); I Ideal (1/(x + 1)) of Maximal order of Rational function field in x over Rational Field + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.finite_rings sage.rings.function_field - sage: O.ideal(x^2 + 1) # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: O.ideal(x^2 + 1) Ideal (x^2 + 1) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 - x^3*Y - x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y); I # needs sage.rings.function_field + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y); I Ideal (y) of Maximal order of Function field in y defined by y^2 + x^3*y + x - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.finite_rings sage.rings.function_field - sage: I = O.ideal(y); I # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y); I Ideal (y) of Maximal order of Function field in y defined by y^2 + y + (x^2 + 1)/x - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal(x/(x^2+1)) @@ -193,19 +194,19 @@ def _repr_(self): Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field of size 2 - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(3^2)); _. = PolynomialRing(K) - sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field - sage: Oinf.ideal(1/y) # needs sage.rings.function_field + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: Oinf.ideal(1/y) Ideal (1/x^4*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4 - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: Oinf = L.maximal_order_infinite() # needs sage.rings.function_field - sage: Oinf.ideal(1/y) # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: Oinf.ideal(1/y) Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x """ @@ -220,12 +221,12 @@ def _latex_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 - x^3*Y - x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: latex(I) # needs sage.rings.function_field + sage: L. = K.extension(Y^2 - x^3*Y - x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: latex(I) \left(y\right) """ return '\\left(' + ', '.join(latex(g) for g in self.gens_reduced()) + '\\right)' @@ -240,7 +241,6 @@ def _div_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)) sage: O = K.equation_order() sage: I = O.ideal(x^3 + 1) @@ -265,7 +265,6 @@ def gens_reduced(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)) sage: O = K.equation_order() sage: I = O.ideal(x, x^2, x^2 + x) @@ -288,7 +287,6 @@ def ring(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)) sage: O = K.equation_order() sage: I = O.ideal(x, x^2, x^2 + x) @@ -303,11 +301,12 @@ def base_ring(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field - sage: I.base_ring() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.base_ring() Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring() @@ -330,7 +329,6 @@ def place(self): sage: I.place() Place (x^3 + x + 1) - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) @@ -338,49 +336,49 @@ def place(self): sage: p.place() Place (1/x) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: [f.place() for f,_ in I.factor()] # needs sage.rings.function_field + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: [f.place() for f,_ in I.factor()] [Place (x, (1/(x^3 + x^2 + x))*y^2), Place (x^2 + x + 1, (1/(x^3 + x^2 + x))*y^2)] - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: [f.place() for f,_ in I.factor()] # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: [f.place() for f,_ in I.factor()] [Place (x, x*y), Place (x + 1, x*y)] - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(3^2)); R. = PolynomialRing(K) - sage: F. = K.extension(t^3 + t^2 - x^4) # needs sage.rings.function_field - sage: Oinf = F.maximal_order_infinite() # needs sage.rings.function_field - sage: I = Oinf.ideal(1/x) # needs sage.rings.function_field - sage: I.factor() # needs sage.rings.function_field + sage: F. = K.extension(t^3 + t^2 - x^4) + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x^3*y^2) of Maximal infinite order of Function field in y defined by y^3 + y^2 + 2*x^4)^3 - sage: J = I.factor()[0][0] # needs sage.rings.function_field - sage: J.is_prime() # needs sage.rings.function_field + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.place() # needs sage.rings.function_field + sage: J.place() Place (1/x, 1/x^3*y^2) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: Oinf = L.maximal_order_infinite() # needs sage.rings.function_field - sage: I = Oinf.ideal(1/x) # needs sage.rings.function_field - sage: I.factor() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(1/x) + sage: I.factor() (Ideal (1/x*y) of Maximal infinite order of Function field in y defined by y^2 + y + (x^2 + 1)/x)^2 - sage: J = I.factor()[0][0] # needs sage.rings.function_field - sage: J.is_prime() # needs sage.rings.function_field + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.place() # needs sage.rings.function_field + sage: J.place() Place (1/x, 1/x*y) """ if not self.is_prime(): @@ -408,21 +406,22 @@ def factor(self): (Ideal (x + 1) of Maximal order of Rational function field in x over Finite Field in z2 of size 2^2)^2 - sage: Oinf = K.maximal_order_infinite() # needs sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # needs sage.rings.finite_rings - sage: I.factor() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) + sage: I.factor() (Ideal (1/x) of Maximal infinite order of Rational function field in x over Finite Field in z2 of size 2^2)^2 - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) - sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I == I.factor().prod() # needs sage.rings.function_field + sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: I == I.factor().prod() True - sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field sage: Oinf = F.maximal_order_infinite() sage: f= 1/x sage: I = Oinf.ideal(f) @@ -432,18 +431,20 @@ def factor(self): (Ideal ((1/(x^4 + x^3 + x^2))*y^2 + 1) of Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2) + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I == I.factor().prod() # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: I == I.factor().prod() True + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I == I.factor().prod() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I == I.factor().prod() True """ @@ -462,38 +463,41 @@ def divisor(self): sage: I.divisor() Place (x) + 2*Place (x + 1) - Place (x + z2) - Place (x + z2 + 1) - sage: Oinf = K.maximal_order_infinite() # needs sage.rings.finite_rings - sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) # needs sage.rings.finite_rings - sage: I.divisor() # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: Oinf = K.maximal_order_infinite() + sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) + sage: I.divisor() 2*Place (1/x) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = PolynomialRing(K) - sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor() # needs sage.rings.function_field + sage: F. = K.extension(T^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor() 2*Place (x, (1/(x^3 + x^2 + x))*y^2) + 2*Place (x^2 + x + 1, (1/(x^3 + x^2 + x))*y^2) - sage: Oinf = F.maximal_order_infinite() # needs sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(y) # needs sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: Oinf = F.maximal_order_infinite() + sage: I = Oinf.ideal(y) + sage: I.divisor() -2*Place (1/x, 1/x^4*y^2 + 1/x^2*y + 1) - 2*Place (1/x, 1/x^2*y + 1) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor() - Place (x, x*y) + 2*Place (x + 1, x*y) - sage: Oinf = L.maximal_order_infinite() # needs sage.rings.finite_rings sage.rings.function_field - sage: I = Oinf.ideal(y) # needs sage.rings.finite_rings sage.rings.function_field - sage: I.divisor() # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: Oinf = L.maximal_order_infinite() + sage: I = Oinf.ideal(y) + sage: I.divisor() - Place (1/x, 1/x*y) """ from .divisor import divisor @@ -518,19 +522,18 @@ def divisor_of_zeros(self): sage: I.divisor_of_zeros() Place (x) + 2*Place (x + 1) - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) sage: I.divisor_of_zeros() 2*Place (1/x) - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor_of_zeros() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor_of_zeros() 2*Place (x + 1, x*y) """ from .divisor import divisor @@ -555,19 +558,18 @@ def divisor_of_poles(self): sage: I.divisor_of_poles() Place (x + z2) + Place (x + z2 + 1) - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) sage: I.divisor_of_poles() 0 - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I.divisor_of_poles() # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I.divisor_of_poles() Place (x, x*y) """ from .divisor import divisor @@ -595,13 +597,14 @@ class FunctionFieldIdeal_module(FunctionFieldIdeal, Ideal_generic): An ideal in an extension of a rational function field:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: I Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: I^2 # needs sage.rings.function_field + sage: I^2 Ideal (x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ def __init__(self, ring, module): @@ -610,11 +613,12 @@ def __init__(self, ring, module): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: TestSuite(I).run() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdeal.__init__(self, ring) @@ -633,16 +637,17 @@ def __contains__(self, x): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y); I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y); I Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: y in I # needs sage.rings.function_field + sage: y in I True - sage: y/x in I # needs sage.rings.function_field + sage: y/x in I False - sage: y^2 - 2 in I # needs sage.rings.function_field + sage: y^2 - 2 in I False """ return self._structure[2](x) in self._module @@ -653,11 +658,12 @@ def __hash__(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: d = {I: 1} # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: d = {I: 1} # indirect doctest """ return hash((self._ring,self._module)) @@ -667,19 +673,20 @@ def _richcmp_(self, other, op): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(x, y); J = O.ideal(y^2 - 2) # needs sage.rings.function_field - sage: I + J == J + I # indirect test # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(x, y); J = O.ideal(y^2 - 2) + sage: I + J == J + I # indirect test True - sage: I + I == I # indirect doctest # needs sage.rings.function_field + sage: I + I == I # indirect doctest True - sage: I == J # needs sage.rings.function_field + sage: I == J False - sage: I < J # needs sage.rings.function_field + sage: I < J True - sage: J < I # needs sage.rings.function_field + sage: J < I False """ return richcmp(self.module().basis(), other.module().basis(), op) @@ -698,21 +705,22 @@ def module(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order(); O # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order(); O Order in Function field in y defined by y^2 - x^3 - 1 - sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field - sage: I.gens() # needs sage.rings.function_field + sage: I = O.ideal(x^2 + 1) + sage: I.gens() (x^2 + 1, (x^2 + 1)*y) - sage: I.module() # needs sage.rings.function_field + sage: I.module() Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Rational Field Echelon basis matrix: [x^2 + 1 0] [ 0 x^2 + 1] - sage: V, from_V, to_V = L.vector_space(); V # needs sage.rings.function_field + sage: V, from_V, to_V = L.vector_space(); V Vector space of dimension 2 over Rational function field in x over Rational Field - sage: I.module().is_submodule(V) # needs sage.rings.function_field + sage: I.module().is_submodule(V) True """ return self._module @@ -723,11 +731,12 @@ def gens(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field - sage: I.gens() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.gens() (x^2 + 1, (x^2 + 1)*y) """ return self._gens @@ -738,11 +747,12 @@ def gen(self, i): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field - sage: I.gen(1) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.gen(1) (x^2 + 1)*y """ return self._gens[i] @@ -753,11 +763,12 @@ def ngens(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(x^2 + 1) # needs sage.rings.function_field - sage: I.ngens() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.ngens() 2 """ return len(self._gens) @@ -768,12 +779,13 @@ def _add_(self, other): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: J = O.ideal(x+y) # needs sage.rings.function_field - sage: I + J # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x+y) + sage: I + J Ideal ((-x^2 + x)*y + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal(self.gens() + other.gens()) @@ -784,12 +796,13 @@ def _mul_(self, other): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: J = O.ideal(x+y) # needs sage.rings.function_field - sage: I * J # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: J = O.ideal(x+y) + sage: I * J Ideal ((-x^5 + x^4 - x^2 + x)*y + x^3 + 1, (x^3 - x^2 + 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal([x*y for x in self.gens() for y in other.gens()]) @@ -800,11 +813,12 @@ def _acted_upon_(self, other, on_left): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: x * I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: x * I Ideal (x^4 + x, -x*y) of Order in Function field in y defined by y^2 - x^3 - 1 """ return self.ring().ideal([other * x for x in self.gens()]) @@ -815,15 +829,16 @@ def intersection(self, other): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y^3); J = O.ideal(y^2) # needs sage.rings.function_field - sage: Z = I.intersection(J); Z # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y^3); J = O.ideal(y^2) + sage: Z = I.intersection(J); Z Ideal (x^6 + 2*x^3 + 1, (-x^3 - 1)*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: y^2 in Z # needs sage.rings.function_field + sage: y^2 in Z False - sage: y^3 in Z # needs sage.rings.function_field + sage: y^3 in Z True """ if not isinstance(other, FunctionFieldIdeal): @@ -845,15 +860,16 @@ def __invert__(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: ~I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: ~I Ideal (-1, (1/(x^3 + 1))*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: I^-1 # needs sage.rings.function_field + sage: I^-1 Ideal (-1, (1/(x^3 + 1))*y) of Order in Function field in y defined by y^2 - x^3 - 1 - sage: ~I * I # needs sage.rings.function_field + sage: ~I * I Ideal (1) of Order in Function field in y defined by y^2 - x^3 - 1 """ if len(self.gens()) == 0: @@ -891,10 +907,11 @@ class FunctionFieldIdealInfinite_module(FunctionFieldIdealInfinite, Ideal_generi EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.ideal(y) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: O.ideal(y) Ideal (x^3 + 1, -y) of Order in Function field in y defined by y^2 - x^3 - 1 """ def __init__(self, ring, module): @@ -903,11 +920,12 @@ def __init__(self, ring, module): TESTS:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal(y) # needs sage.rings.function_field - sage: TestSuite(I).run() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdealInfinite.__init__(self, ring) @@ -931,17 +949,17 @@ def __contains__(self, x): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([1, y]); I Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: y in I # needs sage.rings.function_field + sage: y in I True - sage: y/x in I # needs sage.rings.function_field + sage: y/x in I False - sage: y^2 - 2 in I # needs sage.rings.function_field + sage: y^2 - 2 in I True """ return self._structure[2](x) in self._module @@ -952,12 +970,12 @@ def __hash__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]) # needs sage.rings.function_field - sage: d = {I: 2} # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([1, y]) + sage: d = {I: 2} # indirect doctest """ return hash((self._ring,self._module)) @@ -971,12 +989,12 @@ def __eq__(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([1, y]) # needs sage.rings.function_field - sage: I == I + I # indirect doctest # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([1, y]) + sage: I == I + I # indirect doctest True """ if not isinstance(other, FunctionFieldIdeal_module): @@ -1000,7 +1018,6 @@ def module(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)) sage: O = K.maximal_order(); O Maximal order of Rational function field in x over Finite Field of size 7 @@ -1043,7 +1060,6 @@ def __init__(self, R): TESTS:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: O = K.maximal_order() sage: M = O.ideal_monoid() @@ -1087,7 +1103,6 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: O = K.maximal_order() sage: M = O.ideal_monoid() @@ -1108,7 +1123,6 @@ def _coerce_map_from_(self, x): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: O = K.maximal_order() sage: M = O.ideal_monoid() @@ -1128,7 +1142,6 @@ def _an_element_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: O = K.maximal_order() sage: M = O.ideal_monoid() From 79d2b427f53df5c3e1f8e27374e9c11070718d4f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 18:12:36 -0700 Subject: [PATCH 12/20] src/sage/rings/function_field: Remove tag sage.rings.finite_rings when only prime finite fields are used; use more block tags --- src/sage/rings/function_field/derivations.py | 1 - .../function_field/derivations_polymod.py | 56 +++++-------- src/sage/rings/function_field/differential.py | 6 +- src/sage/rings/function_field/element.pyx | 32 ++++---- .../rings/function_field/element_polymod.pyx | 3 - .../rings/function_field/element_rational.pyx | 9 ++- src/sage/rings/function_field/extensions.py | 78 +++++++++---------- .../rings/function_field/function_field.py | 10 +-- .../function_field/function_field_rational.py | 46 ++++++----- 9 files changed, 107 insertions(+), 134 deletions(-) diff --git a/src/sage/rings/function_field/derivations.py b/src/sage/rings/function_field/derivations.py index bca44bbe5f7..a070738e448 100644 --- a/src/sage/rings/function_field/derivations.py +++ b/src/sage/rings/function_field/derivations.py @@ -4,7 +4,6 @@ For global function fields, which have positive characteristics, the higher derivation is available:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: h = L.higher_derivation() # needs sage.rings.function_field diff --git a/src/sage/rings/function_field/derivations_polymod.py b/src/sage/rings/function_field/derivations_polymod.py index 18790c3ab1e..2e0fe91a968 100644 --- a/src/sage/rings/function_field/derivations_polymod.py +++ b/src/sage/rings/function_field/derivations_polymod.py @@ -176,7 +176,6 @@ def __init__(self, parent, u=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 - x) @@ -184,7 +183,6 @@ def __init__(self, parent, u=None): This also works for iterated non-monic extensions:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 - 1/x) @@ -195,7 +193,7 @@ def __init__(self, parent, u=None): We can also create a multiple of the canonical derivation:: - sage: M.derivation([x]) # needs sage.rings.finite_rings + sage: M.derivation([x]) x*d/dz """ FunctionFieldDerivation.__init__(self, parent) @@ -221,7 +219,6 @@ def _call_(self, x): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 - x) @@ -245,7 +242,6 @@ def _add_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: R. = K[] sage: L. = K.extension(y^3 - x) @@ -263,7 +259,6 @@ def _lmul_(self, factor): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 - x) @@ -286,8 +281,8 @@ class FunctionFieldHigherDerivation(Map): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: F.higher_derivation() # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: F.higher_derivation() Higher derivation map: From: Rational function field in x over Finite Field of size 2 To: Rational function field in x over Finite Field of size 2 @@ -316,9 +311,9 @@ def _repr_type(self) -> str: EXAMPLES:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: h = F.higher_derivation() # needs sage.rings.finite_rings - sage: h # indirect doctest # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h # indirect doctest Higher derivation map: From: Rational function field in x over Finite Field of size 2 To: Rational function field in x over Finite Field of size 2 @@ -331,9 +326,9 @@ def __eq__(self, other) -> bool: TESTS:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: h = F.higher_derivation() # needs sage.rings.finite_rings - sage: loads(dumps(h)) == h # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: loads(dumps(h)) == h True """ if isinstance(other, FunctionFieldHigherDerivation): @@ -349,9 +344,9 @@ def _pth_root_in_prime_field(e): sage: from sage.rings.function_field.derivations_polymod import _pth_root_in_prime_field sage: p = 5 - sage: F. = GF(p) # needs sage.rings.finite_rings - sage: e = F.random_element() # needs sage.rings.finite_rings - sage: _pth_root_in_prime_field(e)^p == e # needs sage.rings.finite_rings + sage: F. = GF(p) + sage: e = F.random_element() + sage: _pth_root_in_prime_field(e)^p == e True """ return e @@ -383,7 +378,6 @@ class RationalFunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(2)) sage: h = F.higher_derivation() sage: h @@ -399,9 +393,9 @@ def __init__(self, field): TESTS:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: h = F.higher_derivation() # needs sage.rings.finite_rings - sage: TestSuite(h).run(skip='_test_category') # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: TestSuite(h).run(skip='_test_category') """ FunctionFieldHigherDerivation.__init__(self, field) @@ -414,9 +408,9 @@ def _call_with_args(self, f, args=(), kwds={}): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: h = F.higher_derivation() # needs sage.rings.finite_rings - sage: h(x^2, 2) # indirect doctest # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h(x^2, 2) # indirect doctest 1 """ return self._derive(f, *args, **kwds) @@ -430,7 +424,6 @@ def _derive(self, f, i, separating_element=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(2)) sage: h = F.higher_derivation() sage: h._derive(x^3, 0) @@ -498,7 +491,6 @@ def _prime_power_representation(self, f, separating_element=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(2)) sage: h = F.higher_derivation() sage: h._prime_power_representation(x^2 + x + 1) @@ -549,9 +541,9 @@ def _pth_root(self, c): EXAMPLES:: - sage: F. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: h = F.higher_derivation() # needs sage.rings.finite_rings - sage: h._pth_root((x^2+1)^2) # needs sage.rings.finite_rings + sage: F. = FunctionField(GF(2)) + sage: h = F.higher_derivation() + sage: h._pth_root((x^2+1)^2) x^2 + 1 """ K = self._field @@ -578,7 +570,6 @@ class FunctionFieldHigherDerivation_global(FunctionFieldHigherDerivation): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() @@ -596,7 +587,6 @@ def __init__(self, field): TESTS:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() @@ -625,7 +615,6 @@ def _call_with_args(self, f, args, kwds): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() @@ -643,7 +632,6 @@ def _derive(self, f, i, separating_element=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() @@ -743,7 +731,6 @@ def _prime_power_representation(self, f, separating_element=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() @@ -790,7 +777,6 @@ def _pth_root(self, c): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) sage: h = L.higher_derivation() diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index 0b3063c6a1f..7102f56f6b6 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -105,7 +105,6 @@ def __init__(self, parent, f, t=None): TESTS:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(7)) sage: f = x/(x^2 + x + 1) sage: w = f.differential() @@ -173,10 +172,9 @@ def __hash__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: {x.differential(): 1} # needs sage.rings.function_field + sage: {x.differential(): 1} {d(x): 1} sage: {y.differential(): 1} # needs sage.rings.function_field {(x*y^2 + 1/x*y) d(x): 1} @@ -411,7 +409,6 @@ def valuation(self, place): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(5)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: w = (1/y) * y.differential() # needs sage.rings.function_field @@ -502,7 +499,6 @@ def monomial_coefficients(self, copy=True): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(5)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: d = y.differential() # needs sage.rings.function_field diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 0c5bd09d274..0006f0da07d 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -28,8 +28,8 @@ Derivatives of elements in separable extensions:: The divisor of an element of a global function field:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field - sage: y.divisor() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: y.divisor() # needs sage.rings.function_field - Place (1/x, 1/x*y) - Place (x, x*y) + 2*Place (x + 1, x*y) @@ -399,18 +399,17 @@ cdef class FunctionFieldElement(FieldElement): Verify that :trac:`27712` is resolved:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(31)) sage: R. = K[] sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field sage: R. = L[] # needs sage.rings.function_field sage: M. = L.extension(z^2 - y) # needs sage.rings.function_field - sage: x.differential() # needs sage.modules sage.rings.finite_rings + sage: x.differential() # needs sage.modules d(x) - sage: y.differential() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: y.differential() # needs sage.modules sage.rings.function_field (16/x*y) d(x) - sage: z.differential() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: z.differential() # needs sage.modules sage.rings.function_field (8/x*z) d(x) """ F = self.parent() @@ -455,7 +454,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(2)) sage: f = t^2 - sage: f.higher_derivative(2) # needs sage.modules sage.rings.finite_rings + sage: f.higher_derivative(2) # needs sage.modules sage.rings.function_field 1 :: @@ -485,8 +484,8 @@ cdef class FunctionFieldElement(FieldElement): :: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field - sage: y.divisor() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field + sage: y.divisor() # needs sage.modules sage.rings.function_field - Place (1/x, 1/x*y) - Place (x, x*y) + 2*Place (x + 1, x*y) @@ -602,7 +601,6 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field sage: p = L.places_infinite()[0] # needs sage.modules sage.rings.function_field @@ -638,7 +636,6 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(5)) sage: p = K.place_infinite() sage: f = 1/t^2 + 3 @@ -647,16 +644,16 @@ cdef class FunctionFieldElement(FieldElement): :: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: p, = L.places_infinite() # needs sage.rings.function_field - sage: p, = L.places_infinite() # needs sage.rings.function_field - sage: (y + x).evaluate(p) # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: p, = L.places_infinite() + sage: p, = L.places_infinite() + sage: (y + x).evaluate(p) Traceback (most recent call last): ... ValueError: has a pole at the place - sage: (y/x + 1).evaluate(p) # needs sage.rings.function_field + sage: (y/x + 1).evaluate(p) 1 """ R, _, to_R = place._residue_field() @@ -715,7 +712,6 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: R. = K[] sage: L. = K.extension(y^2 - x) # needs sage.rings.function_field diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index 2d8adccb476..9e198d0b042 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -276,7 +276,6 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: R. = K[] sage: L. = K.extension(y^2 - x) @@ -287,7 +286,6 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): This also works for inseparable extensions:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: R. = K[] sage: L. = K.extension(y^3 - x^2) @@ -377,7 +375,6 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: R. = K[] sage: L. = K.extension(y^2 - x) diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index a35ad5ef318..0d306d6826e 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -475,15 +475,16 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): EXAMPLES:: + sage: # needs sage.libs.pari sage: K. = FunctionField(QQ) sage: f = (t+1) / (t^2 - 1/3) - sage: f.factor() # needs sage.libs.pari + sage: f.factor() (t + 1) * (t^2 - 1/3)^-1 - sage: (7*f).factor() # needs sage.libs.pari + sage: (7*f).factor() (7) * (t + 1) * (t^2 - 1/3)^-1 - sage: ((7*f).factor()).unit() # needs sage.libs.pari + sage: ((7*f).factor()).unit() 7 - sage: (f^3).factor() # needs sage.libs.pari + sage: (f^3).factor() (t + 1)^3 * (t^2 - 1/3)^-3 """ P = self.parent() diff --git a/src/sage/rings/function_field/extensions.py b/src/sage/rings/function_field/extensions.py index ee415ddf5ff..320f8052b18 100644 --- a/src/sage/rings/function_field/extensions.py +++ b/src/sage/rings/function_field/extensions.py @@ -27,21 +27,21 @@ Constant field extension of a function field over a finite field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: E # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: E Function field in y defined by y^3 + x^6 + x^4 + x^2 over its base - sage: p = F.get_place(3) # needs sage.rings.function_field - sage: E.conorm_place(p) # random # needs sage.rings.function_field + sage: p = F.get_place(3) + sage: E.conorm_place(p) # random Place (x + z3, y + z3^2 + z3) + Place (x + z3^2, y + z3) + Place (x + z3^2 + z3, y + z3^2) - sage: q = F.get_place(2) # needs sage.rings.function_field - sage: E.conorm_place(q) # random # needs sage.rings.function_field + sage: q = F.get_place(2) + sage: E.conorm_place(q) # random Place (x + 1, y^2 + y + 1) - sage: E.conorm_divisor(p + q) # random # needs sage.rings.function_field + sage: E.conorm_divisor(p + q) # random Place (x + 1, y^2 + y + 1) + Place (x + z3, y + z3^2 + z3) + Place (x + z3^2, y + z3) @@ -91,11 +91,11 @@ def __init__(self, F, k_ext): TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: TestSuite(E).run(skip=['_test_elements', '_test_pickling']) # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: TestSuite(E).run(skip=['_test_elements', '_test_pickling']) """ k = F.constant_base_field() F_base = F.base_field() @@ -131,11 +131,11 @@ def top(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: E.top() # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: E.top() Function field in y defined by y^3 + x^6 + x^4 + x^2 """ return self._F_ext @@ -148,11 +148,11 @@ def defining_morphism(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: E.defining_morphism() # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: E.defining_morphism() Function Field morphism: From: Function field in y defined by y^3 + x^6 + x^4 + x^2 To: Function field in y defined by y^3 + x^6 + x^4 + x^2 @@ -174,17 +174,17 @@ def conorm_place(self, p): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: p = F.get_place(3) # needs sage.rings.function_field - sage: d = E.conorm_place(p) # needs sage.rings.function_field - sage: [pl.degree() for pl in d.support()] # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: p = F.get_place(3) + sage: d = E.conorm_place(p) + sage: [pl.degree() for pl in d.support()] [1, 1, 1] - sage: p = F.get_place(2) # needs sage.rings.function_field - sage: d = E.conorm_place(p) # needs sage.rings.function_field - sage: [pl.degree() for pl in d.support()] # needs sage.rings.function_field + sage: p = F.get_place(2) + sage: d = E.conorm_place(p) + sage: [pl.degree() for pl in d.support()] [2] """ embedF = self.defining_morphism() @@ -211,16 +211,16 @@ def conorm_divisor(self, d): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings sage.rings.function_field sage: K. = FunctionField(GF(2)); R. = K[] - sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.function_field - sage: E = F.extension_constant_field(GF(2^3)) # needs sage.rings.function_field - sage: p1 = F.get_place(3) # needs sage.rings.function_field - sage: p2 = F.get_place(2) # needs sage.rings.function_field - sage: c = E.conorm_divisor(2*p1 + 3*p2) # needs sage.rings.function_field - sage: c1 = E.conorm_place(p1) # needs sage.rings.function_field - sage: c2 = E.conorm_place(p2) # needs sage.rings.function_field - sage: c == 2*c1 + 3*c2 # needs sage.rings.function_field + sage: F. = K.extension(Y^3 - x^2*(x^2 + x + 1)^2) + sage: E = F.extension_constant_field(GF(2^3)) + sage: p1 = F.get_place(3) + sage: p2 = F.get_place(2) + sage: c = E.conorm_divisor(2*p1 + 3*p2) + sage: c1 = E.conorm_place(p1) + sage: c2 = E.conorm_place(p2) + sage: c == 2*c1 + 3*c2 True """ div_top = self.divisor_group() diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 187c0bc9c30..41f971a9602 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -129,7 +129,7 @@ sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings - sage: TestSuite(O).run() # needs sage.rings.function_field sage.rings.number_field + sage: TestSuite(O).run() sage: TestSuite(R).run() # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field @@ -1160,9 +1160,9 @@ def completion(self, place, name=None, prec=None, gen_name=None): s^-1 + 1 + s^3 + s^5 + s^7 + O(s^9) sage: K. = FunctionField(GF(2)) - sage: p = K.places_finite()[0]; p + sage: p = K.places_finite()[0]; p # needs sage.libs.pari Place (x) - sage: m = K.completion(p); m + sage: m = K.completion(p); m # needs sage.rings.function_field Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 @@ -1172,14 +1172,14 @@ def completion(self, place, name=None, prec=None, gen_name=None): sage: p = K.place_infinite(); p Place (1/x) - sage: m = K.completion(p); m + sage: m = K.completion(p); m # needs sage.rings.function_field Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 sage: m(x) s^-1 + O(s^19) - sage: m = K.completion(p, prec=infinity); m + sage: m = K.completion(p, prec=infinity); m # needs sage.rings.function_field Completion map: From: Rational function field in x over Finite Field of size 2 To: Lazy Laurent Series Ring in s over Finite Field of size 2 diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index e6920007298..d9181a9c2c0 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -67,7 +67,6 @@ class RationalFunctionField(FunctionField): There are various ways to get at the underlying fields and rings associated to a rational function field:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)) sage: K.base_field() Rational function field in t over Finite Field of size 7 @@ -341,7 +340,6 @@ def _to_bivariate_polynomial(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: R. = FunctionField(GF(7)) sage: S. = R[] sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) @@ -377,7 +375,6 @@ def _factor_univariate_polynomial(self, f, proof=None): We do a factorization over a finite prime field:: - sage: # needs sage.rings.finite_rings sage: R. = FunctionField(GF(7)) sage: S. = R[] sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) @@ -524,18 +521,22 @@ def free_module(self, base=None, basis=None, map=True): sage: K. = FunctionField(QQ) sage: K.free_module() # needs sage.modules - (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: + (Vector space of dimension 1 over Rational function field in x over Rational Field, + Isomorphism: From: Vector space of dimension 1 over Rational function field in x over Rational Field - To: Rational function field in x over Rational Field, Isomorphism: + To: Rational function field in x over Rational Field, + Isomorphism: From: Rational function field in x over Rational Field To: Vector space of dimension 1 over Rational function field in x over Rational Field) TESTS:: sage: K.free_module() # needs sage.modules - (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: + (Vector space of dimension 1 over Rational function field in x over Rational Field, + Isomorphism: From: Vector space of dimension 1 over Rational function field in x over Rational Field - To: Rational function field in x over Rational Field, Isomorphism: + To: Rational function field in x over Rational Field, + Isomorphism: From: Rational function field in x over Rational Field To: Vector space of dimension 1 over Rational function field in x over Rational Field) @@ -666,17 +667,17 @@ def hom(self, im_gens, base_morphism=None): We construct a map from a rational function field into a non-rational extension field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^3 + 6*x^3 + x) # needs sage.rings.function_field - sage: f = K.hom(y^2 + y + 2); f # needs sage.rings.function_field + sage: L. = K.extension(y^3 + 6*x^3 + x) + sage: f = K.hom(y^2 + y + 2); f Function Field morphism: From: Rational function field in x over Finite Field of size 7 To: Function field in y defined by y^3 + 6*x^3 + x Defn: x |--> y^2 + y + 2 - sage: f(x) # needs sage.rings.function_field + sage: f(x) y^2 + y + 2 - sage: f(x^2) # needs sage.rings.function_field + sage: f(x^2) 5*y^2 + (x^3 + 6*x + 4)*y + 2*x^3 + 5*x + 4 """ if isinstance(im_gens, CategoryObject): @@ -777,7 +778,7 @@ def different(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.different() # needs sage.modules + sage: K.different() # needs sage.modules 0 """ return self.divisor_group().zero() @@ -852,10 +853,9 @@ def residue_field(self, place, name=None): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(5)) - sage: p = F.places_finite(2)[0] - sage: R, fr_R, to_R = F.residue_field(p) + sage: p = F.places_finite(2)[0] # needs sage.libs.pari + sage: R, fr_R, to_R = F.residue_field(p) # needs sage.rings.function_field sage: R Finite Field in z2 of size 5^2 sage: to_R(x) in R @@ -979,18 +979,17 @@ def get_place(self, degree): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = GF(2) sage: K. = FunctionField(F) - sage: K.get_place(1) + sage: K.get_place(1) # needs sage.libs.pari Place (x) - sage: K.get_place(2) + sage: K.get_place(2) # needs sage.libs.pari Place (x^2 + x + 1) - sage: K.get_place(3) + sage: K.get_place(3) # needs sage.libs.pari Place (x^3 + x + 1) - sage: K.get_place(4) + sage: K.get_place(4) # needs sage.libs.pari Place (x^4 + x + 1) - sage: K.get_place(5) + sage: K.get_place(5) # needs sage.libs.pari Place (x^5 + x^2 + 1) """ @@ -1008,9 +1007,8 @@ def higher_derivation(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(5)) - sage: d = F.higher_derivation() + sage: d = F.higher_derivation() # needs sage.rings.function_field sage: [d(x^5,i) for i in range(10)] [x^5, 0, 0, 0, 0, 1, 0, 0, 0, 0] sage: [d(x^7,i) for i in range(10)] From f20ddc2eded28226762d288318e07fc240f4d2bf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 18:35:05 -0700 Subject: [PATCH 13/20] src/sage/rings/function_field: Remove tag sage.rings.finite_rings when only prime finite fields are used; use more block tags --- src/sage/rings/function_field/derivations.py | 6 +- src/sage/rings/function_field/element.pyx | 57 ++++--- .../rings/function_field/function_field.py | 10 +- .../function_field/function_field_rational.py | 10 +- src/sage/rings/function_field/valuation.py | 161 +++++++++--------- 5 files changed, 122 insertions(+), 122 deletions(-) diff --git a/src/sage/rings/function_field/derivations.py b/src/sage/rings/function_field/derivations.py index a070738e448..9a6f0f613a9 100644 --- a/src/sage/rings/function_field/derivations.py +++ b/src/sage/rings/function_field/derivations.py @@ -5,9 +5,9 @@ derivation is available:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: h = L.higher_derivation() # needs sage.rings.function_field - sage: h(y^2, 2) # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: h = L.higher_derivation() # needs sage.rings.function_field + sage: h(y^2, 2) # needs sage.rings.function_field ((x^7 + 1)/x^2)*y^2 + x^3*y AUTHORS: diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 0006f0da07d..fcea5f4bb0a 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -180,55 +180,58 @@ cdef class FunctionFieldElement(FieldElement): A rational function field:: sage: K. = FunctionField(QQ) - sage: t.matrix() # needs sage.modules + sage: t.matrix() # needs sage.modules [t] - sage: (1/(t+1)).matrix() # needs sage.modules + sage: (1/(t+1)).matrix() # needs sage.modules [1/(t + 1)] Now an example in a nontrivial extension of a rational function field:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: y.matrix() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: y.matrix() [ 0 1] [-4*x^3 x] - sage: y.matrix().charpoly('Z') # needs sage.modules sage.rings.function_field + sage: y.matrix().charpoly('Z') Z^2 - x*Z + 4*x^3 An example in a relative extension, where neither function field is rational:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: M. = L[] # needs sage.rings.function_field - sage: Z. = L.extension(T^3 - y^2*T + x) # needs sage.rings.function_field - sage: alpha.matrix() # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: M. = L[] + sage: Z. = L.extension(T^3 - y^2*T + x) + sage: alpha.matrix() [ 0 1 0] [ 0 0 1] [ -x x*y - 4*x^3 0] - sage: alpha.matrix(K) # needs sage.modules sage.rings.function_field + sage: alpha.matrix(K) [ 0 0 1 0 0 0] [ 0 0 0 1 0 0] [ 0 0 0 0 1 0] [ 0 0 0 0 0 1] [ -x 0 -4*x^3 x 0 0] [ 0 -x -4*x^4 -4*x^3 + x^2 0 0] - sage: alpha.matrix(Z) # needs sage.modules sage.rings.function_field + sage: alpha.matrix(Z) [alpha] We show that this matrix does indeed work as expected when making a vector space from a function field:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.function_field - sage: V, from_V, to_V = L.vector_space() # needs sage.modules sage.rings.function_field - sage: y5 = to_V(y^5); y5 # needs sage.modules sage.rings.function_field + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) + sage: V, from_V, to_V = L.vector_space() + sage: y5 = to_V(y^5); y5 ((x^4 + 1)/x, 2*x, 0, 0, 0) - sage: y4y = to_V(y^4) * y.matrix(); y4y # needs sage.modules sage.rings.function_field + sage: y4y = to_V(y^4) * y.matrix(); y4y ((x^4 + 1)/x, 2*x, 0, 0, 0) - sage: y5 == y4y # needs sage.modules sage.rings.function_field + sage: y5 == y4y True """ # multiply each element of the vector space isomorphic to the parent @@ -363,17 +366,18 @@ cdef class FunctionFieldElement(FieldElement): EXAMPLES:: + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] - sage: L. = K.extension(y^2 - x*y + 4*x^3) # needs sage.rings.function_field - sage: y.is_integral() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x*y + 4*x^3) + sage: y.is_integral() True - sage: (y/x).is_integral() # needs sage.modules sage.rings.function_field + sage: (y/x).is_integral() True - sage: (y/x)^2 - (y/x) + 4*x # needs sage.modules sage.rings.function_field + sage: (y/x)^2 - (y/x) + 4*x 0 - sage: (y/x^2).is_integral() # needs sage.modules sage.rings.function_field + sage: (y/x^2).is_integral() False - sage: (y/x).minimal_polynomial('W') # needs sage.modules sage.rings.function_field + sage: (y/x).minimal_polynomial('W') W^2 - W + 4*x """ R = self.parent().base_field().maximal_order() @@ -609,11 +613,12 @@ cdef class FunctionFieldElement(FieldElement): :: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: p = O.ideal(x - 1).place() # needs sage.rings.function_field - sage: y.valuation(p) # needs sage.rings.function_field + sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: O = L.maximal_order() + sage: p = O.ideal(x - 1).place() + sage: y.valuation(p) 0 """ prime = place.prime_ideal() diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 41f971a9602..4468dbfec1f 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -129,7 +129,7 @@ sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings - sage: TestSuite(O).run() + sage: TestSuite(O).run() # needs sage.rings.function_field sage: TestSuite(R).run() # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field @@ -1166,7 +1166,7 @@ def completion(self, place, name=None, prec=None, gen_name=None): Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(1/(x+1)) + sage: m(1/(x+1)) # needs sage.rings.function_field 1 + s + s^2 + s^3 + s^4 + s^5 + s^6 + s^7 + s^8 + s^9 + s^10 + s^11 + s^12 + s^13 + s^14 + s^15 + s^16 + s^17 + s^18 + s^19 + O(s^20) @@ -1176,16 +1176,16 @@ def completion(self, place, name=None, prec=None, gen_name=None): Completion map: From: Rational function field in x over Finite Field of size 2 To: Laurent Series Ring in s over Finite Field of size 2 - sage: m(x) + sage: m(x) # needs sage.rings.function_field s^-1 + O(s^19) sage: m = K.completion(p, prec=infinity); m # needs sage.rings.function_field Completion map: From: Rational function field in x over Finite Field of size 2 To: Lazy Laurent Series Ring in s over Finite Field of size 2 - sage: f = m(x); f + sage: f = m(x); f # needs sage.rings.function_field s^-1 + ... - sage: f.coefficient(100) + sage: f.coefficient(100) # needs sage.rings.function_field 0 sage: # needs sage.rings.function_field diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index d9181a9c2c0..a9d298f57fd 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -855,10 +855,10 @@ def residue_field(self, place, name=None): sage: F. = FunctionField(GF(5)) sage: p = F.places_finite(2)[0] # needs sage.libs.pari - sage: R, fr_R, to_R = F.residue_field(p) # needs sage.rings.function_field - sage: R + sage: R, fr_R, to_R = F.residue_field(p) # needs sage.libs.pari sage.rings.function_field + sage: R # needs sage.libs.pari sage.rings.function_field Finite Field in z2 of size 5^2 - sage: to_R(x) in R + sage: to_R(x) in R # needs sage.libs.pari sage.rings.function_field True """ return place.residue_field(name=name) @@ -1009,9 +1009,9 @@ def higher_derivation(self): sage: F. = FunctionField(GF(5)) sage: d = F.higher_derivation() # needs sage.rings.function_field - sage: [d(x^5,i) for i in range(10)] + sage: [d(x^5,i) for i in range(10)] # needs sage.rings.function_field [x^5, 0, 0, 0, 0, 1, 0, 0, 0, 0] - sage: [d(x^7,i) for i in range(10)] + sage: [d(x^7,i) for i in range(10)] # needs sage.rings.function_field [x^7, 2*x^6, x^5, 0, 0, x^2, 2*x, 1, 0, 0] """ from .derivations_polymod import RationalFunctionFieldHigherDerivation_global diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 11b1194aa4e..964cc7467e7 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -77,7 +77,6 @@ Run test suite for some other classical places over large ground fields:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(3)) sage: M. = FunctionField(K) sage: v = M.valuation(x^3 - t) @@ -112,9 +111,9 @@ Run test suite for a finite place with residual degree and ramification:: - sage: K. = FunctionField(GF(3)) # needs sage.rings.finite_rings - sage: L. = FunctionField(K) # needs sage.rings.finite_rings - sage: v = L.valuation(x^6 - t) # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: L. = FunctionField(K) + sage: v = L.valuation(x^6 - t) sage: TestSuite(v).run(max_runs=10) # long time Run test suite for a valuation which is backed by limit valuation:: @@ -353,7 +352,6 @@ def create_key_and_extra_args_from_valuation_on_isomorphic_field(self, domain, v TESTS:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field @@ -512,7 +510,6 @@ def extensions(self, L): Iterated extensions over the infinite place:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field @@ -540,7 +537,6 @@ def extensions(self, L): Test that this works in towers:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] sage: L. = K.extension(y - x) # needs sage.rings.function_field @@ -592,10 +588,10 @@ class RationalFunctionFieldValuation_base(FunctionFieldValuation_base): TESTS:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: v = K.valuation(x) # indirect doctest # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: v = K.valuation(x) # indirect doctest sage: from sage.rings.function_field.valuation import RationalFunctionFieldValuation_base - sage: isinstance(v, RationalFunctionFieldValuation_base) # needs sage.rings.finite_rings + sage: isinstance(v, RationalFunctionFieldValuation_base) True """ @@ -637,10 +633,10 @@ class ClassicalFunctionFieldValuation_base(DiscreteFunctionFieldValuation_base): TESTS:: - sage: K. = FunctionField(GF(5)) # needs sage.rings.finite_rings - sage: v = K.valuation(x) # indirect doctest # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(5)) + sage: v = K.valuation(x) # indirect doctest sage: from sage.rings.function_field.valuation import ClassicalFunctionFieldValuation_base - sage: isinstance(v, ClassicalFunctionFieldValuation_base) # needs sage.rings.finite_rings + sage: isinstance(v, ClassicalFunctionFieldValuation_base) True """ @@ -995,7 +991,7 @@ class FiniteRationalFunctionFieldValuation(InducedRationalFunctionFieldValuation EXAMPLES:: sage: K. = FunctionField(QQ) - sage: v = K.valuation(x + 1); v # indirect doctest + sage: v = K.valuation(x + 1); v # indirect doctest (x + 1)-adic valuation A finite place with residual degree:: @@ -1005,14 +1001,14 @@ class FiniteRationalFunctionFieldValuation(InducedRationalFunctionFieldValuation A finite place with ramification:: - sage: K. = FunctionField(GF(3)) # needs sage.rings.finite_rings - sage: L. = FunctionField(K) # needs sage.rings.finite_rings - sage: u = L.valuation(x^3 - t); u # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(3)) + sage: L. = FunctionField(K) + sage: u = L.valuation(x^3 - t); u (x^3 + 2*t)-adic valuation A finite place with residual degree and ramification:: - sage: q = L.valuation(x^6 - t); q # needs sage.rings.finite_rings + sage: q = L.valuation(x^6 - t); q (x^6 + 2*t)-adic valuation """ @@ -1041,7 +1037,7 @@ class NonClassicalRationalFunctionFieldValuation(InducedRationalFunctionFieldVal sage: K. = FunctionField(QQ) sage: v = GaussValuation(QQ['x'], QQ.valuation(2)) - sage: w = K.valuation(v); w # indirect doctest + sage: w = K.valuation(v); w # indirect doctest 2-adic valuation """ @@ -1126,13 +1122,14 @@ def __init__(self, parent, approximant, G, approximants): r""" TESTS:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field - sage: w = v.extension(L) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) + sage: v = K.valuation(x - 1) # indirect doctest + sage: w = v.extension(L) sage: from sage.rings.function_field.valuation import FunctionFieldFromLimitValuation - sage: isinstance(w, FunctionFieldFromLimitValuation) # needs sage.rings.function_field + sage: isinstance(w, FunctionFieldFromLimitValuation) True """ @@ -1145,12 +1142,13 @@ def _to_base_domain(self, f): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field - sage: w = v.extension(L) # needs sage.rings.function_field - sage: w._to_base_domain(y).parent() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) + sage: v = K.valuation(x - 1) # indirect doctest + sage: w = v.extension(L) + sage: w._to_base_domain(y).parent() Univariate Polynomial Ring in y over Rational function field in x over Rational Field """ @@ -1162,12 +1160,13 @@ def scale(self, scalar): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^2 + x + 1)) # needs sage.rings.function_field - sage: v = K.valuation(x - 1) # indirect doctest # needs sage.rings.function_field - sage: w = v.extension(L) # needs sage.rings.function_field - sage: 3*w # needs sage.rings.function_field + sage: L. = K.extension(y^2 - (x^2 + x + 1)) + sage: v = K.valuation(x - 1) # indirect doctest + sage: w = v.extension(L) + sage: 3*w 3 * (x - 1)-adic valuation """ @@ -1183,8 +1182,8 @@ class FunctionFieldMappedValuation_base(FunctionFieldValuation_base, MappedValua EXAMPLES:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: v = K.valuation(1/x); v # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: v = K.valuation(1/x); v Valuation at the infinite place """ @@ -1192,10 +1191,10 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v r""" TESTS:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: v = K.valuation(1/x) # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: v = K.valuation(1/x) sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuation_base - sage: isinstance(v, FunctionFieldMappedValuation_base) # needs sage.rings.finite_rings + sage: isinstance(v, FunctionFieldMappedValuation_base) True """ @@ -1211,13 +1210,12 @@ def _to_base_domain(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field - sage: w._to_base_domain(y) # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w._to_base_domain(y) # needs sage.rings.function_field x^2*y """ @@ -1229,13 +1227,12 @@ def _from_base_domain(self, f): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field - sage: w._from_base_domain(w._to_base_domain(y)) # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: w._from_base_domain(w._to_base_domain(y)) # needs sage.rings.function_field y r""" @@ -1247,13 +1244,12 @@ def scale(self, scalar): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field - sage: 3*w # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field + sage: 3*w # needs sage.rings.function_field 3 * (x)-adic valuation (in Rational function field in x over Finite Field of size 2 after x |--> 1/x) """ @@ -1268,12 +1264,11 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) - sage: v.extension(L) # indirect doctest # needs sage.rings.function_field + sage: v.extension(L) # indirect doctest # needs sage.rings.function_field Valuation at the infinite place """ @@ -1290,10 +1285,10 @@ def is_discrete_valuation(self): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x^4 - 1) # needs sage.rings.function_field - sage: v = K.valuation(1/x) # needs sage.rings.function_field - sage: w0,w1 = v.extensions(L) # needs sage.rings.function_field - sage: w0.is_discrete_valuation() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^4 - 1) # needs sage.rings.function_field + sage: v = K.valuation(1/x) # needs sage.rings.function_field + sage: w0,w1 = v.extensions(L) # needs sage.rings.function_field + sage: w0.is_discrete_valuation() # needs sage.rings.function_field True """ @@ -1308,8 +1303,8 @@ class FunctionFieldMappedValuationRelative_base(FunctionFieldMappedValuation_bas EXAMPLES:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: v = K.valuation(1/x); v # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: v = K.valuation(1/x); v Valuation at the infinite place """ @@ -1317,10 +1312,10 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v r""" TESTS:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: v = K.valuation(1/x) # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: v = K.valuation(1/x) sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuationRelative_base - sage: isinstance(v, FunctionFieldMappedValuationRelative_base) # needs sage.rings.finite_rings + sage: isinstance(v, FunctionFieldMappedValuationRelative_base) True """ @@ -1334,8 +1329,8 @@ def restriction(self, ring): EXAMPLES:: - sage: K. = FunctionField(GF(2)) # needs sage.rings.finite_rings - sage: K.valuation(1/x).restriction(GF(2)) # needs sage.rings.finite_rings + sage: K. = FunctionField(GF(2)) + sage: K.valuation(1/x).restriction(GF(2)) Trivial valuation on Finite Field of size 2 """ @@ -1386,7 +1381,7 @@ class InfiniteRationalFunctionFieldValuation(FunctionFieldMappedValuationRelativ EXAMPLES:: sage: K. = FunctionField(QQ) - sage: v = K.valuation(1/x) # indirect doctest + sage: v = K.valuation(1/x) # indirect doctest """ def __init__(self, parent): @@ -1394,7 +1389,7 @@ def __init__(self, parent): TESTS:: sage: K. = FunctionField(QQ) - sage: v = K.valuation(1/x) # indirect doctest + sage: v = K.valuation(1/x) # indirect doctest sage: from sage.rings.function_field.valuation import InfiniteRationalFunctionFieldValuation sage: isinstance(v, InfiniteRationalFunctionFieldValuation) True @@ -1412,7 +1407,7 @@ def _repr_(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.valuation(1/x) # indirect doctest + sage: K.valuation(1/x) # indirect doctest Valuation at the infinite place """ @@ -1429,24 +1424,23 @@ class FunctionFieldExtensionMappedValuation(FunctionFieldMappedValuationRelative EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field + sage: w = v.extension(L) # needs sage.rings.function_field - sage: w(x) # needs sage.rings.finite_rings sage.rings.function_field + sage: w(x) # needs sage.rings.function_field -1 - sage: w(y) # needs sage.rings.finite_rings sage.rings.function_field + sage: w(y) # needs sage.rings.function_field -3/2 - sage: w.uniformizer() # needs sage.rings.finite_rings sage.rings.function_field + sage: w.uniformizer() # needs sage.rings.function_field 1/x^2*y TESTS:: sage: from sage.rings.function_field.valuation import FunctionFieldExtensionMappedValuation - sage: isinstance(w, FunctionFieldExtensionMappedValuation) # needs sage.rings.finite_rings sage.rings.function_field + sage: isinstance(w, FunctionFieldExtensionMappedValuation) # needs sage.rings.function_field True """ @@ -1456,19 +1450,20 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field - sage: v = K.valuation(1/x) # needs sage.rings.function_field - sage: w = v.extension(L); w # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) + sage: v = K.valuation(1/x) + sage: w = v.extension(L); w Valuation at the infinite place + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - 1/x^2 - 1) # needs sage.rings.function_field - sage: v = K.valuation(1/x) # needs sage.rings.function_field - sage: w = v.extensions(L); w # needs sage.rings.function_field + sage: L. = K.extension(y^2 - 1/x^2 - 1) + sage: v = K.valuation(1/x) + sage: w = v.extensions(L); w [[ Valuation at the infinite place, v(y + 1) = 2 ]-adic valuation, [ Valuation at the infinite place, v(y - 1) = 2 ]-adic valuation] @@ -1484,13 +1479,13 @@ def restriction(self, ring): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field - sage: w.restriction(K) is v # needs sage.rings.function_field + sage: w = v.extension(L) + sage: w.restriction(K) is v True """ if ring.is_subring(self.domain().base()): From d0cafb4bdc47623a2af16612979a4336a04ca23e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 18:47:13 -0700 Subject: [PATCH 14/20] src/sage/rings/function_field: Fix # needs --- src/sage/rings/function_field/function_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 4468dbfec1f..fc429c8a6b7 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -104,7 +104,7 @@ Function fields over the algebraic field are supported:: - sage: # optional - rings.number_field, needs sage.rings.function_field + sage: # needs sage.rings.function_field sage.rings.number_field sage: K. = FunctionField(QQbar); _. = K[] sage: L. = K.extension(Y^2 + Y + x + 1/x) sage: O = L.maximal_order() From 4e02c242dd4f9089589d35a6115c66a9c2dc6bc7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 18:54:31 -0700 Subject: [PATCH 15/20] src/sage/rings/function_field: Use more block # needs --- src/sage/rings/function_field/valuation.py | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 964cc7467e7..5eecbb38095 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -307,11 +307,13 @@ def create_key_and_extra_args_from_valuation(self, domain, valuation): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^3 + 1/x^3*y + 2/x^4) # needs sage.rings.function_field - sage: v = K.valuation(x) # needs sage.rings.function_field - sage: v.extensions(L) # needs sage.rings.function_field - [[ (x)-adic valuation, v(y) = 1 ]-adic valuation (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y), - [ (x)-adic valuation, v(y) = 1/2 ]-adic valuation (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y)] + sage: L. = K.extension(y^3 + 1/x^3*y + 2/x^4) # needs sage.rings.function_field + sage: v = K.valuation(x) # needs sage.rings.function_field + sage: v.extensions(L) # needs sage.rings.function_field + [[ (x)-adic valuation, v(y) = 1 ]-adic valuation + (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y), + [ (x)-adic valuation, v(y) = 1/2 ]-adic valuation + (in Function field in y defined by y^3 + x*y + 2*x^2 after y |--> 1/x^2*y)] """ # this should have been handled by create_key already @@ -510,14 +512,15 @@ def extensions(self, L): Iterated extensions over the infinite place:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y^2 + y + x^3) # needs sage.rings.function_field + sage: L. = K.extension(y^2 + y + x^3) sage: v = K.valuation(1/x) - sage: w = v.extension(L) # needs sage.rings.function_field - sage: R. = L[] # needs sage.rings.function_field - sage: M. = L.extension(z^2 - y) # needs sage.rings.function_field - sage: w.extension(M) # not implemented # needs sage.rings.function_field + sage: w = v.extension(L) + sage: R. = L[] + sage: M. = L.extension(z^2 - y) + sage: w.extension(M) # not implemented Traceback (most recent call last): ... NotImplementedError @@ -537,13 +540,14 @@ def extensions(self, L): Test that this works in towers:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)) sage: R. = K[] - sage: L. = K.extension(y - x) # needs sage.rings.function_field - sage: R. = L[] # needs sage.rings.function_field - sage: L. = L.extension(z - y) # needs sage.rings.function_field - sage: v = K.valuation(x) # needs sage.rings.function_field - sage: v.extensions(L) # needs sage.rings.function_field + sage: L. = K.extension(y - x) + sage: R. = L[] + sage: L. = L.extension(z - y) + sage: v = K.valuation(x) + sage: v.extensions(L) [(x)-adic valuation] """ K = self.domain() @@ -1283,12 +1287,13 @@ def is_discrete_valuation(self): EXAMPLES:: + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^2 - x^4 - 1) # needs sage.rings.function_field - sage: v = K.valuation(1/x) # needs sage.rings.function_field - sage: w0,w1 = v.extensions(L) # needs sage.rings.function_field - sage: w0.is_discrete_valuation() # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^4 - 1) + sage: v = K.valuation(1/x) + sage: w0,w1 = v.extensions(L) + sage: w0.is_discrete_valuation() True """ From 17cb18bfb8537c17656a7fd7f2f6f0974b138a12 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 18:56:13 -0700 Subject: [PATCH 16/20] src/sage/rings/function_field: Fix ups --- src/sage/rings/function_field/ideal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/rings/function_field/ideal.py b/src/sage/rings/function_field/ideal.py index 22c6fb7539b..7ba33a00576 100644 --- a/src/sage/rings/function_field/ideal.py +++ b/src/sage/rings/function_field/ideal.py @@ -613,7 +613,7 @@ def __init__(self, ring, module): EXAMPLES:: - sage: # needs sage.rings.function_field + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x^3 - 1) sage: O = L.equation_order() @@ -907,7 +907,7 @@ class FunctionFieldIdealInfinite_module(FunctionFieldIdealInfinite, Ideal_generi EXAMPLES:: - sage: # needs sage.rings.function_field + sage: # needs sage.rings.function_field sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x^3 - 1) sage: O = L.equation_order() From 3535b9847acff04c4053be8bc794d25ce689f3ec Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 23:27:05 -0700 Subject: [PATCH 17/20] FunctionField._test_derivation: Do not test what cannot be tested --- src/sage/rings/function_field/function_field.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index fc429c8a6b7..fe422afc664 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -745,7 +745,10 @@ def _test_derivation(self, **options): tester = self._tester(**options) S = tester.some_elements() K = self.constant_base_field().some_elements() - d = self.derivation() + try: + d = self.derivation() + except ImportError: + return from itertools import product # Non-zero tester.assertFalse(d.is_zero()) From bd8b94292745aaa8fced9688abd303e9db2fdd9b Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 15 Jul 2023 23:27:35 -0700 Subject: [PATCH 18/20] sage.rings.function_field: Update # needs --- .../function_field/function_field_rational.py | 4 +-- src/sage/rings/function_field/ideal.py | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index a9d298f57fd..42796b998bf 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -378,9 +378,9 @@ def _factor_univariate_polynomial(self, f, proof=None): sage: R. = FunctionField(GF(7)) sage: S. = R[] sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) - sage: f.factor() + sage: f.factor() # needs sage.libs.pari (1/t) * (X + 3*t) * (X + 5*t) * (X + 6*t) * (X^2 + 1/t) * (X^2 + 6/t) - sage: f.factor().prod() == f + sage: f.factor().prod() == f # needs sage.libs.pari True Factoring over a function field over a non-prime finite field:: diff --git a/src/sage/rings/function_field/ideal.py b/src/sage/rings/function_field/ideal.py index 7ba33a00576..22aa15299b1 100644 --- a/src/sage/rings/function_field/ideal.py +++ b/src/sage/rings/function_field/ideal.py @@ -515,20 +515,21 @@ def divisor_of_zeros(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings sage: K. = FunctionField(GF(4)) sage: O = K.maximal_order() sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) sage: I.divisor_of_zeros() Place (x) + 2*Place (x + 1) + sage: # needs sage.modules sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) sage: I.divisor_of_zeros() 2*Place (1/x) - sage: # needs sage.rings.function_field + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^2 + Y + x + 1/x) sage: O = L.maximal_order() @@ -551,20 +552,21 @@ def divisor_of_poles(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.modules sage.rings.finite_rings sage: K. = FunctionField(GF(4)) sage: O = K.maximal_order() sage: I = O.ideal(x*(x + 1)^2/(x^2 + x + 1)) sage: I.divisor_of_poles() Place (x + z2) + Place (x + z2 + 1) + sage: # needs sage.modules sage: K. = FunctionField(GF(2)) sage: Oinf = K.maximal_order_infinite() sage: I = Oinf.ideal((x + 1)/(x^3 + 1)) sage: I.divisor_of_poles() 0 - sage: # needs sage.rings.function_field + sage: # needs sage.modules sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^2 + Y + x + 1/x) sage: O = L.maximal_order() @@ -1022,17 +1024,20 @@ def module(self): sage: O = K.maximal_order(); O Maximal order of Rational function field in x over Finite Field of size 7 sage: K.polynomial_ring() - Univariate Polynomial Ring in x over Rational function field in x over Finite Field of size 7 + Univariate Polynomial Ring in x over + Rational function field in x over Finite Field of size 7 sage: I = O.ideal([x^2 + 1, x*(x^2+1)]) sage: I.gens() (x^2 + 1,) - sage: I.module() - Free module of degree 1 and rank 1 over Maximal order of Rational function field in x over Finite Field of size 7 + sage: I.module() # needs sage.modules + Free module of degree 1 and rank 1 over + Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: [x^2 + 1] - sage: V, from_V, to_V = K.vector_space(); V - Vector space of dimension 1 over Rational function field in x over Finite Field of size 7 - sage: I.module().is_submodule(V) + sage: V, from_V, to_V = K.vector_space(); V # needs sage.modules + Vector space of dimension 1 over + Rational function field in x over Finite Field of size 7 + sage: I.module().is_submodule(V) # needs sage.modules True """ return self._module From 2f27e8cebaf68cad4c251507f4bfc2fd297b35b5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 16 Jul 2023 20:10:30 -0700 Subject: [PATCH 19/20] sage.rings.function_field: Update # needs --- src/sage/rings/function_field/element.pyx | 2 +- src/sage/rings/function_field/extensions.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index fcea5f4bb0a..71e7ccd5f8b 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -570,7 +570,7 @@ cdef class FunctionFieldElement(FieldElement): sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings - sage: (x/y).zeros() # needs sage.modules sage.rings.finite_rings + sage: (x/y).zeros() # needs sage.modules sage.rings.finite_rings sage.rings.function_field [Place (x, x*y)] """ return self.divisor_of_zeros().support() diff --git a/src/sage/rings/function_field/extensions.py b/src/sage/rings/function_field/extensions.py index 320f8052b18..9e42e5bff6b 100644 --- a/src/sage/rings/function_field/extensions.py +++ b/src/sage/rings/function_field/extensions.py @@ -16,11 +16,11 @@ sage: L # needs sage.rings.number_field Rational function field in x over Number Field in a with defining polynomial x^2 - 2 with a = 1.4142... over its base - sage: d = (x^2 - 2).divisor() # needs sage.libs.pari - sage: d # needs sage.libs.pari + sage: d = (x^2 - 2).divisor() # needs sage.libs.pari sage.modules + sage: d # needs sage.libs.pari sage.modules -2*Place (1/x) + Place (x^2 - 2) - sage: L.conorm_divisor(d) # needs sage.libs.pari sage.rings.number_field + sage: L.conorm_divisor(d) # needs sage.libs.pari sage.modules sage.rings.number_field -2*Place (1/x) + Place (x - a) + Place (x + a) From 61654eb7cf062ace119857ba461edd819a7b3c92 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 16 Jul 2023 21:08:44 -0700 Subject: [PATCH 20/20] ./sage -fixdoctests --distribution 'sagemath-modules[pari]' --only-tags --probe all src/sage/rings/function_field/ --- src/sage/rings/function_field/differential.py | 6 +- src/sage/rings/function_field/element.pyx | 2 +- .../rings/function_field/function_field.py | 2 +- src/sage/rings/function_field/order.py | 32 ++-- src/sage/rings/function_field/order_basis.py | 160 +++++++++--------- src/sage/rings/function_field/place.py | 116 ++++++------- .../rings/function_field/place_rational.py | 4 +- 7 files changed, 159 insertions(+), 163 deletions(-) diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index 7102f56f6b6..03b327b1abf 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -151,7 +151,7 @@ def _latex_(self): sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(4)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: w = y.differential() sage: latex(w) \left( x y^{2} + \frac{1}{x} y \right)\, dx @@ -444,7 +444,7 @@ def residue(self, place): sage: w = 1/f * f.differential() sage: d = f.divisor() sage: s = d.support() - sage: sum([w.residue(p).trace() for p in s]) + sage: sum([w.residue(p).trace() for p in s]) # needs sage.rings.function_field 0 and in an extension field:: @@ -559,7 +559,7 @@ def cartier(self): sage: F. = FunctionField(GF(4)) sage: f = x/(x^2 + x + 1) sage: w = 1/f*f.differential() - sage: w.cartier() == w + sage: w.cartier() == w # needs sage.rings.function_field True """ W = self.parent() diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 71e7ccd5f8b..9a82b611d18 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -569,7 +569,7 @@ cdef class FunctionFieldElement(FieldElement): :: sage: K. = FunctionField(GF(4)); _. = K[] # needs sage.rings.finite_rings - sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.finite_rings sage.rings.function_field sage: (x/y).zeros() # needs sage.modules sage.rings.finite_rings sage.rings.function_field [Place (x, x*y)] """ diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index fe422afc664..973d9a8f505 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -129,7 +129,7 @@ sage: TestSuite(L).run(max_runs=8) # long time (25s) # needs sage.rings.function_field sage.rings.number_field sage: TestSuite(M).run(max_runs=8) # long time (35s) # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings - sage: TestSuite(O).run() # needs sage.rings.function_field + sage: TestSuite(O).run() sage: TestSuite(R).run() # needs sage.rings.finite_rings sage.rings.function_field sage: TestSuite(S).run() # long time (4s) # needs sage.rings.finite_rings sage.rings.function_field diff --git a/src/sage/rings/function_field/order.py b/src/sage/rings/function_field/order.py index b0858eba2ab..52732cad62a 100644 --- a/src/sage/rings/function_field/order.py +++ b/src/sage/rings/function_field/order.py @@ -30,35 +30,35 @@ `O` and one maximal infinite order `O_\infty`. There are other non-maximal orders such as equation orders:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(3)); R. = K[] - sage: L. = K.extension(y^3 - y - x) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: 1/y in O # needs sage.rings.function_field + sage: L. = K.extension(y^3 - y - x) + sage: O = L.equation_order() + sage: 1/y in O False - sage: x/y in O # needs sage.rings.function_field + sage: x/y in O True Sage provides an extensive functionality for computations in maximal orders of function fields. For example, you can decompose a prime ideal of a rational function field in an extension:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: o = K.maximal_order() sage: p = o.ideal(x + 1) - sage: p.is_prime() + sage: p.is_prime() # needs sage.libs.pari True - sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) # needs sage.rings.finite_rings sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.finite_rings sage.rings.function_field - sage: O.decomposition(p) # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: F. = K.extension(t^3 - x^2*(x^2 + x + 1)^2) + sage: O = F.maximal_order() + sage: O.decomposition(p) [(Ideal (x + 1, y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 1, 1), (Ideal (x + 1, (1/(x^3 + x^2 + x))*y^2 + y + 1) of Maximal order of Function field in y defined by y^3 + x^6 + x^4 + x^2, 2, 1)] - sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field sage: p1, relative_degree,ramification_index = O.decomposition(p)[1] sage: p1.parent() Monoid of ideals of Maximal order of Function field in y @@ -71,12 +71,12 @@ When the base constant field is the algebraic field `\QQbar`, the only prime ideals of the maximal order of the rational function field are linear polynomials. :: - sage: # needs sage.rings.number_field + sage: # needs sage.rings.function_field sage.rings.number_field sage: K. = FunctionField(QQbar) sage: R. = K[] - sage: L. = K.extension(y^2 - (x^3-x^2)) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - (x^3-x^2)) sage: p = K.maximal_order().ideal(x) - sage: L.maximal_order().decomposition(p) # needs sage.rings.function_field + sage: L.maximal_order().decomposition(p) [(Ideal (1/x*y - I) of Maximal order of Function field in y defined by y^2 - x^3 + x^2, 1, 1), @@ -274,8 +274,8 @@ def _repr_(self): Maximal infinite order of Rational function field in y over Rational Field sage: K. = FunctionField(GF(2)); R. = PolynomialRing(K) - sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.finite_rings sage.rings.function_field - sage: F.maximal_order_infinite() # needs sage.modules sage.rings.finite_rings sage.rings.function_field + sage: F. = K.extension(t^3 - x^2*(x^2+x+1)^2) # needs sage.rings.function_field + sage: F.maximal_order_infinite() # needs sage.modules sage.rings.function_field Maximal infinite order of Function field in y defined by y^3 + x^6 + x^4 + x^2 """ return "Maximal infinite order of %s"%(self.function_field(),) diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index 9151a4445f3..3452d961459 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -1,5 +1,4 @@ -# sage.doctest: optional - sage.modules (because __init__ constructs a vector space) -# some tests are marked # optional - sage.rings.finite_rings (because they use finite fields) +# sage.doctest: needs sage.modules (because __init__ constructs a vector space) r""" Orders of function fields: basis """ @@ -35,8 +34,8 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): EXAMPLES:: sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order(); O # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order(); O # needs sage.rings.function_field Order in Function field in y defined by y^4 + x*y + 4*x + 1 The basis only defines an order if the module it generates is closed under @@ -44,23 +43,26 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): sage: K. = FunctionField(QQ) sage: R. = K[] - sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.function_field - sage: y.is_integral() # needs sage.rings.function_field + sage: L. = K.extension(y^5 - (x^3 + 2*x*y + 1/x)) # needs sage.rings.function_field + sage: y.is_integral() # needs sage.rings.function_field False - sage: L.order(y) # needs sage.rings.function_field + sage: L.order(y) # needs sage.rings.function_field Traceback (most recent call last): ... - ValueError: the module generated by basis (1, y, y^2, y^3, y^4) must be closed under multiplication + ValueError: the module generated by basis (1, y, y^2, y^3, y^4) + must be closed under multiplication The basis also has to be linearly independent and of the same rank as the degree of the function field of its elements (only checked when ``check`` is ``True``):: - sage: L.order(L(x)) # needs sage.rings.function_field + sage: # needs sage.rings.function_field + sage: L.order(L(x)) Traceback (most recent call last): ... ValueError: basis (1, x, x^2, x^3, x^4) is not linearly independent - sage: sage.rings.function_field.order_basis.FunctionFieldOrder_basis((y,y,y^3,y^4,y^5)) # needs sage.rings.function_field + sage: from sage.rings.function_field.order_basis import FunctionFieldOrder_basis + sage: FunctionFieldOrder_basis((y,y,y^3,y^4,y^5)) Traceback (most recent call last): ... ValueError: basis (y, y, y^3, y^4, 2*x*y + (x^4 + 1)/x) is not linearly independent @@ -71,7 +73,7 @@ def __init__(self, basis, check=True): TESTS:: - sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] sage: L. = K.extension(y^4 + x*y + 4*x + 1) sage: O = L.equation_order() @@ -157,14 +159,14 @@ def ideal_with_gens_over_base(self, gens): We construct some ideals in a nontrivial function field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order(); O # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order(); O Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]); I Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I.module() # needs sage.rings.function_field + sage: I.module() Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -173,15 +175,15 @@ def ideal_with_gens_over_base(self, gens): There is no check if the resulting object is really an ideal:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([y]); I Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 sage: y in I True - sage: y^2 in I # needs sage.rings.function_field + sage: y^2 in I False """ F = self.function_field() @@ -214,17 +216,19 @@ def ideal(self, *gens): A fractional ideal of a nontrivial extension:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)); R. = K[] sage: O = K.maximal_order() sage: I = O.ideal(x^2 - 4) - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: S = L.equation_order() # needs sage.rings.function_field - sage: S.ideal(1/y) # needs sage.rings.function_field - Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 = S.ideal(x^2 - 4); I2 # needs sage.rings.function_field + + sage: # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: S = L.equation_order() + sage: S.ideal(1/y) + Ideal (1, (6/(x^3 + 1))*y) of + Order in Function field in y defined by y^2 + 6*x^3 + 6 + sage: I2 = S.ideal(x^2 - 4); I2 Ideal (x^2 + 3) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I2 == S.ideal(I) # needs sage.rings.function_field + sage: I2 == S.ideal(I) True """ if len(gens) == 1: @@ -244,11 +248,11 @@ def polynomial(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.polynomial() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: O.polynomial() y^4 + x*y + 4*x + 1 """ return self._field.polynomial() @@ -259,11 +263,11 @@ def basis(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.basis() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: O.basis() (1, y, y^2, y^3) """ return self._basis @@ -275,11 +279,11 @@ def free_module(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.free_module() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: O.free_module() Free module of degree 4 and rank 4 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: @@ -300,12 +304,12 @@ def coordinate_vector(self, e): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: f = (x + y)^3 # needs sage.rings.function_field - sage: O.coordinate_vector(f) # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) + sage: O = L.equation_order() + sage: f = (x + y)^3 + sage: O.coordinate_vector(f) (x^3, 3*x^2, 3*x, 1) """ return self._module.coordinate_vector(self._to_module(e), check=False) @@ -325,24 +329,25 @@ class FunctionFieldOrderInfinite_basis(FunctionFieldOrderInfinite): EXAMPLES:: sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.finite_rings sage.rings.function_field - sage: O = L.equation_order_infinite(); O # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order_infinite(); O # needs sage.rings.function_field Infinite order in Function field in y defined by y^4 + x*y + 4*x + 1 The basis only defines an order if the module it generates is closed under multiplication and contains the identity element (only checked when ``check`` is ``True``):: - sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, y^3]); O # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, y^3]); O # needs sage.rings.function_field Traceback (most recent call last): ... - ValueError: the module generated by basis (1, y, 1/x^2*y^2, y^3) must be closed under multiplication + ValueError: the module generated by basis (1, y, 1/x^2*y^2, y^3) + must be closed under multiplication The basis also has to be linearly independent and of the same rank as the degree of the function field of its elements (only checked when ``check`` is ``True``):: - sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, 1 + y]); O # needs sage.rings.finite_rings sage.rings.function_field + sage: O = L.order_infinite_with_basis([1, y, 1/x^2*y^2, 1 + y]); O # needs sage.rings.function_field Traceback (most recent call last): ... ValueError: The given basis vectors must be linearly independent. @@ -350,9 +355,10 @@ class FunctionFieldOrderInfinite_basis(FunctionFieldOrderInfinite): Note that 1 does not need to be an element of the basis, as long as it is in the module spanned by it:: - sage: O = L.order_infinite_with_basis([1 + 1/x*y, 1/x*y, 1/x^2*y^2, 1/x^3*y^3]); O # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field + sage: O = L.order_infinite_with_basis([1 + 1/x*y, 1/x*y, 1/x^2*y^2, 1/x^3*y^3]); O Infinite order in Function field in y defined by y^4 + x*y + 4*x + 1 - sage: O.basis() # needs sage.rings.finite_rings sage.rings.function_field + sage: O.basis() (1/x*y + 1, 1/x*y, 1/x^2*y^2, 1/x^3*y^3) """ def __init__(self, basis, check=True): @@ -361,7 +367,7 @@ def __init__(self, basis, check=True): TESTS:: - sage: # needs sage.rings.finite_rings sage.rings.function_field + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] sage: L. = K.extension(y^4 + x*y + 4*x + 1) sage: O = L.equation_order_infinite() @@ -455,30 +461,31 @@ def ideal_with_gens_over_base(self, gens): We construct some ideals in a nontrivial function field:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order(); O # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order(); O Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I = O.ideal_with_gens_over_base([1, y]); I # needs sage.rings.function_field + sage: I = O.ideal_with_gens_over_base([1, y]); I Ideal (1) of Order in Function field in y defined by y^2 + 6*x^3 + 6 - sage: I.module() # needs sage.rings.function_field - Free module of degree 2 and rank 2 over Maximal order of Rational function field in x over Finite Field of size 7 + sage: I.module() + Free module of degree 2 and rank 2 over + Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: [1 0] [0 1] There is no check if the resulting object is really an ideal:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: I = O.ideal_with_gens_over_base([y]); I # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) + sage: O = L.equation_order() + sage: I = O.ideal_with_gens_over_base([y]); I Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 sage: y in I True - sage: y^2 in I # needs sage.rings.function_field + sage: y^2 in I False """ F = self.function_field() @@ -514,8 +521,8 @@ def ideal(self, *gens): sage: K. = FunctionField(QQ); R. = K[] sage: O = K.maximal_order_infinite() sage: I = O.ideal(x^2 - 4) - sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field - sage: S = L.order_infinite_with_basis([1, 1/x^2*y]) # needs sage.rings.function_field + sage: L. = K.extension(y^2 - x^3 - 1) # needs sage.rings.function_field + sage: S = L.order_infinite_with_basis([1, 1/x^2*y]) # needs sage.rings.function_field """ if len(gens) == 1: gens = gens[0] @@ -534,11 +541,10 @@ def polynomial(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.polynomial() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.polynomial() # needs sage.rings.function_field y^4 + x*y + 4*x + 1 """ return self._field.polynomial() @@ -549,11 +555,10 @@ def basis(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.basis() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.basis() # needs sage.rings.function_field (1, y, y^2, y^3) """ return self._basis @@ -565,11 +570,10 @@ def free_module(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(7)); R. = K[] - sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field - sage: O = L.equation_order() # needs sage.rings.function_field - sage: O.free_module() # needs sage.rings.function_field + sage: L. = K.extension(y^4 + x*y + 4*x + 1) # needs sage.rings.function_field + sage: O = L.equation_order() # needs sage.rings.function_field + sage: O.free_module() # needs sage.rings.function_field Free module of degree 4 and rank 4 over Maximal order of Rational function field in x over Finite Field of size 7 Echelon basis matrix: diff --git a/src/sage/rings/function_field/place.py b/src/sage/rings/function_field/place.py index 9139d9a19e2..48ea2a2c32f 100644 --- a/src/sage/rings/function_field/place.py +++ b/src/sage/rings/function_field/place.py @@ -12,8 +12,8 @@ All rational places of a function field can be computed:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.places() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: L.places() # needs sage.rings.function_field [Place (1/x, 1/x^3*y^2 + 1/x), Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1), Place (x, y)] @@ -21,21 +21,20 @@ The residue field associated with a place is given as an extension of the constant field:: - sage: # needs sage.rings.finite_rings sage: F. = FunctionField(GF(2)) sage: O = F.maximal_order() - sage: p = O.ideal(x^2 + x + 1).place() - sage: k, fr_k, to_k = p.residue_field() + sage: p = O.ideal(x^2 + x + 1).place() # needs sage.libs.pari + sage: k, fr_k, to_k = p.residue_field() # needs sage.rings.function_field sage: k Finite Field in z2 of size 2^2 The homomorphisms are between the valuation ring and the residue field:: - sage: fr_k # needs sage.rings.finite_rings + sage: fr_k Ring morphism: From: Finite Field in z2 of size 2^2 To: Valuation ring at Place (x^2 + x + 1) - sage: to_k # needs sage.rings.finite_rings + sage: to_k Ring morphism: From: Valuation ring at Place (x^2 + x + 1) To: Finite Field in z2 of size 2^2 @@ -79,8 +78,8 @@ class FunctionFieldPlace(Element): EXAMPLES:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.places_finite()[0] # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field + sage: L.places_finite()[0] # needs sage.rings.function_field Place (x, y) """ def __init__(self, parent, prime): @@ -89,7 +88,6 @@ def __init__(self, parent, prime): TESTS:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: p = L.places_finite()[0] # needs sage.rings.function_field @@ -105,7 +103,6 @@ def __hash__(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: p = L.places_finite()[0] # needs sage.rings.function_field @@ -120,7 +117,6 @@ def _repr_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field sage: p = L.places_finite()[0] # needs sage.rings.function_field @@ -140,7 +136,6 @@ def _latex_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field sage: p = L.places_finite()[0] # needs sage.rings.function_field @@ -155,15 +150,15 @@ def _richcmp_(self, other, op): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x + x^3*Y) # needs sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field - sage: p1 < p2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: p1, p2, p3 = L.places()[:3] + sage: p1 < p2 True - sage: p2 < p1 # needs sage.rings.function_field + sage: p2 < p1 False - sage: p1 == p3 # needs sage.rings.function_field + sage: p1 == p3 False """ from sage.rings.function_field.order import FunctionFieldOrderInfinite @@ -182,13 +177,13 @@ def _acted_upon_(self, other, self_on_left): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) sage: F. = K.extension(Y^2 - x^3 - 1) - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(x + 1, y) # needs sage.rings.function_field - sage: P = I.place() # needs sage.rings.function_field - sage: -3*P + 5*P # needs sage.rings.function_field + sage: O = F.maximal_order() + sage: I = O.ideal(x + 1, y) + sage: P = I.place() + sage: -3*P + 5*P 2*Place (x + 1, y) """ if self_on_left: @@ -201,11 +196,11 @@ def _neg_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field - sage: -p1 + p2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: p1, p2, p3 = L.places()[:3] + sage: -p1 + p2 - Place (1/x, 1/x^3*y^2 + 1/x) + Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) """ @@ -218,11 +213,11 @@ def _add_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: p1, p2, p3 = L.places()[:3] # needs sage.rings.function_field - sage: p1 + p2 + p3 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: p1, p2, p3 = L.places()[:3] + sage: p1 + p2 + p3 Place (1/x, 1/x^3*y^2 + 1/x) + Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) + Place (x, y) @@ -236,11 +231,11 @@ def _sub_(self, other): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: p1, p2 = L.places()[:2] # needs sage.rings.function_field - sage: p1 - p2 # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: p1, p2 = L.places()[:2] + sage: p1 - p2 Place (1/x, 1/x^3*y^2 + 1/x) - Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1) """ @@ -282,7 +277,6 @@ def function_field(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field sage: p = L.places()[0] # needs sage.rings.function_field @@ -297,7 +291,6 @@ def prime_ideal(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field sage: p = L.places()[0] # needs sage.rings.function_field @@ -313,13 +306,13 @@ def divisor(self, multiplicity=1): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) - sage: F. = K.extension(Y^2 - x^3 - 1) # needs sage.rings.function_field - sage: O = F.maximal_order() # needs sage.rings.function_field - sage: I = O.ideal(x + 1, y) # needs sage.rings.function_field - sage: P = I.place() # needs sage.rings.function_field - sage: P.divisor() # needs sage.rings.function_field + sage: F. = K.extension(Y^2 - x^3 - 1) + sage: O = F.maximal_order() + sage: I = O.ideal(x + 1, y) + sage: P = I.place() + sage: P.divisor() Place (x + 1, y) """ from .divisor import prime_divisor @@ -337,8 +330,8 @@ class PlaceSet(UniqueRepresentation, Parent): EXAMPLES:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: L.place_set() # needs sage.rings.function_field Set of places of Function field in y defined by y^3 + x^3*y + x """ Element = FunctionFieldPlace @@ -349,7 +342,6 @@ def __init__(self, field): TESTS:: - sage: # needs sage.rings.finite_rings sage: K. = FunctionField(GF(2)); _. = K[] sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field sage: places = L.place_set() # needs sage.rings.function_field @@ -367,8 +359,8 @@ def _repr_(self): EXAMPLES:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.finite_rings sage.rings.function_field - sage: L.place_set() # needs sage.rings.finite_rings sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field + sage: L.place_set() # needs sage.rings.function_field Set of places of Function field in y defined by y^3 + x^3*y + x """ return "Set of places of {}".format(self._field) @@ -379,12 +371,12 @@ def _element_constructor_(self, x): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: places = L.place_set() # needs sage.rings.function_field - sage: O = L.maximal_order() # needs sage.rings.function_field - sage: places(O.ideal(x, y)) # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: places = L.place_set() + sage: O = L.maximal_order() + sage: places(O.ideal(x, y)) Place (x, y) """ from .ideal import FunctionFieldIdeal @@ -400,11 +392,11 @@ def _an_element_(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: places = L.place_set() # needs sage.rings.function_field - sage: places.an_element() # random # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: places = L.place_set() + sage: places.an_element() # random Ideal (x) of Maximal order of Rational function field in x over Finite Field of size 2 """ @@ -424,11 +416,11 @@ def function_field(self): EXAMPLES:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.rings.function_field sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^3 + x^3*Y + x) # needs sage.rings.function_field - sage: PS = L.place_set() # needs sage.rings.function_field - sage: PS.function_field() == L # needs sage.rings.function_field + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: PS = L.place_set() + sage: PS.function_field() == L True """ return self._field diff --git a/src/sage/rings/function_field/place_rational.py b/src/sage/rings/function_field/place_rational.py index c73d704f387..b6fd87f4fc2 100644 --- a/src/sage/rings/function_field/place_rational.py +++ b/src/sage/rings/function_field/place_rational.py @@ -77,7 +77,7 @@ def residue_field(self, name=None): sage: F. = FunctionField(GF(2)) sage: O = F.maximal_order() sage: p = O.ideal(x^2 + x + 1).place() - sage: k, fr_k, to_k = p.residue_field() + sage: k, fr_k, to_k = p.residue_field() # needs sage.rings.function_field sage: k Finite Field in z2 of size 2^2 sage: fr_k @@ -169,7 +169,7 @@ def valuation_ring(self): EXAMPLES:: sage: K. = FunctionField(GF(2)); _. = K[] - sage: L. = K.extension(Y^2 + Y + x + 1/x) + sage: L. = K.extension(Y^2 + Y + x + 1/x) # needs sage.rings.function_field sage: p = L.places_finite()[0] sage: p.valuation_ring() Valuation ring at Place (x, x*y)