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..9a6f0f613a9 100644 --- a/src/sage/rings/function_field/derivations.py +++ b/src/sage/rings/function_field/derivations.py @@ -4,10 +4,10 @@ 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: 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..2e0fe91a968 100644 --- a/src/sage/rings/function_field/derivations_polymod.py +++ b/src/sage/rings/function_field/derivations_polymod.py @@ -176,24 +176,24 @@ 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: 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: 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]) x*d/dz """ FunctionFieldDerivation.__init__(self, parent) @@ -219,15 +219,15 @@ 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: 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 +242,13 @@ 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: 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 +259,13 @@ 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: 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 +281,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)) + 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 @@ -293,9 +293,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 +311,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)) + 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 @@ -326,9 +326,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)) + sage: h = F.higher_derivation() + sage: loads(dumps(h)) == h True """ if isinstance(other, FunctionFieldHigherDerivation): @@ -344,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) # 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) + sage: e = F.random_element() + sage: _pth_root_in_prime_field(e)^p == e True """ return e @@ -360,9 +360,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 +378,13 @@ 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: 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 +393,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)) + sage: h = F.higher_derivation() + sage: TestSuite(h).run(skip='_test_category') """ FunctionFieldHigherDerivation.__init__(self, field) @@ -408,9 +408,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)) + sage: h = F.higher_derivation() + sage: h(x^2, 2) # indirect doctest 1 """ return self._derive(f, *args, **kwds) @@ -424,17 +424,17 @@ 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: 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 +491,11 @@ 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: 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 +541,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)) + sage: h = F.higher_derivation() + sage: h._pth_root((x^2+1)^2) x^2 + 1 """ K = self._field @@ -570,14 +570,14 @@ 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: 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 +587,10 @@ 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: 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 +615,10 @@ 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: 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 +632,20 @@ 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: 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 +731,11 @@ 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: 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 +777,10 @@ 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: 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..03b327b1abf 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -9,35 +9,38 @@ 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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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 # optional - sage.rings.finite_rings sage.rings.function_field + sage: df (x*y^2 + 1/x*y + 1) d(x) - sage: df.parent() # optional - sage.rings.finite_rings 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() # optional - sage.rings.finite_rings sage.rings.function_field - sage: k.degree() # optional - 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 # optional - 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() # optional - 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 # 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 + sage: w.cartier() == w True AUTHORS: @@ -90,10 +93,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 +105,10 @@ 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: 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 +123,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 +149,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) # needs sage.rings.function_field + 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 +172,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: {x.differential(): 1} # 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.function_field + sage: {x.differential(): 1} {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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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 # optional - sage.rings.finite_rings sage.rings.function_field + sage: w2 < w1 True - sage: w3 == x * w1 + y * w2 # optional - sage.rings.finite_rings sage.rings.function_field + sage: w3 == x * w1 + y * w2 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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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) @@ -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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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) @@ -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.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + 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) @@ -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.function_field + sage: K. = FunctionField(GF(5)); _. = K[] + 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) @@ -332,26 +341,28 @@ 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.function_field + sage: K. = FunctionField(GF(31)); _. = K[] + 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() # optional - sage.rings.finite_rings sage.rings.function_field + sage: 1/(2*z) * y.differential() (8/x*z) d(x) - sage: z * x.differential() # optional - 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() # optional - sage.rings.finite_rings sage.rings.function_field + sage: z * (y^2).differential() (z) d(x) - sage: z * (z^4).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: z * (z^4).differential() (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 +378,10 @@ 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: 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) @@ -381,7 +392,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() @@ -398,10 +409,10 @@ 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: 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 +436,42 @@ 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]) # needs sage.rings.function_field 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.function_field + sage: K. = FunctionField(GF(7)); _. = K[] + 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() # 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() + 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) # 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) + 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 """ @@ -485,12 +499,12 @@ 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: 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 +516,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)) + 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) :: - 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 +545,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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 :: - 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 # needs sage.rings.function_field True """ W = self.parent() @@ -563,9 +579,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 +591,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.function_field + sage: K. = FunctionField(GF(5)) + sage: R. = K[] + sage: L. = K.extension(y^5 - 1/x) + sage: L(x).differential() 0 - sage: y.differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: y.differential() d(y) - sage: (y^2).differential() # optional - sage.rings.finite_rings sage.rings.function_field + sage: (y^2).differential() (2*y) d(y) """ Element = FunctionFieldDifferential @@ -593,10 +610,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.rings.function_field + sage: K. = FunctionField(GF(4)); _.=K[] + 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)) @@ -619,10 +637,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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()) @@ -637,14 +656,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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 # optional - sage.rings.finite_rings sage.rings.function_field + sage: S(y) in S True - sage: S(1) # optional - sage.rings.finite_rings sage.rings.function_field + sage: S(1) 0 """ if f in self.base(): @@ -662,8 +682,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 +699,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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() @@ -693,10 +714,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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() @@ -708,10 +730,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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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())]) @@ -727,9 +750,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 +765,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() + 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 +781,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() + 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 +801,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() + 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 @@ -792,16 +815,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) # 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) + sage: OK = K.space_of_differentials() + sage: OL = L.space_of_differentials() + sage: OL.coerce_map_from(OK).is_surjective() 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[] + 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() @@ -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.function_field sage.rings.number_field + sage: K. = FunctionField(QQbar); _. = K[] + 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/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/element.pyx b/src/sage/rings/function_field/element.pyx index b144cd20d22..9a82b611d18 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.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) @@ -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,55 +180,58 @@ 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: # needs sage.modules sage.rings.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) + sage: y.matrix() [ 0 1] [-4*x^3 x] - sage: y.matrix().charpoly('Z') # optional - 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) # 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) + 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) # optional - 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) # optional - 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)) # 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)) + 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 # optional - 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 # optional - sage.modules sage.rings.function_field + sage: y5 == y4y True """ # multiply each element of the vector space isomorphic to the parent @@ -250,8 +253,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 +266,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 +326,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 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 +347,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 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) @@ -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) # 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) + sage: y.is_integral() True - sage: (y/x).is_integral() # optional - sage.modules sage.rings.function_field + sage: (y/x).is_integral() True - sage: (y/x)^2 - (y/x) + 4*x # optional - sage.modules sage.rings.function_field + sage: (y/x)^2 - (y/x) + 4*x 0 - sage: (y/x^2).is_integral() # optional - sage.modules sage.rings.function_field + sage: (y/x^2).is_integral() False - sage: (y/x).minimal_polynomial('W') # optional - sage.modules sage.rings.function_field + sage: (y/x).minimal_polynomial('W') W^2 - W + 4*x """ R = self.parent().base_field().maximal_order() @@ -387,29 +391,29 @@ 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: 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 d(x) - sage: y.differential() # optional - sage.rings.finite_rings sage.modules sage.rings.function_field + sage: y.differential() # needs sage.modules 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.function_field (8/x*z) d(x) """ F = self.parent() @@ -427,12 +431,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 +456,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.function_field 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 +478,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.libs.pari sage.modules 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.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) @@ -504,16 +508,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.libs.pari sage.modules 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 +534,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.libs.pari sage.modules 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 +561,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.libs.pari sage.modules [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.rings.function_field + 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() @@ -577,16 +581,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.libs.pari sage.modules [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 +605,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: 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: # needs sage.rings.function_field 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) + sage: O = L.maximal_order() + sage: p = O.ideal(x - 1).place() + sage: y.valuation(p) 0 """ prime = place.prime_ideal() @@ -636,23 +641,24 @@ 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: 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.rings.function_field + sage: K. = FunctionField(GF(4)); _. = K[] + 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: (y/x + 1).evaluate(p) 1 """ R, _, to_R = place._residue_field() @@ -685,9 +691,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 +717,10 @@ 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: 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..9e198d0b042 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -276,22 +276,22 @@ 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: 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: 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 +337,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 +375,10 @@ 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: 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..0d306d6826e 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.libs.pari (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.libs.pari + 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.libs.pari + sage: (1/x^2).valuation(p) # needs sage.libs.pari -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.libs.pari True - sage: (-t^2).sqrt() # optional - sage.rings.finite_rings + sage: (-t^2).sqrt() # needs sage.libs.pari 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: @@ -473,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() # optional - sage.rings.finite_rings + sage: f.factor() (t + 1) * (t^2 - 1/3)^-1 - sage: (7*f).factor() # optional - sage.rings.finite_rings + sage: (7*f).factor() (7) * (t + 1) * (t^2 - 1/3)^-1 - sage: ((7*f).factor()).unit() # optional - sage.rings.finite_rings + sage: ((7*f).factor()).unit() 7 - sage: (f^3).factor() # optional - sage.rings.finite_rings + 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 10a81cc3c1e..9e42e5bff6b 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.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) # optional - 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) 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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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) # 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) + 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) # 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) + sage: E.conorm_place(q) # random 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 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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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() @@ -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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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 @@ -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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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 @@ -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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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) # 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) + sage: d = E.conorm_place(p) + sage: [pl.degree() for pl in d.support()] [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.rings.function_field + sage: K. = FunctionField(GF(2)); R. = K[] + 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 75c8fc1e0b0..973d9a8f505 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -9,122 +9,129 @@ 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.rings.function_field + sage: R. = K[] + 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 # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 y^2 - sage: y^3 # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^3 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 (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 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: 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.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) # 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) + 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() # optional - sage.rings.function_field + sage: (2*D).basis_function_space() [1] - sage: (3*D).basis_function_space() # optional - sage.rings.function_field + sage: (3*D).basis_function_space() [1] - sage: (4*D).basis_function_space() # optional - 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) # 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) + sage: O = F.maximal_order() + 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) # 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) + 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: 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.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() + 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] # 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] + sage: m = L.completion(pl, prec=5) + sage: m(x) 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) -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) 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) - sage: TestSuite(N).run(max_runs=8, skip = '_test_derivation') # long time (15s) - 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 + 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 + sage: TestSuite(N).run(max_runs=8, skip='_test_derivation') # long time (15s), needs sage.rings.finite_rings + 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 Global function fields ---------------------- @@ -139,31 +146,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.function_field + sage: K. = FunctionField(GF(3)); _. = K[] + 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 # optional - sage.rings.finite_rings 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 # 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 + 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() # optional - sage.rings.finite_rings 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: 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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x^3*Y + x) + sage: L.genus() 3 - sage: L.weierstrass_places() # optional - sage.rings.finite_rings 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), @@ -174,17 +183,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 [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.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 +313,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 +341,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 +376,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.function_field + sage: L.characteristic() # needs sage.rings.function_field 7 """ return self.constant_base_field().characteristic() @@ -388,8 +398,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 +414,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 +441,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 +478,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) @@ -510,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) # 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) + 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() # optional - sage.modules sage.rings.function_field + sage: O.basis() # needs sage.modules (1, y, y^2) - sage: Z = K.order(x); Z # optional - 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() # optional - 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 # optional - sage.modules + sage: Z = K.order([x, x^2]); Z # needs sage.rings.function_field Traceback (most recent call last): ... NotImplementedError @@ -555,25 +566,26 @@ 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) # 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) + 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() # optional - 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 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 +593,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 +614,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 @@ -638,35 +650,36 @@ 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) # 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) + 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()) # optional - 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)) # optional - 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()) # 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.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.function_field + sage: M. = FunctionField(GaussianIntegers().fraction_field()) # needs 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:: @@ -732,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()) @@ -764,8 +780,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 +815,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 +864,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 +894,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 +947,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) # 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: # 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) @@ -939,10 +958,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.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 +970,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.function_field + sage: R. = K[] + 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 # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(x^3 - t) # not tested 1 - sage: w(x - w) # not tested # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(x - w) # not tested 1/3 There are several ways to create valuations on extensions of rational @@ -967,12 +988,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 +1007,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.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) """ @@ -1004,7 +1025,7 @@ def space_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.space_of_holomorphic_differentials() # optional - sage.modules + sage: K.space_of_holomorphic_differentials() # needs sage.libs.pari sage.modules (Vector space of dimension 0 over Rational Field, Linear map: From: Vector space of dimension 0 over Rational Field @@ -1013,9 +1034,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.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 @@ -1037,12 +1058,12 @@ def basis_of_holomorphic_differentials(self): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.basis_of_holomorphic_differentials() # optional - sage.modules + sage: K.basis_of_holomorphic_differentials() # needs sage.libs.pari sage.modules [] - 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.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), @@ -1059,17 +1080,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.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 @@ -1081,17 +1102,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.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 @@ -1115,83 +1136,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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) # optional - sage.rings.finite_rings 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(y, 10) 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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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) # optional - sage.rings.finite_rings 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: m(y, 10) 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: K. = FunctionField(GF(2)) + sage: p = K.places_finite()[0]; p # needs sage.libs.pari Place (x) - sage: m = K.completion(p); m # optional - sage.rings.finite_rings + 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(1/(x+1)) # optional - sage.rings.finite_rings + 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) - sage: p = K.place_infinite(); p # optional - sage.rings.finite_rings + sage: p = K.place_infinite(); p Place (1/x) - sage: m = K.completion(p); m # optional - sage.rings.finite_rings + 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) # optional - sage.rings.finite_rings + sage: m(x) # needs sage.rings.function_field 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.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 # optional - sage.rings.finite_rings + sage: f = m(x); f # needs sage.rings.function_field s^-1 + ... - sage: f.coefficient(100) # optional - sage.rings.finite_rings + sage: f.coefficient(100) # needs sage.rings.function_field 0 + sage: # needs sage.rings.function_field 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) + 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) # 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 - 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 +1232,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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() # optional - sage.rings.finite_rings sage.rings.function_field + sage: E.constant_base_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 88d1c2cc0a3..42796b998bf 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,14 @@ 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: 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 +101,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 +135,11 @@ def __init__(self, constant_field, names, category=None): EXAMPLES:: - sage: K. = FunctionField(CC); K + 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 +252,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 +340,10 @@ 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: 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 +368,43 @@ 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: R. = FunctionField(GF(7)) + sage: S. = R[] + sage: f = (1/t)*(X^4 - 1/t^2)*(X^3 - t^3) + 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 # optional - sage.rings.finite_rings + sage: f.factor().prod() == f # needs sage.libs.pari 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 +453,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,19 +520,23 @@ def free_module(self, base=None, basis=None, map=True): EXAMPLES:: sage: K. = FunctionField(QQ) - sage: K.free_module() # optional - sage.modules - (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: + 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: + 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() # optional - sage.modules - (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism: + 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: + 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) @@ -625,8 +632,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 +659,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.function_field + sage: K. = FunctionField(GF(7)); R. = K[] + 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: f(x) y^2 + y + 2 - sage: f(x^2) # optional - sage.rings.finite_rings 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): @@ -692,8 +700,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 +778,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 +853,12 @@ 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: 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.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 # optional - sage.rings.finite_rings + sage: to_R(x) in R # needs sage.libs.pari sage.rings.function_field 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.modules - sage: [d(x^5,i) for i in range(10)] # optional - 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.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.libs.pari [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.libs.pari [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,17 @@ 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: F. = GF(2) + sage: K. = FunctionField(F) + sage: K.get_place(1) # needs sage.libs.pari Place (x) - sage: K.get_place(2) # optional - sage.rings.finite_rings + sage: K.get_place(2) # needs sage.libs.pari Place (x^2 + x + 1) - sage: K.get_place(3) # optional - sage.rings.finite_rings + sage: K.get_place(3) # needs sage.libs.pari Place (x^3 + x + 1) - sage: K.get_place(4) # optional - sage.rings.finite_rings + sage: K.get_place(4) # needs sage.libs.pari Place (x^4 + x + 1) - sage: K.get_place(5) # optional - sage.rings.finite_rings + sage: K.get_place(5) # needs sage.libs.pari Place (x^5 + x^2 + 1) """ @@ -999,11 +1007,11 @@ 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: F. = FunctionField(GF(5)) + sage: d = F.higher_derivation() # needs sage.rings.function_field + 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)] # optional - sage.rings.finite_rings + 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/ideal.py b/src/sage/rings/function_field/ideal.py index 91e9e0519aa..22aa15299b1 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(): @@ -162,42 +166,47 @@ 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) # 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) + 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: 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.function_field + 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); 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) # 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.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: 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: 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.rings.function_field + 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: 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: 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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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 """ @@ -212,11 +221,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.function_field + 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: latex(I) \left(y\right) """ return '\\left(' + ', '.join(latex(g) for g in self.gens_reduced()) + '\\right)' @@ -231,10 +241,10 @@ 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: 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,10 @@ 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: 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 +287,10 @@ 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: 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 @@ -291,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) # 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) + 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() @@ -306,63 +317,68 @@ 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: 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.function_field + 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.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: 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.function_field + 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.place() for f,_ in I.factor()] [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.rings.function_field + 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) + 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.rings.function_field - sage: J.is_prime() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.place() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J.place() 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.function_field + 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.rings.function_field - sage: J.is_prime() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J = I.factor()[0][0] + sage: J.is_prime() True - sage: J.place() # optional - sage.rings.finite_rings sage.rings.function_field + sage: J.place() Place (1/x, 1/x*y) """ if not self.is_prime(): @@ -380,49 +396,55 @@ 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: # 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: 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.function_field + 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: I == I.factor().prod() 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.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: # needs sage.rings.function_field 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) + 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) # 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) + sage: O = L.maximal_order() + sage: I = O.ideal(y) + sage: I == I.factor().prod() True """ @@ -434,42 +456,48 @@ 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: # 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: 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.function_field + 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: 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() # 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: # 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: 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.function_field + 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.divisor() - 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: # 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 @@ -487,23 +515,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.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: 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.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: 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.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() + sage: I = O.ideal(y) + sage: I.divisor_of_zeros() 2*Place (x + 1, x*y) """ from .divisor import divisor @@ -521,23 +552,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.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: 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.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: 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.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() + sage: I = O.ideal(y) + sage: I.divisor_of_poles() Place (x, x*y) """ from .divisor import divisor @@ -565,13 +599,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) # 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) + 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 # optional - 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): @@ -580,11 +615,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) # 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) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdeal.__init__(self, ring) @@ -603,16 +639,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) # 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) + 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 # optional - sage.rings.function_field + sage: y in I True - sage: y/x in I # optional - sage.rings.function_field + sage: y/x in I False - sage: y^2 - 2 in I # optional - sage.rings.function_field + sage: y^2 - 2 in I False """ return self._structure[2](x) in self._module @@ -623,11 +660,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) # 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) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: d = {I: 1} # indirect doctest """ return hash((self._ring,self._module)) @@ -637,19 +675,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) # 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) + 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 # optional - sage.rings.function_field + sage: I + I == I # indirect doctest True - sage: I == J # optional - sage.rings.function_field + sage: I == J False - sage: I < J # optional - sage.rings.function_field + sage: I < J True - sage: J < I # optional - sage.rings.function_field + sage: J < I False """ return richcmp(self.module().basis(), other.module().basis(), op) @@ -668,21 +707,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) # 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) + 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) # optional - sage.rings.function_field - sage: I.gens() # optional - sage.rings.function_field + sage: I = O.ideal(x^2 + 1) + sage: I.gens() (x^2 + 1, (x^2 + 1)*y) - sage: I.module() # optional - 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 # optional - 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) # optional - sage.rings.function_field + sage: I.module().is_submodule(V) True """ return self._module @@ -693,11 +733,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) # 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) + 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 @@ -708,11 +749,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) # 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) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.gen(1) (x^2 + 1)*y """ return self._gens[i] @@ -723,11 +765,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) # 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) + sage: O = L.equation_order() + sage: I = O.ideal(x^2 + 1) + sage: I.ngens() 2 """ return len(self._gens) @@ -738,12 +781,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) # 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) + 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()) @@ -754,12 +798,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) # 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) + 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()]) @@ -770,11 +815,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) # 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) + 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()]) @@ -785,15 +831,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) # 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) + 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 # optional - sage.rings.function_field + sage: y^2 in Z False - sage: y^3 in Z # optional - sage.rings.function_field + sage: y^3 in Z True """ if not isinstance(other, FunctionFieldIdeal): @@ -815,15 +862,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) # 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) + 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 # optional - 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 # optional - 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: @@ -861,10 +909,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) # 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) + 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): @@ -873,11 +922,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) # 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) + sage: O = L.equation_order() + sage: I = O.ideal(y) + sage: TestSuite(I).run() """ FunctionFieldIdealInfinite.__init__(self, ring) @@ -901,16 +951,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.function_field + 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([1, y]); I 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 True - sage: y/x in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y/x in I False - sage: y^2 - 2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 - 2 in I True """ return self._structure[2](x) in self._module @@ -921,11 +972,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.function_field + 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([1, y]) + sage: d = {I: 2} # indirect doctest """ return hash((self._ring,self._module)) @@ -939,11 +991,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.function_field + 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([1, y]) + sage: I == I + I # indirect doctest True """ if not isinstance(other, FunctionFieldIdeal_module): @@ -967,21 +1020,24 @@ 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: 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 - 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: 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)]) + sage: I.gens() (x^2 + 1,) - sage: I.module() # optional - sage.rings.finite_rings - 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 # optional - sage.rings.finite_rings - 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: 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 @@ -997,9 +1053,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 +1065,10 @@ 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: 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 +1082,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 +1095,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 +1108,12 @@ 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: 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 +1128,12 @@ 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: 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 +1147,10 @@ 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: 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_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)] diff --git a/src/sage/rings/function_field/ideal_rational.py b/src/sage/rings/function_field/ideal_rational.py index 06400bf31f1..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()] # optional - 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() @@ -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.libs.pari [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.libs.pari 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.libs.pari 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.libs.pari -3 - sage: p.valuation(O.ideal(0)) # indirect doctest # optional - sage.rings.finite_rings + sage: p.valuation(O.ideal(0)) # indirect doctest # needs sage.libs.pari +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..52732cad62a 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.function_field + sage: K. = FunctionField(GF(3)); R. = K[] + sage: L. = K.extension(y^3 - y - x) + sage: O = L.equation_order() + sage: 1/y in O False - sage: x/y in O # optional - sage.rings.finite_rings 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: 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: K. = FunctionField(GF(2)); _. = K[] + sage: o = K.maximal_order() + sage: p = o.ideal(x + 1) + sage: p.is_prime() # needs sage.libs.pari 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: # 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: 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.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.function_field sage.rings.number_field + sage: K. = FunctionField(QQbar) + sage: R. = K[] + sage: L. = K.extension(y^2 - (x^3-x^2)) + sage: p = K.maximal_order().ideal(x) + 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), @@ -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.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 1b0a4434d2c..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 """ @@ -34,9 +33,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.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)) # 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 + 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)) # optional - 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)) # optional - 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,10 +73,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.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() + sage: TestSuite(O).run() """ if len(basis) == 0: raise ValueError("basis must have positive length") @@ -156,13 +159,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.function_field + sage: K. = FunctionField(GF(7)); R. = K[] + 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 # optional - sage.rings.finite_rings 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() # optional - sage.rings.finite_rings 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: @@ -171,14 +175,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.function_field + 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.rings.function_field + sage: y in I True - sage: y^2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 in I False """ F = self.function_field() @@ -211,16 +216,19 @@ 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 - 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: K. = FunctionField(GF(7)); R. = K[] + sage: O = K.maximal_order() + sage: I = O.ideal(x^2 - 4) + + 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: I2 == S.ideal(I) True """ if len(gens) == 1: @@ -240,10 +248,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.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() + sage: O.polynomial() y^4 + x*y + 4*x + 1 """ return self._field.polynomial() @@ -254,10 +263,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.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() + sage: O.basis() (1, y, y^2, y^3) """ return self._basis @@ -269,10 +279,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.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() + 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: @@ -293,11 +304,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.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() + 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) @@ -316,25 +328,26 @@ 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.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 # 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.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 # 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.function_field Traceback (most recent call last): ... ValueError: The given basis vectors must be linearly independent. @@ -342,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 # optional - 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() # optional - 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): @@ -353,10 +367,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.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() + sage: TestSuite(O).run() """ if len(basis) == 0: raise ValueError("basis must have positive length") @@ -446,28 +461,31 @@ 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.function_field + sage: K. = FunctionField(GF(7)); R. = K[] + 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 # optional - sage.rings.finite_rings 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() # optional - sage.rings.finite_rings 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: 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.function_field + 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.rings.function_field + sage: y in I True - sage: y^2 in I # optional - sage.rings.finite_rings sage.rings.function_field + sage: y^2 in I False """ F = self.function_field() @@ -503,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) # 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 +541,10 @@ 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: 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 +555,10 @@ 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: 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 +570,10 @@ 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: 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 9a57abfafe5..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: # 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..48ea2a2c32f 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.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,20 +21,20 @@ 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: F. = FunctionField(GF(2)) + sage: O = F.maximal_order() + 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 # optional - 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 # optional - 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 @@ -77,9 +77,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.function_field + sage: L.places_finite()[0] # needs sage.rings.function_field Place (x, y) """ def __init__(self, parent, prime): @@ -88,10 +88,10 @@ 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: 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 +103,10 @@ 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: 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 +117,10 @@ 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: 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 +136,10 @@ 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: 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 +150,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + sage: L. = K.extension(Y^3 + x + x^3*Y) + sage: p1, p2, p3 = L.places()[:3] + sage: p1 < p2 True - sage: p2 < p1 # optional - sage.rings.finite_rings sage.rings.function_field + sage: p2 < p1 False - sage: p1 == p3 # optional - sage.rings.finite_rings sage.rings.function_field + sage: p1 == p3 False """ from sage.rings.function_field.order import FunctionFieldOrderInfinite @@ -176,12 +177,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.function_field + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + 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: -3*P + 5*P 2*Place (x + 1, y) """ if self_on_left: @@ -194,10 +196,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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) """ @@ -210,10 +213,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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) @@ -227,10 +231,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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) """ @@ -246,14 +251,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.libs.pari 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 +277,10 @@ 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: 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 +291,10 @@ 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: 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 +306,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.function_field + sage: K. = FunctionField(GF(5)); R. = PolynomialRing(K) + 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 @@ -323,9 +329,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.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 @@ -336,10 +342,10 @@ 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: 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 +358,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.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) @@ -365,11 +371,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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 @@ -385,10 +392,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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 """ @@ -408,10 +416,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.function_field + sage: K. = FunctionField(GF(2)); _. = K[] + 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_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/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) diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 90d5a2dae3e..5eecbb38095 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,19 @@ 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: 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 +106,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 + 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)) + 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:: @@ -122,8 +122,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,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) # optional - sage.rings.function_field - sage: v = K.valuation(x) # optional - sage.rings.function_field - sage: v.extensions(L) # optional - 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 @@ -352,11 +354,11 @@ 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: 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.function_field + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) + sage: v = K.valuation(1/x) + 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 @@ -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.function_field + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + 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() @@ -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)) + sage: v = K.valuation(x) # indirect doctest 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) True """ @@ -602,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) # 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) + 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) # optional - sage.rings.number_field + sage: w.element_with_valuation(1) 2 """ @@ -632,10 +637,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)) + sage: v = K.valuation(x) # indirect doctest 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) True """ @@ -990,7 +995,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:: @@ -1000,14 +1005,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)) + 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 # optional - sage.rings.finite_rings + sage: q = L.valuation(x^6 - t); q (x^6 + 2*t)-adic valuation """ @@ -1036,7 +1041,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 """ @@ -1079,8 +1084,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 +1116,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 """ @@ -1121,13 +1126,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)) # 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)) + 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) # optional - sage.rings.function_field + sage: isinstance(w, FunctionFieldFromLimitValuation) True """ @@ -1140,12 +1146,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)) # 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)) + 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 """ @@ -1157,12 +1164,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)) # 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)) + sage: v = K.valuation(x - 1) # indirect doctest + sage: w = v.extension(L) + sage: 3*w 3 * (x - 1)-adic valuation """ @@ -1178,8 +1186,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)) + sage: v = K.valuation(1/x); v Valuation at the infinite place """ @@ -1187,10 +1195,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)) + sage: v = K.valuation(1/x) 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) True """ @@ -1206,12 +1214,12 @@ 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: 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 +1231,12 @@ 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: 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 +1248,12 @@ 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: 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 +1268,11 @@ 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: 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 """ @@ -1279,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) # 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) + sage: v = K.valuation(1/x) + sage: w0,w1 = v.extensions(L) + sage: w0.is_discrete_valuation() True """ @@ -1299,8 +1308,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)) + sage: v = K.valuation(1/x); v Valuation at the infinite place """ @@ -1308,10 +1317,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)) + sage: v = K.valuation(1/x) 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) True """ @@ -1325,8 +1334,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)) + sage: K.valuation(1/x).restriction(GF(2)) Trivial valuation on Finite Field of size 2 """ @@ -1377,7 +1386,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): @@ -1385,7 +1394,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 @@ -1403,7 +1412,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 """ @@ -1420,23 +1429,23 @@ 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: 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.function_field -1 - sage: w(y) # optional - sage.rings.finite_rings sage.rings.function_field + sage: w(y) # needs sage.rings.function_field -3/2 - sage: w.uniformizer() # optional - 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) # optional - sage.rings.finite_rings sage.rings.function_field + sage: isinstance(w, FunctionFieldExtensionMappedValuation) # needs sage.rings.function_field True """ @@ -1446,18 +1455,20 @@ 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.function_field + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + 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) # 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) + 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] @@ -1473,12 +1484,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.function_field + sage: K. = FunctionField(GF(2)) + sage: R. = K[] + sage: L. = K.extension(y^2 + y + x^3) + sage: v = K.valuation(1/x) + sage: w = v.extension(L) + sage: w.restriction(K) is v True """ if ring.is_subring(self.domain().base()):