From 7ab69d4fb3477501039088a172b722834e768d29 Mon Sep 17 00:00:00 2001 From: gmou3 Date: Tue, 2 Jul 2024 17:55:48 +0300 Subject: [PATCH] Docstring edits More work in `rings`. --- src/sage/combinat/dlx.py | 2 +- src/sage/combinat/integer_vector.py | 2 +- src/sage/combinat/matrices/dlxcpp.py | 2 +- src/sage/combinat/parking_functions.py | 2 +- .../combinat/root_system/dynkin_diagram.py | 2 +- src/sage/rings/asymptotic/growth_group.py | 4 +- .../asymptotic/growth_group_cartesian.py | 2 +- src/sage/rings/asymptotic/term_monoid.py | 2 +- src/sage/rings/finite_rings/element_base.pyx | 10 +- .../rings/finite_rings/element_givaro.pyx | 42 +- .../rings/finite_rings/element_ntl_gf2e.pyx | 4 +- .../rings/finite_rings/element_pari_ffelt.pyx | 4 +- .../rings/finite_rings/finite_field_base.pyx | 109 ++-- .../finite_rings/finite_field_constructor.py | 27 +- .../rings/finite_rings/finite_field_givaro.py | 28 +- .../finite_rings/finite_field_ntl_gf2e.py | 10 +- .../finite_rings/finite_field_pari_ffelt.py | 4 +- .../finite_rings/finite_field_prime_modn.py | 11 +- src/sage/rings/finite_rings/galois_group.py | 4 +- .../rings/finite_rings/hom_finite_field.pyx | 18 +- .../finite_rings/hom_prime_finite_field.pyx | 4 +- src/sage/rings/finite_rings/homset.py | 9 +- src/sage/rings/finite_rings/integer_mod.pyx | 286 +++++----- .../rings/finite_rings/integer_mod_ring.py | 42 +- .../rings/finite_rings/maps_finite_field.py | 1 - src/sage/rings/finite_rings/residue_field.pyx | 39 +- .../finite_rings/residue_field_givaro.pyx | 4 +- .../finite_rings/residue_field_ntl_gf2e.pyx | 2 +- src/sage/rings/function_field/constructor.py | 1 - .../function_field/derivations_polymod.py | 1 - src/sage/rings/function_field/differential.py | 7 +- src/sage/rings/function_field/divisor.py | 4 +- .../function_field/drinfeld_modules/action.py | 4 +- .../charzero_drinfeld_module.py | 22 +- .../drinfeld_modules/drinfeld_module.py | 45 +- .../finite_drinfeld_module.py | 15 +- .../function_field/drinfeld_modules/homset.py | 11 +- .../drinfeld_modules/morphism.py | 22 +- src/sage/rings/function_field/element.pyx | 13 +- .../rings/function_field/element_polymod.pyx | 8 +- .../rings/function_field/element_rational.pyx | 11 +- src/sage/rings/function_field/extensions.py | 1 - .../rings/function_field/function_field.py | 19 +- .../function_field/function_field_polymod.py | 36 +- .../function_field/function_field_rational.py | 34 +- .../rings/function_field/jacobian_base.py | 8 +- .../rings/function_field/jacobian_hess.py | 2 +- .../function_field/jacobian_khuri_makdisi.py | 6 +- .../rings/function_field/khuri_makdisi.pyx | 2 +- src/sage/rings/function_field/maps.py | 18 +- src/sage/rings/function_field/order_basis.py | 4 +- .../rings/function_field/order_polymod.py | 7 +- .../rings/function_field/order_rational.py | 4 +- .../rings/function_field/place_polymod.py | 2 +- src/sage/rings/function_field/valuation.py | 51 -- src/sage/rings/invariants/invariant_theory.py | 2 +- src/sage/rings/lazy_series.py | 58 +-- src/sage/rings/multi_power_series_ring.py | 53 +- .../rings/multi_power_series_ring_element.py | 39 +- src/sage/rings/number_field/S_unit_solver.py | 203 +++++--- src/sage/rings/number_field/bdd_height.py | 27 +- src/sage/rings/number_field/class_group.py | 3 +- src/sage/rings/number_field/galois_group.py | 31 +- src/sage/rings/number_field/morphism.py | 10 +- src/sage/rings/number_field/number_field.py | 490 ++++++++---------- .../number_field/number_field_element.pyx | 243 ++++----- .../number_field_element_base.pyx | 7 +- .../number_field_element_quadratic.pyx | 48 +- .../rings/number_field/number_field_ideal.py | 135 +++-- .../number_field/number_field_ideal_rel.py | 27 +- .../number_field/number_field_morphisms.pyx | 11 +- .../rings/number_field/number_field_rel.py | 94 ++-- src/sage/rings/number_field/order.py | 108 ++-- src/sage/rings/number_field/order_ideal.py | 2 +- src/sage/rings/number_field/selmer_group.py | 74 ++- .../small_primes_of_degree_one.py | 18 +- .../rings/number_field/splitting_field.py | 12 +- src/sage/rings/number_field/structure.py | 20 +- src/sage/rings/number_field/totallyreal.pyx | 29 +- .../rings/number_field/totallyreal_data.pyx | 21 +- .../rings/number_field/totallyreal_phc.py | 8 +- .../rings/number_field/totallyreal_rel.py | 67 ++- src/sage/rings/number_field/unit_group.py | 25 +- src/sage/rings/padics/CA_template.pxi | 42 +- src/sage/rings/padics/common_conversion.pyx | 85 ++- src/sage/rings/puiseux_series_ring.py | 4 +- .../rings/puiseux_series_ring_element.pyx | 4 +- src/sage/rings/qqbar.py | 170 +++--- src/sage/rings/quotient_ring_element.py | 25 +- src/sage/rings/real_double.pyx | 39 +- src/sage/rings/real_double_element_gsl.pyx | 8 +- src/sage/rings/real_field.py | 4 +- src/sage/rings/real_interval_absolute.pyx | 2 +- src/sage/rings/ring_extension_conversion.pyx | 10 +- src/sage/rings/ring_extension_element.pyx | 17 +- src/sage/rings/ring_extension_morphism.pyx | 10 +- src/sage/rings/sum_of_squares.pyx | 4 +- src/sage/rings/tate_algebra_element.pyx | 200 +++---- src/sage/tests/benchmark.py | 2 +- src/sage/topology/cell_complex.py | 2 +- 100 files changed, 1561 insertions(+), 1966 deletions(-) diff --git a/src/sage/combinat/dlx.py b/src/sage/combinat/dlx.py index b2b7bf32ca8..f52bca47875 100644 --- a/src/sage/combinat/dlx.py +++ b/src/sage/combinat/dlx.py @@ -55,7 +55,7 @@ def __init__(self, ones, initialsolution=None): described by Knuth. Consider a matrix M with entries of 0 and 1, and compute a subset - of the rows of this matrix which sum to the vector of all 1's. + of the rows of this matrix which sum to the vector of all 1s. The dancing links algorithm works particularly well for sparse matrices, so the input is a list of lists of the form: (note the diff --git a/src/sage/combinat/integer_vector.py b/src/sage/combinat/integer_vector.py index 725a910593f..516d2114ffc 100644 --- a/src/sage/combinat/integer_vector.py +++ b/src/sage/combinat/integer_vector.py @@ -177,7 +177,7 @@ def gale_ryser_theorem(p1, p2, algorithm='gale', * Construct the `m \times n` matrix `B` from `r` by defining the `i`-th row of `B` to be the vector whose first `r_i` - entries are `1`, and the remainder are 0's, `1 \leq i \leq m`. + entries are `1`, and the remainder are 0s, `1 \leq i \leq m`. This maximal matrix `B` with row sum `r` and ones left justified has column sum `r^{*}`. diff --git a/src/sage/combinat/matrices/dlxcpp.py b/src/sage/combinat/matrices/dlxcpp.py index 8a96215deb2..15c6eddbbdc 100644 --- a/src/sage/combinat/matrices/dlxcpp.py +++ b/src/sage/combinat/matrices/dlxcpp.py @@ -28,7 +28,7 @@ def DLXCPP(rows): described by Knuth. Consider a matrix M with entries of 0 and 1, and compute a subset - of the rows of this matrix which sum to the vector of all 1's. + of the rows of this matrix which sum to the vector of all 1s. The dancing links algorithm works particularly well for sparse matrices, so the input is a list of lists of the form:: diff --git a/src/sage/combinat/parking_functions.py b/src/sage/combinat/parking_functions.py index 8f0e262a8c8..c42787d9d28 100644 --- a/src/sage/combinat/parking_functions.py +++ b/src/sage/combinat/parking_functions.py @@ -132,7 +132,7 @@ class ParkingFunction(ClonableArray, metaclass=InheritComparisonClasscallMetacla - ``area_sequence`` -- (default: ``None``) an area sequence of a Dyck path - - ``labelled_dyck_word`` -- (default: ``None``) a Dyck word with 1's + - ``labelled_dyck_word`` -- (default: ``None``) a Dyck word with 1s replaced by labelling OUTPUT: a parking function diff --git a/src/sage/combinat/root_system/dynkin_diagram.py b/src/sage/combinat/root_system/dynkin_diagram.py index d026af50aae..76411c66158 100644 --- a/src/sage/combinat/root_system/dynkin_diagram.py +++ b/src/sage/combinat/root_system/dynkin_diagram.py @@ -160,7 +160,7 @@ def DynkinDiagram(*args, **kwds): TESTS: - Check that :issue:`15277` is fixed by not having edges from 0's:: + Check that :issue:`15277` is fixed by not having edges from 0s:: sage: CM = CartanMatrix([[2,-1,0,0],[-3,2,-2,-2],[0,-1,2,-1],[0,-1,-1,2]]) sage: CM diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py index 2d5498e5745..360fc3687fa 100644 --- a/src/sage/rings/asymptotic/growth_group.py +++ b/src/sage/rings/asymptotic/growth_group.py @@ -1425,7 +1425,7 @@ def _rpow_element_(self, base): - ``base`` -- an element - OUTPUT: nothing since a ``ValueError`` is raised in this generic method + OUTPUT: nothing since a :exc:`ValueError` is raised in this generic method TESTS:: @@ -3028,7 +3028,7 @@ def _rpow_element_(self, base, locals=None): The parent of the result can be different from the parent of this element. - A ``ValueError`` is raised if the calculation is not possible + A :exc:`ValueError` is raised if the calculation is not possible within this method. (Then the calling method should take care of the calculation.) diff --git a/src/sage/rings/asymptotic/growth_group_cartesian.py b/src/sage/rings/asymptotic/growth_group_cartesian.py index 1f99c2503b8..0bdb3d4a1eb 100644 --- a/src/sage/rings/asymptotic/growth_group_cartesian.py +++ b/src/sage/rings/asymptotic/growth_group_cartesian.py @@ -1080,7 +1080,7 @@ def _rpow_element_(self, base): The parent of the result can be different from the parent of this element. - A ``ValueError`` is raised if the calculation is not possible + A :exc:`ValueError` is raised if the calculation is not possible within this method. (Then the calling method should take care of the calculation.) diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py index 3c240a7dbec..c16260d298e 100644 --- a/src/sage/rings/asymptotic/term_monoid.py +++ b/src/sage/rings/asymptotic/term_monoid.py @@ -2431,7 +2431,7 @@ def __invert__(self): OUTPUT: - A :class:`ZeroDivisionError` since `O`-terms cannot be inverted. + A :exc:`ZeroDivisionError` since `O`-terms cannot be inverted. TESTS:: diff --git a/src/sage/rings/finite_rings/element_base.pyx b/src/sage/rings/finite_rings/element_base.pyx index ae3c7341533..2f67c6bbc67 100755 --- a/src/sage/rings/finite_rings/element_base.pyx +++ b/src/sage/rings/finite_rings/element_base.pyx @@ -829,9 +829,9 @@ cdef class FinitePolyExtElement(FiniteRingElement): - ``n`` -- integer `\geq 1` - - ``extend`` -- boolean (default: ``False``); if ``True``, return an `n`-th - root in an extension ring, if necessary. Otherwise, raise a - ValueError if the root is not in the base ring. Warning: + - ``extend`` -- boolean (default: ``False``); if ``True``, return an + `n`-th root in an extension ring, if necessary. Otherwise, raise a + :exc:`ValueError` if the root is not in the base ring. Warning: this option is not implemented! - ``all`` -- boolean (default: ``False``); if ``True``, return all `n`-th @@ -846,8 +846,8 @@ cdef class FinitePolyExtElement(FiniteRingElement): If ``self`` has an `n`-th root, returns one (if ``all`` is ``False``) or a list of all of them (if ``all`` is ``True``). - Otherwise, raises a ``ValueError`` (if ``extend`` is ``False``) - or a ``NotImplementedError`` (if ``extend`` is ``True``). + Otherwise, raises a :exc:`ValueError` (if ``extend`` is ``False``) + or a :exc:`NotImplementedError` (if ``extend`` is ``True``). .. warning:: diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index 86edaf704c8..907c2161850 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -106,7 +106,7 @@ cdef void late_import() noexcept: cdef class Cache_givaro(Cache_base): - def __init__(self, parent, unsigned int p, unsigned int k, modulus, repr="poly", cache=False): + def __init__(self, parent, unsigned int p, unsigned int k, modulus, repr='poly', cache=False): """ Finite Field. @@ -120,16 +120,16 @@ cdef class Cache_givaro(Cache_base): - ``name`` -- variable used for poly_repr (default: ``'a'``) - - ``modulus`` -- a polynomial to use as modulus. + - ``modulus`` -- a polynomial to use as modulus - - ``repr`` -- (default: 'poly') controls the way elements are printed + - ``repr`` -- (default: ``'poly'``) controls the way elements are printed to the user: - 'log': repr is :meth:`~FiniteField_givaroElement.log_repr()` - 'int': repr is :meth:`~FiniteField_givaroElement.int_repr()` - 'poly': repr is :meth:`~FiniteField_givaroElement.poly_repr()` - - ``cache`` -- (default: ``False``) if ``True`` a cache of all + - ``cache`` -- boolean (default: ``False``); if ``True`` a cache of all elements of this field is created. Thus, arithmetic does not create new elements which speeds calculations up. Also, if many elements are needed during a calculation this cache reduces the @@ -299,7 +299,7 @@ cdef class Cache_givaro(Cache_base): INPUT: - - ``e`` -- data to coerce in. + - ``e`` -- data to coerce in EXAMPLES:: @@ -841,7 +841,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def __init__(FiniteField_givaroElement self, parent): """ - Initializes an element in parent. It's much better to use + Initialize an element in parent. It's much better to use parent() or any specialized method of parent like gen() instead. In general do not call this constructor directly. @@ -862,7 +862,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): sage: from sage.rings.finite_rings.element_givaro import FiniteField_givaroElement sage: FiniteField_givaroElement(k) 0 - """ FinitePolyExtElement.__init__(self, parent) self._cache = parent._cache @@ -936,7 +935,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def is_unit(FiniteField_givaroElement self): """ - Return ``True`` if self is nonzero, so it is a unit as an element of + Return ``True`` if ``self`` is nonzero, so it is a unit as an element of the finite field. EXAMPLES:: @@ -956,7 +955,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def is_square(FiniteField_givaroElement self): """ - Return ``True`` if ``self`` is a square in ``self.parent()`` + Return ``True`` if ``self`` is a square in ``self.parent()``. ALGORITHM: @@ -998,20 +997,20 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def sqrt(FiniteField_givaroElement self, extend=False, all=False): """ Return a square root of this finite field element in its - parent, if there is one. Otherwise, raise a ``ValueError``. + parent, if there is one. Otherwise, raise a :exc:`ValueError`. INPUT: - - ``extend`` -- bool (default: ``True``); if ``True``, return a + - ``extend`` -- boolean (default: ``True``); if ``True``, return a square root in an extension ring, if necessary. Otherwise, - raise a ``ValueError`` if the root is not in the base ring. + raise a :exc:`ValueError` if the root is not in the base ring. .. WARNING:: this option is not implemented! - - ``all`` -- bool (default: ``False``); if ``True``, return all square - roots of ``self``, instead of just one. + - ``all`` -- boolean (default: ``False``); if ``True``, return all + square roots of ``self``, instead of just one .. WARNING:: @@ -1053,7 +1052,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): sage: K. = FiniteField(9) sage: a.sqrt(extend = False, all = True) [] - """ if all: if self.is_square(): @@ -1106,7 +1104,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): cpdef _div_(self, right): """ - Divide two elements + Divide two elements. EXAMPLES:: @@ -1183,7 +1181,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): Traceback (most recent call last): ... ZeroDivisionError: division by zero in finite field - """ cdef int r = 0 if self.element == 0: @@ -1325,7 +1322,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): Traceback (most recent call last): ... TypeError: Cannot coerce element to an integer. - """ cdef int self_int = self._cache.log_to_int(self.element) if self_int % self._cache.characteristic() != self_int: @@ -1470,7 +1466,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def polynomial(FiniteField_givaroElement self, name=None): """ - Return self viewed as a polynomial over + Return ``self`` viewed as a polynomial over ``self.parent().prime_subfield()``. EXAMPLES:: @@ -1501,7 +1497,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): def _magma_init_(self, magma): """ - Return a string representation of self that MAGMA can + Return a string representation of ``self`` that MAGMA can understand. EXAMPLES:: @@ -1610,8 +1606,8 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): Return a string that evaluates to the GAP representation of this element. - A ``NotImplementedError`` is raised if ``self.parent().modulus()`` is - not a Conway polynomial, as the isomorphism of finite fields is + A :exc:`NotImplementedError` is raised if ``self.parent().modulus()`` + is not a Conway polynomial, as the isomorphism of finite fields is not implemented yet. EXAMPLES:: @@ -1666,7 +1662,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): INPUT: - ``reverse`` -- reverse the order of the bits from little endian to - big endian. + big endian EXAMPLES:: diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 98724011561..eac98726946 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -1137,7 +1137,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): Return a string that evaluates to the GAP representation of this element. - A ``NotImplementedError`` is raised if + A :exc:`NotImplementedError` is raised if ``self.parent().modulus()`` is not a Conway polynomial, as the isomorphism of finite fields is not implemented yet. @@ -1237,7 +1237,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): OUTPUT: Integer `x` such that `a^x = b`, if it exists. - Raises a ``ValueError`` exception if no such `x` exists. + Raises a :exc:`ValueError` exception if no such `x` exists. ALGORITHM: :pari:`fflog` diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 7647ad7fa20..3c92e26d679 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -1042,7 +1042,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): If ``extend`` is ``True``, a square root is chosen in an extension field if necessary. If ``extend`` is ``False``, a - :class:`ValueError` is raised if the element is not a square in the + :exc:`ValueError` is raised if the element is not a square in the base field. .. WARNING:: @@ -1112,7 +1112,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): OUTPUT: An integer `x` such that ``self`` equals ``base`` raised to - the power `x`. If no such `x` exists, a ``ValueError`` is + the power `x`. If no such `x` exists, a :exc:`ValueError` is raised. EXAMPLES:: diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index d10ac31cf96..a7a5332d632 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -91,7 +91,6 @@ cdef class FiniteField(Field): True sage: hash(F) == object.__hash__(F) True - """ # This is the default hash function in Python's object.c: cdef long x @@ -150,7 +149,6 @@ cdef class FiniteField(Field): sage: GF(2).is_perfect() True - """ return True @@ -183,7 +181,7 @@ cdef class FiniteField(Field): def _latex_(self): r""" - Returns a string denoting the name of the field in LaTeX. + Return a string denoting the name of the field in LaTeX. The :func:`~sage.misc.latex.latex` function calls the ``_latex_`` attribute when available. @@ -318,14 +316,14 @@ cdef class FiniteField(Field): EXAMPLES:: - sage: k. = FiniteField(9, impl="pari") + sage: k. = FiniteField(9, impl='pari') sage: list(k) [0, 1, 2, a, a + 1, a + 2, 2*a, 2*a + 1, 2*a + 2] Partial iteration of a very large finite field:: sage: p = next_prime(2^64) - sage: k. = FiniteField(p^2, impl="pari") + sage: k. = FiniteField(p^2, impl='pari') sage: it = iter(k); it <...generator object at ...> sage: [next(it) for i in range(10)] @@ -337,11 +335,11 @@ cdef class FiniteField(Field): sage: L = [] sage: from sage.rings.finite_rings.finite_field_base import FiniteField - sage: print(list(FiniteField.__iter__(GF(8, impl="givaro", names="z")))) # needs sage.libs.linbox + sage: print(list(FiniteField.__iter__(GF(8, impl='givaro', names='z')))) # needs sage.libs.linbox [0, 1, z, z + 1, z^2, z^2 + 1, z^2 + z, z^2 + z + 1] - sage: print(list(FiniteField.__iter__(GF(8, impl="pari", names="z")))) + sage: print(list(FiniteField.__iter__(GF(8, impl='pari', names='z')))) [0, 1, z, z + 1, z^2, z^2 + 1, z^2 + z, z^2 + z + 1] - sage: print(list(FiniteField.__iter__(GF(8, impl="ntl", names="z")))) # needs sage.libs.ntl + sage: print(list(FiniteField.__iter__(GF(8, impl='ntl', names='z')))) # needs sage.libs.ntl [0, 1, z, z + 1, z^2, z^2 + 1, z^2 + z, z^2 + z + 1] """ cdef Py_ssize_t n = self.degree() @@ -419,7 +417,7 @@ cdef class FiniteField(Field): INPUT: - - `n` -- integer between `0` and the cardinality of this field minus `1`. + - ``n`` -- integer between `0` and the cardinality of this field minus `1` EXAMPLES:: @@ -463,7 +461,7 @@ cdef class FiniteField(Field): def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None): """ - Return ``True`` if the map from self to codomain sending + Return ``True`` if the map from ``self`` to codomain sending ``self.0`` to the unique element of ``im_gens`` is a valid field homomorphism. Otherwise, return ``False``. @@ -546,7 +544,7 @@ cdef class FiniteField(Field): INPUT: - - ``f`` -- a univariate non-zero polynomial over this field + - ``f`` -- a univariate nonzero polynomial over this field ALGORITHM: [Coh1993]_, Algorithm 3.4.2 which is basically the algorithm in [Yun1976]_ with special treatment for powers divisible by `p`. @@ -586,7 +584,6 @@ cdef class FiniteField(Field): sage: R. = PolynomialRing(GF(65537), sparse=True) sage: (x^65537 + 2).squarefree_decomposition() (x + 2)^65537 - """ from sage.structure.factorization import Factorization if f.degree() == 0: @@ -647,7 +644,7 @@ cdef class FiniteField(Field): def gen(self): r""" Return a generator of this field (over its prime field). As this is an - abstract base class, this just raises a ``NotImplementedError``. + abstract base class, this just raises a :exc:`NotImplementedError`. EXAMPLES:: @@ -677,7 +674,7 @@ cdef class FiniteField(Field): def zeta(self, n=None): """ Return an element of multiplicative order ``n`` in this finite - field. If there is no such element, raise ``ValueError``. + field. If there is no such element, raise :exc:`ValueError`. .. WARNING:: @@ -851,7 +848,7 @@ cdef class FiniteField(Field): def is_field(self, proof = True): """ - Returns whether or not the finite field is a field, i.e., + Return whether or not the finite field is a field, i.e., always returns ``True``. EXAMPLES:: @@ -878,7 +875,7 @@ cdef class FiniteField(Field): @cached_method def factored_order(self): """ - Returns the factored order of this field. For compatibility with + Return the factored order of this field. For compatibility with :mod:`~sage.rings.finite_rings.integer_mod_ring`. EXAMPLES:: @@ -892,7 +889,7 @@ cdef class FiniteField(Field): @cached_method def factored_unit_order(self): """ - Returns the factorization of ``self.order()-1``, as a 1-tuple. + Return the factorization of ``self.order()-1``, as a 1-tuple. The format is for compatibility with :mod:`~sage.rings.finite_rings.integer_mod_ring`. @@ -960,9 +957,7 @@ cdef class FiniteField(Field): coefficients in the base field that has `a` as a root. In finite field extensions, `\GF{p^n}`, the base field is `\GF{p}`. - OUTPUT: - - - a monic polynomial over `\GF{p}` in the variable `x`. + OUTPUT: a monic polynomial over `\GF{p}` in the variable `x` EXAMPLES:: @@ -1011,7 +1006,7 @@ cdef class FiniteField(Field): The given modulus is always made monic:: - sage: k. = GF(7^2, modulus=2*x^2 - 3, impl="pari_ffelt") + sage: k. = GF(7^2, modulus=2*x^2 - 3, impl='pari_ffelt') sage: k.modulus() x^2 + 2 @@ -1019,21 +1014,21 @@ cdef class FiniteField(Field): We test the various finite field implementations:: - sage: GF(2, impl="modn").modulus() + sage: GF(2, impl='modn').modulus() x + 1 - sage: GF(2, impl="givaro").modulus() # needs sage.libs.linbox + sage: GF(2, impl='givaro').modulus() # needs sage.libs.linbox x + 1 - sage: GF(2, impl="ntl").modulus() # needs sage.libs.ntl + sage: GF(2, impl='ntl').modulus() # needs sage.libs.ntl x + 1 - sage: GF(2, impl="modn", modulus=x).modulus() + sage: GF(2, impl='modn', modulus=x).modulus() x - sage: GF(2, impl="givaro", modulus=x).modulus() # needs sage.libs.linbox + sage: GF(2, impl='givaro', modulus=x).modulus() # needs sage.libs.linbox x - sage: GF(2, impl="ntl", modulus=x).modulus() # needs sage.libs.ntl + sage: GF(2, impl='ntl', modulus=x).modulus() # needs sage.libs.ntl x - sage: GF(13^2, 'a', impl="givaro", modulus=x^2 + 2).modulus() # needs sage.libs.linbox + sage: GF(13^2, 'a', impl='givaro', modulus=x^2 + 2).modulus() # needs sage.libs.linbox x^2 + 2 - sage: GF(13^2, 'a', impl="pari_ffelt", modulus=x^2 + 2).modulus() # needs sage.libs.pari + sage: GF(13^2, 'a', impl='pari_ffelt', modulus=x^2 + 2).modulus() # needs sage.libs.pari x^2 + 2 """ # Normally, this is set by the constructor of the implementation @@ -1058,9 +1053,7 @@ cdef class FiniteField(Field): - ``name`` -- a variable name to use for the polynomial. By default, use the name given when constructing this field. - OUTPUT: - - - a monic polynomial over `\GF{p}` in the variable ``name``. + OUTPUT: a monic polynomial over `\GF{p}` in the variable ``name`` .. SEEALSO:: @@ -1128,7 +1121,6 @@ cdef class FiniteField(Field): sage: k.random_element(prob=0) # needs sage.modules 0 - """ if self.degree() == 1: return self(randrange(self.order())) @@ -1137,7 +1129,7 @@ cdef class FiniteField(Field): def some_elements(self): """ - Returns a collection of elements of this finite field for use in unit + Return a collection of elements of this finite field for use in unit testing. EXAMPLES:: @@ -1150,7 +1142,7 @@ cdef class FiniteField(Field): def polynomial_ring(self, variable_name=None): """ - Returns the polynomial ring over the prime subfield in the + Return the polynomial ring over the prime subfield in the same variable as this finite field. EXAMPLES:: @@ -1186,7 +1178,7 @@ cdef class FiniteField(Field): over the subfield. If not given, one is chosen automatically. - ``map`` -- boolean (default: ``True``); if ``True``, isomorphisms - from and to the vector space are also returned. + from and to the vector space are also returned The ``basis`` maps to the standard basis of the vector space by the isomorphisms. @@ -1430,7 +1422,6 @@ cdef class FiniteField(Field): sage: F, R = k.construction() sage: F(R) is k True - """ from sage.categories.pushout import AlgebraicExtensionFunctor try: @@ -1459,22 +1450,22 @@ cdef class FiniteField(Field): INPUT: - ``modulus`` -- a polynomial with coefficients in ``self``, - or an integer. + or an integer - - ``name`` or ``names`` -- string: the name of the generator + - ``name`` or ``names`` -- string; the name of the generator in the new extension - - ``latex_name`` or ``latex_names`` -- string: latex name of + - ``latex_name`` or ``latex_names`` -- string; latex name of the generator in the new extension - - ``map`` -- boolean (default: ``False``): if ``False``, - return just the extension `E`; if ``True``, return a pair + - ``map`` -- boolean (default: ``False``); if ``False``, + return just the extension `E`. If ``True``, return a pair `(E, f)`, where `f` is an embedding of ``self`` into `E`. - ``embedding`` -- currently not used; for compatibility with - other ``AlgebraicExtensionFunctor`` calls. + other ``AlgebraicExtensionFunctor`` calls - - ``**kwds``: further keywords, passed to the finite field + - ``**kwds`` -- further keywords, passed to the finite field constructor. OUTPUT: @@ -1654,7 +1645,7 @@ cdef class FiniteField(Field): - ``name`` -- string; name of the generator of the subfield - - ``map`` -- boolean (default ``False``); whether to also return the inclusion map + - ``map`` -- boolean (default: ``False``); whether to also return the inclusion map EXAMPLES:: @@ -1764,9 +1755,9 @@ cdef class FiniteField(Field): INPUT: - - ``degree`` -- (default: `0`) an integer + - ``degree`` -- integer (default: `0`) - - ``name`` -- a string, a dictionary or ``None``: + - ``name`` -- string; a dictionary or ``None``: - If ``degree`` is nonzero, then ``name`` must be a string (or ``None``, if this is a pseudo-Conway extension), @@ -1841,10 +1832,10 @@ cdef class FiniteField(Field): INPUT: - - ``name`` -- string (default: 'z'): prefix to use for + - ``name`` -- string (default: ``'z'``); prefix to use for variable names of subfields - - ``implementation`` -- string (optional): specifies how to + - ``implementation`` -- string (optional); specifies how to construct the algebraic closure. The only value supported at the moment is ``'pseudo_conway'``. For more details, see :mod:`~sage.rings.algebraic_closure_finite_field`. @@ -1912,7 +1903,7 @@ cdef class FiniteField(Field): @cached_method def is_conway(self): """ - Return ``True`` if self is defined by a Conway polynomial. + Return ``True`` if ``self`` is defined by a Conway polynomial. EXAMPLES:: @@ -1933,7 +1924,7 @@ cdef class FiniteField(Field): """ INPUT: - - ``n`` -- an integer (default: 1) + - ``n`` -- integer (default: 1) OUTPUT: @@ -2008,14 +1999,14 @@ cdef class FiniteField(Field): INPUT: - - ``basis`` -- (default: ``None``): a basis of the finite field + - ``basis`` -- (default: ``None``); a basis of the finite field ``self``, `\GF{p^n}`, as a vector space over the base field `\GF{p}`. Uses the power basis `\{x^i : 0 \leq i \leq n-1\}` as input if no basis is supplied, where `x` is the generator of ``self``. - - ``check`` -- (default: ``True``): verifies that ``basis`` is - a valid basis of ``self``. + - ``check`` -- (default: ``True``); verifies that ``basis`` is + a valid basis of ``self`` ALGORITHM: @@ -2114,7 +2105,7 @@ cdef class FiniteField(Field): return [sum(x * y for x, y in zip(col, basis)) for col in B.columns()] - def from_bytes(self, input_bytes, byteorder="big"): + def from_bytes(self, input_bytes, byteorder='big'): r""" Return the integer represented by the given array of bytes. @@ -2123,8 +2114,8 @@ cdef class FiniteField(Field): INPUT: - ``input_bytes`` -- a bytes-like object or iterable producing bytes - - ``byteorder`` -- str (default: ``"big"``); determines the byte order of - ``input_bytes``; can only be ``"big"`` or ``"little"`` + - ``byteorder`` -- string (default: ``'big'``); determines the byte order of + ``input_bytes`` (can only be ``'big'`` or ``'little'``) EXAMPLES:: @@ -2132,7 +2123,7 @@ cdef class FiniteField(Field): sage: F = GF(2**127 - 1) sage: F.from_bytes(input_bytes) 545127616933790290830707 - sage: a = F.from_bytes(input_bytes, byteorder="little"); a + sage: a = F.from_bytes(input_bytes, byteorder='little'); a 544943659528996309004147 sage: type(a) @@ -2143,7 +2134,7 @@ cdef class FiniteField(Field): sage: F_ext = GF(65537**5) sage: F_ext.from_bytes(input_bytes) 29549*z5^4 + 40876*z5^3 + 52171*z5^2 + 13604*z5 + 20843 - sage: F_ext.from_bytes(input_bytes, byteorder="little") + sage: F_ext.from_bytes(input_bytes, byteorder='little') 29539*z5^4 + 42728*z5^3 + 47440*z5^2 + 12423*z5 + 27473 TESTS:: diff --git a/src/sage/rings/finite_rings/finite_field_constructor.py b/src/sage/rings/finite_rings/finite_field_constructor.py index 78acc0a8873..bd29fdb1a95 100644 --- a/src/sage/rings/finite_rings/finite_field_constructor.py +++ b/src/sage/rings/finite_rings/finite_field_constructor.py @@ -8,11 +8,11 @@ are -- ``sage.rings.finite_rings.integer_mod.IntegerMod_int``, +- ``sage.rings.finite_rings.integer_mod.IntegerMod_int``, -- ``sage.rings.finite_rings.integer_mod.IntegerMod_int64``, and +- ``sage.rings.finite_rings.integer_mod.IntegerMod_int64``, and -- ``sage.rings.finite_rings.integer_mod.IntegerMod_gmp``. +- ``sage.rings.finite_rings.integer_mod.IntegerMod_gmp``. Small extension fields of cardinality `< 2^{16}` are @@ -229,16 +229,15 @@ class FiniteFieldFactory(UniqueFactory): - ``impl`` -- (optional) a string specifying the implementation of the finite field. Possible values are: - - ``'modn'`` -- ring of integers modulo `p` (only for prime - fields). + - ``'modn'`` -- ring of integers modulo `p` (only for prime fields) - ``'givaro'`` -- Givaro, which uses Zech logs (only for fields - of at most 65521 elements). + of at most 65521 elements) - - ``'ntl'`` -- NTL using GF2X (only in characteristic 2). + - ``'ntl'`` -- NTL using GF2X (only in characteristic 2) - ``'pari'`` or ``'pari_ffelt'`` -- PARI's ``FFELT`` type (only - for extension fields). + for extension fields) - ``elem_cache`` -- (default: order < 500) cache all elements to avoid creation time; ignored unless ``impl='givaro'`` @@ -258,8 +257,8 @@ class FiniteFieldFactory(UniqueFactory): - ``check_irreducible`` -- verify that the polynomial modulus is irreducible - - ``proof`` -- bool (default: ``True``): if ``True``, use provable - primality test; otherwise only use pseudoprimality test. + - ``proof`` -- boolean (default: ``True``); if ``True``, use provable + primality test; otherwise only use pseudoprimality test ALIAS: You can also use ``GF`` instead of ``FiniteField`` -- they are identical. @@ -304,7 +303,7 @@ class FiniteFieldFactory(UniqueFactory): 7105427357601001858711242675781 sage: a.is_square() True - sage: K. = GF(5^45, modulus="primitive") + sage: K. = GF(5^45, modulus='primitive') sage: b.multiplicative_order() 28421709430404007434844970703124 @@ -358,7 +357,7 @@ class FiniteFieldFactory(UniqueFactory): change how Sage computes in this field, but it will change the result of the :meth:`modulus` and :meth:`gen` methods:: - sage: k. = GF(5, modulus="primitive") + sage: k. = GF(5, modulus='primitive') sage: k.modulus() x + 3 sage: a @@ -465,9 +464,9 @@ class FiniteFieldFactory(UniqueFactory): Check that :issue:`16934` has been fixed:: - sage: k1. = GF(17^14, impl="pari") + sage: k1. = GF(17^14, impl='pari') sage: _ = a/2 - sage: k2. = GF(17^14, impl="pari") + sage: k2. = GF(17^14, impl='pari') sage: k1 is k2 True diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py index 232bdebbbbd..ce61efb8edd 100644 --- a/src/sage/rings/finite_rings/finite_field_givaro.py +++ b/src/sage/rings/finite_rings/finite_field_givaro.py @@ -39,7 +39,7 @@ class FiniteField_givaro(FiniteField): - ``name`` -- (default: ``'a'``) variable used for :meth:`~sage.rings.finite_rings.element_givaro.FiniteField_givaroElement.poly_repr()` - - ``modulus`` -- A minimal polynomial to use for reduction. + - ``modulus`` -- a minimal polynomial to use for reduction - ``repr`` -- (default: ``'poly'``) controls the way elements are printed to the user: @@ -51,10 +51,10 @@ class FiniteField_givaro(FiniteField): - 'poly': repr is :meth:`~sage.rings.finite_rings.element_givaro.FiniteField_givaroElement.poly_repr()` - - cache -- (default: ``False``) if ``True`` a cache of all elements of - this field is created. Thus, arithmetic does not create new elements - which speeds calculations up. Also, if many elements are needed during a - calculation this cache reduces the memory requirement as at most + - ``cache`` -- boolean (default: ``False``); if ``True`` a cache of all + elements of this field is created. Thus, arithmetic does not create new + elements which speeds calculations up. Also, if many elements are needed + during a calculation this cache reduces the memory requirement as at most :meth:`order` elements are created. OUTPUT: Givaro finite field with characteristic `p` and cardinality `p^n` @@ -102,7 +102,7 @@ class FiniteField_givaro(FiniteField): sage: GF(1009, impl='givaro', modulus='conway').modulus() x + 998 """ - def __init__(self, q, name="a", modulus=None, repr="poly", cache=False): + def __init__(self, q, name='a', modulus=None, repr='poly', cache=False): """ Initialize ``self``. @@ -159,9 +159,7 @@ def order(self): """ Return the cardinality of this field. - OUTPUT: - - Integer -- the number of elements in ``self``. + OUTPUT: integer; the number of elements in ``self`` EXAMPLES:: @@ -176,9 +174,7 @@ def degree(self): r""" If the cardinality of ``self`` is `p^n`, then this returns `n`. - OUTPUT: - - Integer -- the degree + OUTPUT: integer; the degree EXAMPLES:: @@ -332,10 +328,10 @@ def _element_constructor_(self, e): We can coerce from PARI finite field implementations:: - sage: K. = GF(3^10, impl="givaro") + sage: K. = GF(3^10, impl='givaro') sage: a^20 2*a^9 + 2*a^8 + a^7 + 2*a^5 + 2*a^4 + 2*a^3 + 1 - sage: M. = GF(3^10, impl="pari_ffelt") + sage: M. = GF(3^10, impl='pari_ffelt') sage: K(c^20) 2*a^9 + 2*a^8 + a^7 + 2*a^5 + 2*a^4 + 2*a^3 + 1 @@ -407,7 +403,7 @@ def gen(self, n=0): def prime_subfield(self): r""" - Return the prime subfield `\GF{p}` of self if ``self`` is `\GF{p^n}`. + Return the prime subfield `\GF{p}` of ``self`` if ``self`` is `\GF{p^n}`. EXAMPLES:: @@ -571,7 +567,7 @@ def frobenius_endomorphism(self, n=1): """ INPUT: - - ``n`` -- an integer (default: 1) + - ``n`` -- integer (default: 1) OUTPUT: diff --git a/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py b/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py index f328686cc72..2bfda7690d3 100644 --- a/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py +++ b/src/sage/rings/finite_rings/finite_field_ntl_gf2e.py @@ -53,12 +53,12 @@ class FiniteField_ntl_gf2e(FiniteField): - ``names`` -- variable used for poly_repr (default: ``'a'``) - - ``modulus`` -- A minimal polynomial to use for reduction. + - ``modulus`` -- a minimal polynomial to use for reduction - ``repr`` -- controls the way elements are printed to the user: (default: ``'poly'``) - - ``'poly'``: polynomial representation + - ``'poly'`` -- polynomial representation OUTPUT: finite field with characteristic 2 and cardinality `2^n` @@ -87,7 +87,7 @@ class FiniteField_ntl_gf2e(FiniteField): True """ - def __init__(self, q, names="a", modulus=None, repr="poly"): + def __init__(self, q, names='a', modulus=None, repr='poly'): """ Initialize ``self``. @@ -105,7 +105,7 @@ def __init__(self, q, names="a", modulus=None, repr="poly"): sage: k2. = GF(2^17) sage: k1 == k2 False - sage: k3. = GF(2^16, impl="pari_ffelt") + sage: k3. = GF(2^16, impl='pari_ffelt') sage: k1 == k3 False @@ -275,7 +275,7 @@ def from_integer(self, number): INPUT: - - ``number`` -- an integer + - ``number`` -- integer EXAMPLES:: diff --git a/src/sage/rings/finite_rings/finite_field_pari_ffelt.py b/src/sage/rings/finite_rings/finite_field_pari_ffelt.py index c60a7a563a7..9549dbc94b4 100644 --- a/src/sage/rings/finite_rings/finite_field_pari_ffelt.py +++ b/src/sage/rings/finite_rings/finite_field_pari_ffelt.py @@ -195,7 +195,7 @@ def characteristic(self): def degree(self): """ - Returns the degree of ``self`` over its prime field. + Return the degree of ``self`` over its prime field. EXAMPLES:: @@ -222,7 +222,7 @@ def _pari_frobenius(self, k=1): """ k = k % self.degree() if k == 0: - raise ValueError("_pari_frobenius requires a non-zero exponent") + raise ValueError("_pari_frobenius requires a nonzero exponent") g = self.gen() i = len(self.__pari_frobenius_powers) if i == 0: diff --git a/src/sage/rings/finite_rings/finite_field_prime_modn.py b/src/sage/rings/finite_rings/finite_field_prime_modn.py index b51cf9fe7d5..ca28f6f610f 100644 --- a/src/sage/rings/finite_rings/finite_field_prime_modn.py +++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py @@ -56,9 +56,9 @@ def __init__(self, p, check=True, modulus=None): INPUT: - - ``p`` -- an integer at least 2 + - ``p`` -- integer at least 2 - - ``check`` -- bool (default: ``True``); if ``False``, do not + - ``check`` -- boolean (default: ``True``); if ``False``, do not check ``p`` for primality EXAMPLES:: @@ -174,7 +174,8 @@ def _convert_map_from_(self, R): def construction(self): """ - Returns the construction of this finite field (for use by sage.categories.pushout) + Return the construction of this finite field (for use by + ``sage.categories.pushout``). EXAMPLES:: @@ -214,7 +215,7 @@ def is_prime_field(self): def polynomial(self, name=None): """ - Returns the polynomial ``name``. + Return the polynomial ``name``. EXAMPLES:: @@ -278,7 +279,7 @@ def gen(self, n=0): 1 sage: # needs sage.rings.finite_rings - sage: k = GF(1009, modulus="primitive") + sage: k = GF(1009, modulus='primitive') sage: k.gen() # this gives a primitive element 11 sage: k.gen(1) diff --git a/src/sage/rings/finite_rings/galois_group.py b/src/sage/rings/finite_rings/galois_group.py index f11b72bc681..32e23a40c44 100644 --- a/src/sage/rings/finite_rings/galois_group.py +++ b/src/sage/rings/finite_rings/galois_group.py @@ -66,11 +66,11 @@ def __init__(self, field): sage: TestSuite(GF(9).galois_group()).run() """ - GaloisGroup_cyc.__init__(self, field, (field.degree(),), gen_names="Frob") + GaloisGroup_cyc.__init__(self, field, (field.degree(),), gen_names='Frob') def _repr_(self): r""" - String representation of this Galois group + String representation of this Galois group. EXAMPLES:: diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 9aa5db8ea86..d55e1a0a178 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -196,7 +196,6 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): sage: K. = GF(3^21) sage: f = FiniteFieldHomomorphism_generic(Hom(k, K)) sage: TestSuite(f).run() - """ def __init__(self, parent, im_gens=None, base_map=None, check=True, section_class=None): """ @@ -423,7 +422,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): def __hash__(self): r""" - Return a hash of this morphism + Return a hash of this morphism. TESTS:: @@ -437,7 +436,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): cdef dict _extra_slots(self): r""" - Helper function for copying and pickling + Helper function for copying and pickling. TESTS:: @@ -465,7 +464,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): cdef _update_slots(self, dict slots): r""" - Helper function for copying and pickling + Helper function for copying and pickling. TESTS:: @@ -494,15 +493,14 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): sage: k. = GF(7^11) sage: Frob = k.frobenius_endomorphism(5) sage: TestSuite(Frob).run() - """ def __init__(self, domain, n=1): """ INPUT: - - ``domain`` -- a finite field + - ``domain`` -- a finite field - - ``n`` -- an integer (default: 1) + - ``n`` -- integer (default: 1) .. NOTE:: @@ -713,7 +711,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): def _composition(self, right): """ - Return self o right. + Return ``self`` o ``right``. EXAMPLES:: @@ -830,7 +828,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): def __hash__(self): r""" - Return a hash of this morphism + Return a hash of this morphism. EXAMPLES:: @@ -843,7 +841,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): cdef _update_slots(self, dict slots): r""" - Helper function for copying and pickling + Helper function for copying and pickling. TESTS:: diff --git a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx index e45de1d83f9..c53a87ddca0 100644 --- a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx @@ -117,9 +117,9 @@ cdef class FrobeniusEndomorphism_prime(FrobeniusEndomorphism_finite_field): def _composition(self, right): """ - Return self o right. + Return ``self`` o ``right``. - It is always right, since self is always identity because + It is always ``right``, since ``self`` is always identity because the domain is a prime field. """ return right diff --git a/src/sage/rings/finite_rings/homset.py b/src/sage/rings/finite_rings/homset.py index ef72f35a1a5..6c15d725f43 100644 --- a/src/sage/rings/finite_rings/homset.py +++ b/src/sage/rings/finite_rings/homset.py @@ -159,7 +159,7 @@ def _repr_(self): def is_aut(self): """ - Check if ``self`` is an automorphism + Check if ``self`` is an automorphism. EXAMPLES:: @@ -233,7 +233,7 @@ def list(self): Between isomorphic fields with different moduli:: sage: k1 = GF(1009) - sage: k2 = GF(1009, modulus="primitive") + sage: k2 = GF(1009, modulus='primitive') sage: Hom(k1, k2).list() [ Ring morphism: @@ -249,8 +249,8 @@ def list(self): Defn: 11 |--> 11 ] - sage: k1. = GF(1009^2, modulus="first_lexicographic") - sage: k2. = GF(1009^2, modulus="conway") + sage: k1. = GF(1009^2, modulus='first_lexicographic') + sage: k2. = GF(1009^2, modulus='conway') sage: Hom(k1, k2).list() [ Ring morphism: @@ -348,7 +348,6 @@ def _an_element_(self): .. TODO:: Use a more sophisticated algorithm; see also :issue:`8751`. - """ K = self.domain() L = self.codomain() diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index b2238689afb..d76b0fcf04f 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -7,20 +7,20 @@ There are three types of integer_mod classes, depending on the size of the modulus. -- ``IntegerMod_int`` stores its value in a - ``int_fast32_t`` (typically an ``int``); - this is used if the modulus is less than - `\sqrt{2^{31}-1}`. +- ``IntegerMod_int`` stores its value in a + ``int_fast32_t`` (typically an ``int``); + this is used if the modulus is less than + `\sqrt{2^{31}-1}`. -- ``IntegerMod_int64`` stores its value in a - ``int_fast64_t`` (typically a ``long - long``); this is used if the modulus is less than - `2^{31}-1`. In many places, we assume that the values and the modulus - actually fit inside an ``unsigned long``. +- ``IntegerMod_int64`` stores its value in a + ``int_fast64_t`` (typically a ``long + long``); this is used if the modulus is less than + `2^{31}-1`. In many places, we assume that the values and the modulus + actually fit inside an ``unsigned long``. -- ``IntegerMod_gmp`` stores its value in a - ``mpz_t``; this can be used for an arbitrarily large - modulus. +- ``IntegerMod_gmp`` stores its value in a + ``mpz_t``; this can be used for an arbitrarily large + modulus. All extend ``IntegerMod_abstract``. @@ -151,7 +151,7 @@ def Mod(n, m, parent=None): if m == 0: return n - # m is non-zero, so return n mod m + # m is nonzero, so return n mod m if parent is None: from sage.rings.finite_rings.integer_mod_ring import IntegerModRing parent = IntegerModRing(m) @@ -605,7 +605,6 @@ cdef class IntegerMod_abstract(FiniteRingElement): 4 sage: aa.typeOf() # optional - fricas IntegerMod(15) - """ return '%s :: %s'%(self, self.parent()._axiom_init_()) @@ -647,17 +646,15 @@ cdef class IntegerMod_abstract(FiniteRingElement): INPUT: + - ``self`` -- unit modulo `n` - - ``self`` -- unit modulo `n` - - - ``b`` -- a unit modulo `n`. If ``b`` is not given, - ``R.multiplicative_generator()`` is used, where - ``R`` is the parent of ``self``. - + - ``b`` -- a unit modulo `n`. If ``b`` is not given, + ``R.multiplicative_generator()`` is used, where + ``R`` is the parent of ``self``. OUTPUT: - Integer `x` such that `b^x = a`, if this exists; a :class:`ValueError` + Integer `x` such that `b^x = a`, if this exists; a :exc:`ValueError` otherwise. .. NOTE:: @@ -821,7 +818,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def generalised_log(self): r""" - Return integers `[n_1, \ldots, n_d]` such that + Return integers `[n_1, \ldots, n_d]` such that. .. MATH:: @@ -851,7 +848,6 @@ cdef class IntegerMod_abstract(FiniteRingElement): of the parent (which is the default). Specifying ``algorithm='pari'`` usually yields a different set of generators that is incompatible with this method. - """ if not self.is_unit(): raise ZeroDivisionError @@ -881,7 +877,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def charpoly(self, var='x'): """ - Returns the characteristic polynomial of this element. + Return the characteristic polynomial of this element. EXAMPLES:: @@ -901,7 +897,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def minpoly(self, var='x'): """ - Returns the minimal polynomial of this element. + Return the minimal polynomial of this element. EXAMPLES:: @@ -912,7 +908,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def minimal_polynomial(self, var='x'): """ - Returns the minimal polynomial of this element. + Return the minimal polynomial of this element. EXAMPLES:: @@ -923,7 +919,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def polynomial(self, var='x'): """ - Returns a constant polynomial representing this value. + Return a constant polynomial representing this value. EXAMPLES:: @@ -940,7 +936,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def norm(self): """ - Returns the norm of this element, which is itself. (This is here + Return the norm of this element, which is itself. (This is here for compatibility with higher order finite fields.) EXAMPLES:: @@ -958,7 +954,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def trace(self): """ - Returns the trace of this element, which is itself. (This is here + Return the trace of this element, which is itself. (This is here for compatibility with higher order finite fields.) EXAMPLES:: @@ -1119,14 +1115,12 @@ cdef class IntegerMod_abstract(FiniteRingElement): INPUT: - - ``extend`` -- bool (default: ``True``); - if ``True``, return a square root in an extension ring, - if necessary. Otherwise, raise a ``ValueError`` if the - square root is not in the base ring. + - ``extend`` -- boolean (default: ``True``); if ``True``, return a + square root in an extension ring, if necessary. Otherwise, raise a + :exc:`ValueError` if the square root is not in the base ring. - - ``all`` -- bool (default: ``False``); if - ``True``, return {all} square roots of self, instead of - just one. + - ``all`` -- boolean (default: ``False``); if ``True``, return {all} + square roots of self, instead of just one ALGORITHM: Calculates the square roots mod `p` for each of the primes `p` dividing the order of the ring, then lifts @@ -1337,38 +1331,38 @@ cdef class IntegerMod_abstract(FiniteRingElement): def nth_root(self, n, extend = False, all = False, algorithm = None, cunningham = False): r""" - Returns an `n`\th root of ``self``. + Return an `n`-th root of ``self``. INPUT: - ``n`` -- integer `\geq 1` - - ``extend`` -- bool (default: ``True``); if True, return an nth - root in an extension ring, if necessary. Otherwise, raise a - ValueError if the root is not in the base ring. Warning: + - ``extend`` -- boolean (default: ``True``); if ``True``, return an + `n`-th root in an extension ring, if necessary. Otherwise, raise a + :exc:`ValueError` if the root is not in the base ring. Warning: this option is not implemented! - - ``all`` -- bool (default: ``False``); if ``True``, return all `n`\th - roots of ``self``, instead of just one. + - ``all`` -- boolean (default: ``False``); if ``True``, return all + `n`-th roots of ``self``, instead of just one - - ``algorithm`` -- string (default: None); The algorithm for the prime modulus case. - CRT and p-adic log techniques are used to reduce to this case. - 'Johnston' is the only currently supported option. + - ``algorithm`` -- string (default: ``None``); the algorithm for the + prime modulus case. CRT and p-adic log techniques are used to reduce + to this case. ``'Johnston'`` is the only currently supported option. - - ``cunningham`` -- bool (default: ``False``); In some cases, - factorization of ``n`` is computed. If cunningham is set to ``True``, - the factorization of ``n`` is computed using trial division for all + - ``cunningham`` -- boolean (default: ``False``); in some cases, + factorization of `n` is computed. If cunningham is set to ``True``, + the factorization of `n` is computed using trial division for all primes in the so called Cunningham table. Refer to - sage.rings.factorint.factor_cunningham for more information. You need - to install an optional package to use this method, this can be done - with the following command line ``sage -i cunningham_tables`` + ``sage.rings.factorint.factor_cunningham`` for more information. You + need to install an optional package to use this method, this can be + done with the following command line: ``sage -i cunningham_tables``. OUTPUT: - If self has an `n`\th root, returns one (if ``all`` is ``False``) or a + If ``self`` has an `n`-th root, returns one (if ``all`` is ``False``) or a list of all of them (if ``all`` is ``True``). Otherwise, raises a - ``ValueError`` (if ``extend`` is ``False``) or a ``NotImplementedError`` (if - ``extend`` is ``True``). + :exc:`ValueError` (if ``extend`` is ``False``) or a + :exc:`NotImplementedError` (if ``extend`` is ``True``). .. warning:: @@ -1390,13 +1384,13 @@ cdef class IntegerMod_abstract(FiniteRingElement): - if ``self=1``: ``self`` is returned - - otherwise; a ``ValueError`` is raised + - otherwise; a :exc:`ValueError` is raised - If `n < 0`: - - if self is invertible, the `(-n)`\th root of the inverse of self is returned + - if ``self`` is invertible, the `(-n)`\th root of the inverse of ``self`` is returned - - otherwise a ``ValueError`` is raised or empty list returned. + - otherwise a :exc:`ValueError` is raised or empty list returned. EXAMPLES:: @@ -1599,7 +1593,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def _nth_root_naive(self, n): """ - Computes all nth roots using brute force, for doc-testing. + Compute all `n`-th roots using brute force, for doc-testing. TESTS:: @@ -1737,7 +1731,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def additive_order(self): r""" - Returns the additive order of self. + Return the additive order of ``self``. This is the same as ``self.order()``. @@ -1846,7 +1840,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def multiplicative_order(self): """ - Returns the multiplicative order of self. + Return the multiplicative order of ``self``. EXAMPLES:: @@ -1911,7 +1905,6 @@ cdef class IntegerMod_abstract(FiniteRingElement): +Infinity sage: ZZ.quo(1024)(16).valuation(4) 2 - """ p=self._modulus.sageInteger.gcd(p) if p==1: @@ -1951,7 +1944,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): def _vector_(self): """ - Return self as a vector of its parent viewed as a one-dimensional + Return ``self`` as a vector of its parent viewed as a one-dimensional vector space. This is to support prime finite fields, which are implemented as @@ -2016,7 +2009,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): def __lshift__(IntegerMod_gmp self, k): r""" - Performs a left shift by ``k`` bits. + Perform a left shift by ``k`` bits. For details, see :meth:`shift`. @@ -2030,7 +2023,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): def __rshift__(IntegerMod_gmp self, k): r""" - Performs a right shift by ``k`` bits. + Perform a right shift by ``k`` bits. For details, see :meth:`shift`. @@ -2044,7 +2037,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): cdef shift(IntegerMod_gmp self, long k): r""" - Performs a bit-shift specified by ``k`` on ``self``. + Perform a bit-shift specified by ``k`` on ``self``. Suppose that ``self`` represents an integer `x` modulo `n`. If `k` is `k = 0`, returns `x`. If `k > 0`, shifts `x` to the left, that is, @@ -2056,11 +2049,9 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): INPUT: - - ``k`` -- Integer of type ``long`` + - ``k`` -- integer of type ``long`` - OUTPUT: - - - Result of type ``IntegerMod_gmp`` + OUTPUT: result of type ``IntegerMod_gmp`` EXAMPLES:: @@ -2101,8 +2092,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): cpdef bint is_one(IntegerMod_gmp self) noexcept: """ - Returns ``True`` if this is `1`, otherwise - ``False``. + Return ``True`` if this is `1`, otherwise ``False``. EXAMPLES:: @@ -2115,8 +2105,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): def __bool__(IntegerMod_gmp self): """ - Returns ``True`` if this is not `0`, otherwise - ``False``. + Return ``True`` if this is not `0`, otherwise ``False``. EXAMPLES:: @@ -2313,7 +2302,6 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): sage: zero^0 0 - """ cdef IntegerMod_gmp x = self._new_c() sig_on() @@ -2325,7 +2313,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): def __invert__(IntegerMod_gmp self): """ - Return the multiplicative inverse of self. + Return the multiplicative inverse of ``self``. EXAMPLES:: @@ -2381,14 +2369,14 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): @coerce_binop def gcd(self, IntegerMod_gmp other): r""" - Greatest common divisor + Greatest common divisor. Returns the "smallest" generator in `\ZZ / N\ZZ` of the ideal generated by ``self`` and ``other``. INPUT: - - ``other`` -- an element of the same ring as this one. + - ``other`` -- an element of the same ring as this one EXAMPLES:: @@ -2484,8 +2472,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): cpdef bint is_one(IntegerMod_int self) noexcept: """ - Returns ``True`` if this is `1`, otherwise - ``False``. + Return ``True`` if this is `1`, otherwise ``False``. EXAMPLES:: @@ -2502,8 +2489,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): def __bool__(IntegerMod_int self): """ - Returns ``True`` if this is not `0`, otherwise - ``False``. + Return ``True`` if this is not `0`, otherwise ``False``. EXAMPLES:: @@ -2532,9 +2518,9 @@ cdef class IntegerMod_int(IntegerMod_abstract): def _crt(IntegerMod_int self, IntegerMod_int other): """ Use the Chinese Remainder Theorem to find an element of the - integers modulo the product of the moduli that reduces to self and - to other. The modulus of other must be coprime to the modulus of - self. + integers modulo the product of the moduli that reduces to ``self`` and + to ``other``. The modulus of ``other`` must be coprime to the modulus + of ``self``. EXAMPLES:: @@ -2678,7 +2664,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): def __lshift__(IntegerMod_int self, k): r""" - Performs a left shift by ``k`` bits. + Perform a left shift by ``k`` bits. For details, see :meth:`shift`. @@ -2694,7 +2680,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): def __rshift__(IntegerMod_int self, k): r""" - Performs a right shift by ``k`` bits. + Perform a right shift by ``k`` bits. For details, see :meth:`shift`. @@ -2710,7 +2696,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef shift(IntegerMod_int self, int k): """ - Performs a bit-shift specified by ``k`` on ``self``. + Perform a bit-shift specified by ``k`` on ``self``. Suppose that ``self`` represents an integer `x` modulo `n`. If `k` is `k = 0`, returns `x`. If `k > 0`, shifts `x` to the left, that is, @@ -2722,11 +2708,9 @@ cdef class IntegerMod_int(IntegerMod_abstract): INPUT: - - ``k`` -- Integer of type ``int`` - - OUTPUT: + - ``k`` -- integer of type ``int`` - - Result of type ``IntegerMod_int`` + OUTPUT: result of type ``IntegerMod_int`` WARNING: @@ -2796,7 +2780,6 @@ cdef class IntegerMod_int(IntegerMod_abstract): sage: R = Integers(1) sage: R(0)^0 0 - """ cdef long long_exp cdef int_fast32_t res @@ -2832,7 +2815,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): def __invert__(IntegerMod_int self): """ - Return the multiplicative inverse of self. + Return the multiplicative inverse of ``self``. EXAMPLES:: @@ -2910,14 +2893,14 @@ cdef class IntegerMod_int(IntegerMod_abstract): INPUT: - - ``extend`` -- bool (default: ``True``); - if ``True``, return a square root in an extension ring, - if necessary. Otherwise, raise a ``ValueError`` if the - square root is not in the base ring. + - ``extend`` -- boolean (default: ``True``); + if ``True``, return a square root in an extension ring, + if necessary. Otherwise, raise a :exc:`ValueError` if the + square root is not in the base ring. - - ``all`` -- bool (default: ``False``); if - ``True``, return {all} square roots of self, instead of - just one. + - ``all`` -- boolean (default: ``False``); if + ``True``, return {all} square roots of self, instead of + just one. ALGORITHM: Calculates the square roots mod `p` for each of the primes `p` dividing the order of the ring, then lifts @@ -3021,7 +3004,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): # easy case of n prime, n = 3 mod 4. if n > 100 and n % 4 == 3 and len(moduli) == 1 and moduli[0][1] == 1: if jacobi_int(self.ivalue, self._modulus.int32) == 1: - # it's a non-zero square, sqrt(a) = a^(p+1)/4 + # it's a nonzero square, sqrt(a) = a^(p+1)/4 i = mod_pow_int(self.ivalue, (self._modulus.int32+1)/4, n) if i > n / 2: i = n - i @@ -3064,14 +3047,14 @@ cdef class IntegerMod_int(IntegerMod_abstract): @coerce_binop def gcd(self, IntegerMod_int other): r""" - Greatest common divisor + Greatest common divisor. Returns the "smallest" generator in `\ZZ / N\ZZ` of the ideal generated by ``self`` and ``other``. INPUT: - - ``other`` -- an element of the same ring as this one. + - ``other`` -- an element of the same ring as this one EXAMPLES:: @@ -3101,9 +3084,9 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef int_fast32_t gcd_int(int_fast32_t a, int_fast32_t b) noexcept: """ - Returns the gcd of a and b + Return the gcd of ``a`` and ``b``. - For use with IntegerMod_int + For use with ``IntegerMod_int``. AUTHORS: @@ -3123,9 +3106,9 @@ cdef int_fast32_t gcd_int(int_fast32_t a, int_fast32_t b) noexcept: cdef int_fast32_t mod_inverse_int(int_fast32_t x, int_fast32_t n) except 0: """ - Returns y such that xy=1 mod n + Return y such that xy=1 mod n. - For use in IntegerMod_int + For use in ``IntegerMod_int``. AUTHORS: @@ -3157,9 +3140,9 @@ cdef int_fast32_t mod_inverse_int(int_fast32_t x, int_fast32_t n) except 0: cdef int_fast32_t mod_pow_int(int_fast32_t base, int_fast32_t exp, int_fast32_t n) noexcept: """ - Returns base^exp mod n + Return base^exp mod n. - For use in IntegerMod_int + For use in ``IntegerMod_int``. EXAMPLES:: @@ -3199,9 +3182,9 @@ cdef int_fast32_t mod_pow_int(int_fast32_t base, int_fast32_t exp, int_fast32_t cdef int jacobi_int(int_fast32_t a, int_fast32_t m) except -2: """ - Calculates the jacobi symbol (a/n) + Calculate the jacobi symbol (a/n). - For use in IntegerMod_int + For use in ``IntegerMod_int``. AUTHORS: @@ -3315,8 +3298,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cpdef bint is_one(IntegerMod_int64 self) noexcept: """ - Returns ``True`` if this is `1`, otherwise - ``False``. + Return ``True`` if this is `1`, otherwise ``False``. EXAMPLES:: @@ -3329,8 +3311,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __bool__(IntegerMod_int64 self): """ - Returns ``True`` if this is not `0`, otherwise - ``False``. + Return ``True`` if this is not `0`, otherwise ``False``. EXAMPLES:: @@ -3357,9 +3338,9 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def _crt(IntegerMod_int64 self, IntegerMod_int64 other): """ Use the Chinese Remainder Theorem to find an element of the - integers modulo the product of the moduli that reduces to self and - to other. The modulus of other must be coprime to the modulus of - self. + integers modulo the product of the moduli that reduces to ``self`` and + to ``other``. The modulus of ``other`` must be coprime to the modulus + of ``self``. EXAMPLES:: @@ -3499,7 +3480,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __lshift__(IntegerMod_int64 self, k): r""" - Performs a left shift by ``k`` bits. + Perform a left shift by ``k`` bits. For details, see :meth:`shift`. @@ -3515,7 +3496,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __rshift__(IntegerMod_int64 self, k): r""" - Performs a right shift by ``k`` bits. + Perform a right shift by ``k`` bits. For details, see :meth:`shift`. @@ -3529,7 +3510,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cdef shift(IntegerMod_int64 self, int k): """ - Performs a bit-shift specified by ``k`` on ``self``. + Perform a bit-shift specified by ``k`` on ``self``. Suppose that ``self`` represents an integer `x` modulo `n`. If `k` is `k = 0`, returns `x`. If `k > 0`, shifts `x` to the left, that is, @@ -3541,11 +3522,9 @@ cdef class IntegerMod_int64(IntegerMod_abstract): INPUT: - - ``k`` -- Integer of type ``int`` - - OUTPUT: + - ``k`` -- integer of type ``int`` - - Result of type ``IntegerMod_int64`` + OUTPUT: result of type ``IntegerMod_int64`` WARNING: @@ -3626,7 +3605,6 @@ cdef class IntegerMod_int64(IntegerMod_abstract): sage: zero^0 0 - """ cdef long long_exp cdef int_fast64_t res @@ -3662,7 +3640,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __invert__(IntegerMod_int64 self): """ - Return the multiplicative inverse of self. + Return the multiplicative inverse of ``self``. EXAMPLES:: @@ -3695,7 +3673,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __float__(IntegerMod_int64 self): """ - Coerce self to a float. + Coerce ``self`` to a float. EXAMPLES:: @@ -3707,7 +3685,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): def __hash__(self): """ - Compute hash of self. + Compute hash of ``self``. EXAMPLES:: @@ -3729,14 +3707,14 @@ cdef class IntegerMod_int64(IntegerMod_abstract): @coerce_binop def gcd(self, IntegerMod_int64 other): r""" - Greatest common divisor + Greatest common divisor. Returns the "smallest" generator in `\ZZ / N\ZZ` of the ideal generated by ``self`` and ``other``. INPUT: - - ``other`` -- an element of the same ring as this one. + - ``other`` -- an element of the same ring as this one EXAMPLES:: @@ -3776,9 +3754,9 @@ cdef int mpz_pow_helper(mpz_t res, mpz_t base, object exp, mpz_t modulus) except cdef int_fast64_t gcd_int64(int_fast64_t a, int_fast64_t b) noexcept: """ - Returns the gcd of a and b + Return the gcd of ``a`` and ``b``. - For use with IntegerMod_int64 + For use with IntegerMod_int64. AUTHORS: @@ -3798,9 +3776,9 @@ cdef int_fast64_t gcd_int64(int_fast64_t a, int_fast64_t b) noexcept: cdef int_fast64_t mod_inverse_int64(int_fast64_t x, int_fast64_t n) except 0: """ - Returns y such that xy=1 mod n + Return y such that xy=1 mod n. - For use in IntegerMod_int64 + For use in ``IntegerMod_int64``. AUTHORS: @@ -3830,9 +3808,9 @@ cdef int_fast64_t mod_inverse_int64(int_fast64_t x, int_fast64_t n) except 0: cdef int_fast64_t mod_pow_int64(int_fast64_t base, int_fast64_t exp, int_fast64_t n) noexcept: """ - Returns base^exp mod n + Return base^exp mod n. - For use in IntegerMod_int64 + For use in ``IntegerMod_int64``. AUTHORS: @@ -3866,9 +3844,9 @@ cdef int_fast64_t mod_pow_int64(int_fast64_t base, int_fast64_t exp, int_fast64_ cdef int jacobi_int64(int_fast64_t a, int_fast64_t m) except -2: """ - Calculates the jacobi symbol (a/n) + Calculate the jacobi symbol (a/n). - For use in IntegerMod_int64 + For use in ``IntegerMod_int64``. AUTHORS: @@ -3910,7 +3888,7 @@ cdef int jacobi_int64(int_fast64_t a, int_fast64_t m) except -2: def square_root_mod_prime_power(IntegerMod_abstract a, p, e): r""" - Calculates the square root of `a`, where `a` is an + Calculate the square root of `a`, where `a` is an integer mod `p^e`. ALGORITHM: Compute `p`-adically by stripping off even powers of `p` @@ -4006,7 +3984,7 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): r""" - Calculates the square root of `a`, where `a` is an + Calculate the square root of `a`, where `a` is an integer mod `p`; if `a` is not a perfect square, this returns an (incorrect) answer without checking. @@ -4014,19 +3992,17 @@ cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): `p \bmod 16`. - - `p \bmod 2 = 0`: `p = 2` so - `\sqrt{a} = a`. + - `p \bmod 2 = 0`: `p = 2` so `\sqrt{a} = a`. - - `p \bmod 4 = 3`: `\sqrt{a} = a^{(p+1)/4}`. + - `p \bmod 4 = 3`: `\sqrt{a} = a^{(p+1)/4}`. - - `p \bmod 8 = 5`: `\sqrt{a} = \zeta i a` where - `\zeta = (2a)^{(p-5)/8}`, `i=\sqrt{-1}`. + - `p \bmod 8 = 5`: `\sqrt{a} = \zeta i a` where `\zeta = (2a)^{(p-5)/8}`, + `i=\sqrt{-1}`. - - `p \bmod 16 = 9`: Similar, work in a bi-quadratic - extension of `\GF{p}` for small `p`, Tonelli - and Shanks for large `p`. + - `p \bmod 16 = 9`: Similar, work in a bi-quadratic extension of `\GF{p}` + for small `p`, Tonelli and Shanks for large `p`. - - `p \bmod 16 = 1`: Tonelli and Shanks. + - `p \bmod 16 = 1`: Tonelli and Shanks. REFERENCES: @@ -4114,7 +4090,7 @@ cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): def lucas_q1(mm, IntegerMod_abstract P): """ Return `V_k(P, 1)` where `V_k` is the Lucas - function defined by the recursive relation + function defined by the recursive relation. `V_k(P, Q) = PV_{k-1}(P, Q) - QV_{k-2}(P, Q)` @@ -4328,7 +4304,6 @@ cdef class IntegerMod_hom(Morphism): To: Ring of integers modulo 5 sage: psi(R15(7)) 2 - """ Morphism._update_slots(self, _slots) self.zero = _slots['zero'] @@ -4392,7 +4367,6 @@ cdef class IntegerMod_to_IntegerMod(IntegerMod_hom): sage: Zmod(4).hom(Zmod(2)).is_surjective() True - """ return True @@ -4404,14 +4378,12 @@ cdef class IntegerMod_to_IntegerMod(IntegerMod_hom): sage: Zmod(4).hom(Zmod(2)).is_injective() False - """ return self.domain().order() == self.codomain().order() cdef class Integer_to_IntegerMod(IntegerMod_hom): r""" - Fast `\ZZ \rightarrow \ZZ/n\ZZ` - morphism. + Fast `\ZZ \rightarrow \ZZ/n\ZZ` morphism. EXAMPLES: @@ -4463,7 +4435,6 @@ cdef class Integer_to_IntegerMod(IntegerMod_hom): sage: ZZ.hom(Zmod(2)).is_surjective() True - """ return True @@ -4475,7 +4446,6 @@ cdef class Integer_to_IntegerMod(IntegerMod_hom): sage: ZZ.hom(Zmod(2)).is_injective() False - """ return False diff --git a/src/sage/rings/finite_rings/integer_mod_ring.py b/src/sage/rings/finite_rings/integer_mod_ring.py index c6b5558573a..eda38323122 100644 --- a/src/sage/rings/finite_rings/integer_mod_ring.py +++ b/src/sage/rings/finite_rings/integer_mod_ring.py @@ -93,10 +93,9 @@ class IntegerModFactory(UniqueFactory): INPUT: - ``order`` -- integer (default: 0); positive or negative - - ``is_field`` -- bool (default: ``False``); assert that - the order is prime and hence the quotient ring belongs to - the category of fields - - ``category`` (optional) -- the category that the quotient ring belongs to. + - ``is_field`` -- boolean (default: ``False``); assert that the order is + prime and hence the quotient ring belongs to the category of fields + - ``category`` -- (optional) the category that the quotient ring belongs to .. NOTE:: @@ -199,7 +198,6 @@ class IntegerModFactory(UniqueFactory): the ring factory:: sage: IntegerModRing._cache.clear() - """ def get_object(self, version, key, extra_args): out = super().get_object(version, key, extra_args) @@ -289,7 +287,7 @@ class IntegerModRing_generic(quotient_ring.QuotientRing_generic, sage.rings.abc. INPUT: - - ``order`` -- an integer + - ``order`` -- integer - ``category`` -- a subcategory of ``CommutativeRings()`` (the default) @@ -498,7 +496,7 @@ def _macaulay2_init_(self, macaulay2=None): def _axiom_init_(self): """ - Returns a string representation of self in (Pan)Axiom. + Return a string representation of ``self`` in (Pan)Axiom. EXAMPLES:: @@ -573,7 +571,7 @@ def is_prime_field(self): def _precompute_table(self): """ - Computes a table of elements so that elements are unique. + Compute a table of elements so that elements are unique. EXAMPLES:: @@ -678,12 +676,12 @@ def is_field(self, proof=None): INPUT: - - ``proof`` (optional bool or None, default None): - If ``False``, then test whether the category of the quotient - is a subcategory of ``Fields()``, or do a probabilistic - primality test. If ``None``, then test the category and then - do a primality test according to the global arithmetic proof - settings. If True, do a deterministic primality test. + - ``proof`` -- boolean or ``None`` (default). If ``False``, then test + whether the category of the quotient is a subcategory of + ``Fields()``, or do a probabilistic primality test. If ``None``, then + test the category and then do a primality test according to the + global arithmetic proof settings. If ``True``, do a deterministic + primality test. If it is found (perhaps probabilistically) that the ring is a field, then the category of the ring is refined to include the category @@ -715,8 +713,8 @@ def is_field(self, proof=None): and Category of quotients of semigroups It is possible to mistakenly put `\ZZ/n\ZZ` into the category of fields. - In this case, :meth:`is_field` will return True without performing a - primality check. However, if the optional argument `proof=True` is + In this case, :meth:`is_field` will return ``True`` without performing a + primality check. However, if the optional argument ``proof=True`` is provided, primality is tested and the mistake is uncovered in a warning message:: @@ -737,7 +735,6 @@ def is_field(self, proof=None): of the ring factory:: sage: IntegerModRing._cache.clear() - """ from sage.categories.fields import Fields if not proof: @@ -762,7 +759,7 @@ def field(self): """ If this ring is a field, return the corresponding field as a finite field, which may have extra functionality and structure. Otherwise, - raise a ``ValueError``. + raise a :exc:`ValueError`. EXAMPLES:: @@ -1312,7 +1309,6 @@ def __richcmp__(self, other, op): True sage: R2 == GF(5) False - """ # We want that GF(p) and IntegerModRing(p) evaluate unequal. # However, we cannot just compare the types, since the @@ -1329,7 +1325,7 @@ def __richcmp__(self, other, op): def unit_gens(self, **kwds): r""" - Returns generators for the unit group `(\ZZ/N\ZZ)^*`. + Return generators for the unit group `(\ZZ/N\ZZ)^*`. We compute the list of generators using a deterministic algorithm, so the generators list will always be the same. For each odd prime divisor @@ -1368,7 +1364,6 @@ def unit_gens(self, **kwds): (3,) sage: IntegerModRing(8).unit_gens() # needs sage.groups (7, 5) - """ return self.unit_group(**kwds).gens_values() @@ -1503,7 +1498,6 @@ def unit_group(self, algorithm='sage'): Traceback (most recent call last): ... ValueError: unknown algorithm 'bogus' for computing the unit group - """ from sage.groups.abelian_gps.values import AbelianGroupWithValues if algorithm == 'sage': @@ -1530,9 +1524,9 @@ def random_element(self, bound=None): INPUT: - - ``bound``, a positive integer or ``None`` (the default). Is given, + - ``bound`` -- positive integer or ``None`` (the default); if given, return the coercion of an integer in the interval - ``[-bound, bound]`` into this ring. + ``[-bound, bound]`` into this ring EXAMPLES:: diff --git a/src/sage/rings/finite_rings/maps_finite_field.py b/src/sage/rings/finite_rings/maps_finite_field.py index 9c8713f1a61..e68bd5c7b94 100644 --- a/src/sage/rings/finite_rings/maps_finite_field.py +++ b/src/sage/rings/finite_rings/maps_finite_field.py @@ -40,7 +40,6 @@ def _repr_(self): Isomorphism: From: Vector space of dimension 1 over Finite Field in z4 of size 2^4 To: Finite Field in z4 of size 2^4 - """ s = "Isomorphism:" s += "\n From: {}".format(self.domain()) diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index 822edbf7d5d..04c9d4aed05 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -205,13 +205,13 @@ class ResidueFieldFactory(UniqueFactory): INPUT: - - ``p`` -- a prime ideal of an order in a number field. + - ``p`` -- a prime ideal of an order in a number field - - ``names`` -- the variable name for the finite field created. - Defaults to the name of the number field variable but with - bar placed after it. + - ``names`` -- the variable name for the finite field created; + defaults to the name of the number field variable but with + bar placed after it - - ``check`` -- whether or not to check if `p` is prime. + - ``check`` -- whether or not to check if `p` is prime OUTPUT: the residue field at the prime `p` @@ -586,7 +586,6 @@ class ResidueField_generic(Field): Residue field of Integers modulo 17 sage: F(CyclotomicField(49)) Residue field in zbar of Fractional ideal (17) - """ return AlgebraicExtensionFunctor([self.polynomial()], [self.variable_name()], [None], residue=self.p), self.p.ring() @@ -681,7 +680,7 @@ class ResidueField_generic(Field): def _coerce_map_from_(self, R): """ - Returns ``True`` if there is a coercion map from ``R`` to ``self``. + Return ``True`` if there is a coercion map from ``R`` to ``self``. EXAMPLES:: @@ -714,7 +713,7 @@ class ResidueField_generic(Field): def __repr__(self): """ - Returns a string describing this residue field. + Return a string describing this residue field. EXAMPLES:: @@ -740,7 +739,7 @@ class ResidueField_generic(Field): def lift(self, x): """ - Returns a lift of ``x`` to the Order, returning a "polynomial" in the + Return a lift of ``x`` to the Order, returning a "polynomial" in the generator with coefficients between 0 and `p-1`. EXAMPLES:: @@ -820,7 +819,7 @@ class ResidueField_generic(Field): def lift_map(self): """ - Returns the standard map from this residue field up to the ring of + Return the standard map from this residue field up to the ring of integers lifting the canonical projection. EXAMPLES:: @@ -862,7 +861,7 @@ class ResidueField_generic(Field): def _richcmp_(self, x, op): """ - Compares two residue fields: they are equal iff the primes + Compare two residue fields: they are equal iff the primes defining them are equal and they have the same variable name. EXAMPLES:: @@ -923,7 +922,7 @@ cdef class ReductionMap(Map): A reduction map from a (subset) of a number field or function field to this residue class field. - It will be defined on those elements of the field with non-negative + It will be defined on those elements of the field with nonnegative valuation at the specified prime. EXAMPLES:: @@ -1176,7 +1175,7 @@ cdef class ReductionMap(Map): def section(self): """ - Computes a section of the map, namely a map that lifts elements of the + Compute a section of the map, namely a map that lifts elements of the residue field to elements of the field. EXAMPLES:: @@ -1265,11 +1264,11 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): INPUT: - - ``k`` -- The residue field that is the codomain of this morphism + - ``k`` -- the residue field that is the codomain of this morphism - - ``p`` -- The prime ideal defining this residue field + - ``p`` -- the prime ideal defining this residue field - - ``im_gen`` -- The image of the generator of the number field + - ``im_gen`` -- the image of the generator of the number field EXAMPLES: @@ -1412,7 +1411,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): def section(self): """ - Computes a section of the map, namely a map that lifts elements of + Compute a section of the map, namely a map that lifts elements of the residue field to elements of the ring of integers. EXAMPLES:: @@ -1459,7 +1458,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): def lift(self, x): """ - Returns a lift of ``x`` to the Order, returning a "polynomial" in + Return a lift of ``x`` to the Order, returning a "polynomial" in the generator with coefficients between 0 and `p-1`. EXAMPLES:: @@ -1728,7 +1727,7 @@ class ResidueFiniteField_prime_modn(ResidueField_generic, FiniteField_prime_modn INPUT: - - ``p`` -- A prime ideal of a number field + - ``p`` -- a prime ideal of a number field - ``name`` -- the name of the generator of this extension @@ -1778,7 +1777,7 @@ class ResidueFiniteField_prime_modn(ResidueField_generic, FiniteField_prime_modn INPUT: - - ``x`` -- something to cast in to ``self``. + - ``x`` -- something to cast in to ``self`` EXAMPLES:: diff --git a/src/sage/rings/finite_rings/residue_field_givaro.pyx b/src/sage/rings/finite_rings/residue_field_givaro.pyx index a00bc5138fd..84e78622760 100644 --- a/src/sage/rings/finite_rings/residue_field_givaro.pyx +++ b/src/sage/rings/finite_rings/residue_field_givaro.pyx @@ -71,7 +71,7 @@ class ResidueFiniteField_givaro(ResidueField_generic, FiniteField_givaro): - ``to_order`` -- the map from a lattice in that vector space to the maximal order - - ``PB`` -- a matrix used in defining the reduction and lifting maps. + - ``PB`` -- a matrix used in defining the reduction and lifting maps EXAMPLES:: @@ -104,7 +104,7 @@ class ResidueFiniteField_givaro(ResidueField_generic, FiniteField_givaro): """ INPUT: - - ``x`` -- Something to cast into ``self``. + - ``x`` -- something to cast into ``self`` EXAMPLES:: diff --git a/src/sage/rings/finite_rings/residue_field_ntl_gf2e.pyx b/src/sage/rings/finite_rings/residue_field_ntl_gf2e.pyx index 5071bc87137..eb0620e3ba1 100644 --- a/src/sage/rings/finite_rings/residue_field_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/residue_field_ntl_gf2e.pyx @@ -110,7 +110,7 @@ class ResidueFiniteField_ntl_gf2e(ResidueField_generic, FiniteField_ntl_gf2e): """ INPUT: - - ``x`` -- Something to cast into ``self``. + - ``x`` -- something to cast into ``self`` EXAMPLES:: diff --git a/src/sage/rings/function_field/constructor.py b/src/sage/rings/function_field/constructor.py index 8eb407d1552..a316c384bd1 100644 --- a/src/sage/rings/function_field/constructor.py +++ b/src/sage/rings/function_field/constructor.py @@ -167,7 +167,6 @@ def create_key(self,polynomial,names): sage: N. = K.extension(z - 1) sage: M is N False - """ if names is None: names = polynomial.variable_name() diff --git a/src/sage/rings/function_field/derivations_polymod.py b/src/sage/rings/function_field/derivations_polymod.py index 2e0fe91a968..952d5813dd6 100644 --- a/src/sage/rings/function_field/derivations_polymod.py +++ b/src/sage/rings/function_field/derivations_polymod.py @@ -229,7 +229,6 @@ def _call_(self, x): 1 sage: d(y^2) 0 - """ if x.is_zero(): return self.codomain().zero() diff --git a/src/sage/rings/function_field/differential.py b/src/sage/rings/function_field/differential.py index 4442a63bd22..8f841180532 100644 --- a/src/sage/rings/function_field/differential.py +++ b/src/sage/rings/function_field/differential.py @@ -247,7 +247,7 @@ def _add_(self, other): def _div_(self, other): """ - Return the quotient of ``self`` and ``other`` + Return the quotient of ``self`` and ``other``. INPUT: @@ -427,9 +427,7 @@ def residue(self, place): - ``place`` -- a place of the function field - OUTPUT: - - - an element of the residue field of the place + OUTPUT: an element of the residue field of the place EXAMPLES: @@ -472,7 +470,6 @@ def residue(self, place): sage: d = w.divisor() sage: sum([QQ(w.residue(p)) for p in d.support()]) 0 - """ R,fr_R,to_R = place._residue_field() diff --git a/src/sage/rings/function_field/divisor.py b/src/sage/rings/function_field/divisor.py index 30d99d920d4..13247abe3b0 100644 --- a/src/sage/rings/function_field/divisor.py +++ b/src/sage/rings/function_field/divisor.py @@ -132,7 +132,7 @@ class FunctionFieldDivisor(ModuleElement): - ``parent`` -- divisor group - - ``data`` -- dict of place and multiplicity pairs + - ``data`` -- dictionary of place and multiplicity pairs EXAMPLES:: @@ -467,7 +467,7 @@ def multiplicity(self, place): def is_effective(self): """ - Return ``True`` if this divisor has non-negative multiplicity at all + Return ``True`` if this divisor has nonnegative multiplicity at all places. EXAMPLES:: diff --git a/src/sage/rings/function_field/drinfeld_modules/action.py b/src/sage/rings/function_field/drinfeld_modules/action.py index 8f52be26341..4962162424e 100644 --- a/src/sage/rings/function_field/drinfeld_modules/action.py +++ b/src/sage/rings/function_field/drinfeld_modules/action.py @@ -85,7 +85,9 @@ def __init__(self, drinfeld_module): """ Initialize ``self``. - INPUT: the Drinfeld module + INPUT: + + - ``drinfeld_module`` -- the Drinfeld module TESTS:: diff --git a/src/sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py b/src/sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py index ae28de7c1b7..d183848f296 100644 --- a/src/sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +++ b/src/sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py @@ -121,7 +121,7 @@ def _compute_coefficient_exp(self, k): INPUT: - - ``k`` (integer) -- the index of the coefficient + - ``k`` -- integer; the index of the coefficient TESTS:: @@ -157,8 +157,8 @@ def exponential(self, name='z'): INPUT: - - ``name`` (string, default: ``'z'``) -- the name of the - generator of the lazy power series ring. + - ``name`` -- string (default: ``'z'``); the name of the + generator of the lazy power series ring OUTPUT: a lazy power series over the base field @@ -274,8 +274,8 @@ def logarithm(self, name='z'): INPUT: - - ``name`` (string, default: ``'z'``) -- the name of the - generator of the lazy power series ring. + - ``name`` -- string (default: ``'z'``); the name of the + generator of the lazy power series ring OUTPUT: a lazy power series over the base field @@ -315,7 +315,6 @@ def logarithm(self, name='z'): True sage: log[2**3] == -1/((T**q - T)*(T**(q**2) - T)*(T**(q**3) - T)) # expected value True - """ L = LazyPowerSeriesRing(self._base, name) zero = self._base.zero() @@ -354,7 +353,6 @@ def _compute_goss_polynomial(self, n, q, poly_ring, X): X^12 sage: phi._compute_goss_polynomial(9, 2^2, poly_ring, X) X^9 + (1/(T^3 + T^2 + T))*X^6 + (1/(T^6 + T^4 + T^2))*X^3 - """ # Trivial cases if n.is_zero(): @@ -382,14 +380,12 @@ def goss_polynomial(self, n, var='X'): INPUT: - - ``n`` (integer) -- the index of the Goss polynomial - - - ``var`` (str, default: ``'X'``) -- the name of polynomial - variable. + - ``n`` -- integer; the index of the Goss polynomial - OUTPUT: + - ``var``-- string (default: ``'X'``); the name of polynomial + variable - - a univariate polynomial in ``var`` over the base `A`-field. + OUTPUT: a univariate polynomial in ``var`` over the base `A`-field EXAMPLES:: 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 8b8486a4ef0..df3d274a449 100644 --- a/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py +++ b/src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py @@ -125,7 +125,7 @@ class DrinfeldModule(Parent, UniqueRepresentation): - ``gen`` -- the generator of the Drinfeld module; as a list of coefficients or an Ore polynomial - - ``name`` (default: ``'t'``) -- the name of the Ore polynomial ring + - ``name`` -- (default: ``'t'``) the name of the Ore polynomial ring generator .. RUBRIC:: Construction @@ -533,7 +533,7 @@ def __classcall_private__(cls, function_ring, gen, name='t'): - ``gen`` -- the generator of the Drinfeld module; as a list of coefficients or an Ore polynomial - - ``name`` (default: ``'t'``) -- the name of the Ore polynomial + - ``name`` -- (default: ``'t'``) the name of the Ore polynomial ring gen OUTPUT: a DrinfeldModule or DrinfeldModule_finite @@ -643,7 +643,7 @@ def __init__(self, gen, category): - ``gen`` -- the generator of the Drinfeld module; as a list of coefficients or an Ore polynomial - - ``name`` (default: ``'t'``) -- the name of the Ore polynomial + - ``name`` -- (default: ``'t'``) the name of the Ore polynomial ring gen TESTS:: @@ -759,7 +759,7 @@ def _Hom_(self, other, category): def _check_rank_two(self): r""" - Raise ``NotImplementedError`` if the rank is not two. + Raise :exc:`NotImplementedError` if the rank is not two. TESTS:: @@ -912,15 +912,15 @@ def basic_j_invariant_parameters(self, coeff_indices=None, nonzero=False): INPUT: - - ``coeff_indices`` (list or tuple, or NoneType; default: - ``None``) -- indices of the Drinfeld module generator + - ``coeff_indices`` -- list or tuple, or NoneType (default: + ``None``); indices of the Drinfeld module generator coefficients to be considered in the computation. If the parameter is ``None`` (default), all the coefficients are involved. - - ``nonzero`` (boolean, default: ``False``) -- if this flag + - ``nonzero``-- boolean (default: ``False``); if this flag is set to ``True``, then only the parameters for which the - corresponding basic `j`-invariant is nonzero are returned. + corresponding basic `j`-invariant is nonzero are returned .. WARNING:: @@ -1089,9 +1089,9 @@ def basic_j_invariants(self, nonzero=False): INPUT: - - ``nonzero`` (boolean, default: ``False``) -- if this flag + - ``nonzero``-- boolean (default: ``False``); if this flag is set to ``True``, then only the parameters for which the - corresponding basic `j`-invariant is nonzero are returned. + corresponding basic `j`-invariant is nonzero are returned .. WARNING:: @@ -1143,7 +1143,7 @@ def coefficient(self, n): INPUT: - - ``n`` -- a nonnegative integer + - ``n`` -- nonnegative integer OUTPUT: an element in the base codomain @@ -1182,7 +1182,7 @@ def coefficients(self, sparse=True): INPUT: - - ``sparse`` -- a boolean + - ``sparse`` -- boolean EXAMPLES:: @@ -1234,7 +1234,7 @@ def gen(self): def height(self): r""" Return the height of the Drinfeld module if the function field - characteristic is a prime ideal; raise ValueError otherwise. + characteristic is a prime ideal; raise :exc:`ValueError` otherwise. The height of a Drinfeld module is defined when the function field characteristic is a prime ideal. In our case, this ideal @@ -1292,7 +1292,6 @@ def height(self): Traceback (most recent call last): ... NotImplementedError: height not implemented in this case - """ try: if self.characteristic().is_zero(): @@ -1311,9 +1310,9 @@ def is_isomorphic(self, other, absolutely=False): INPUT: - - ``absolutely`` -- a boolean (default: ``False``); if ``True``, + - ``absolutely`` -- boolean (default: ``False``); if ``True``, check the existence of an isomorphism defined on the base - field; if ``False``, check over an algebraic closure. + field. If ``False``, check over an algebraic closure. EXAMPLES:: @@ -1530,8 +1529,8 @@ def j_invariant(self, parameter=None, check=True): INPUT: - - ``parameter`` (tuple or list, integer or NoneType; default: - ``None``) -- the `j`-invariant parameter: + - ``parameter`` -- tuple or list, integer or NoneType (default: + ``None``); the `j`-invariant parameter: - If ``parameter`` is a list or a tuple, then it must be of the form: @@ -1548,11 +1547,11 @@ def j_invariant(self, parameter=None, check=True): `j`-invariant, that is the `j`-invariant for the parameter `((1,), (q+1, 1))`. - - ``check`` (bool, default: ``True``) -- if this flag is set to + - ``check`` -- boolean (default: ``True``); if this flag is set to ``False`` then the code will not check if the given parameter is valid and satisfy the weight-0 condition. - OUTPUT: the `j`-invariant of ``self`` for the given parameter. + OUTPUT: the `j`-invariant of ``self`` for the given parameter EXAMPLES:: @@ -1741,13 +1740,13 @@ def jk_invariants(self): `1 \leqslant k \leqslant r-1` and the values are the corresponding `j_k`-invariants - Recall that the `j_k`-invariant of self is defined by: + Recall that the `j_k`-invariant of ``self`` is defined by: .. MATH:: j_k := \frac{g_k^{(q^r - 1)/(\mathrm{gcd}(k, r) - 1)}}{g_r^{(q^k - 1)/(\mathrm{gcd}(k, r) - 1)}} - where `g_i` is the `i`-th coefficient of the generator of self. + where `g_i` is the `i`-th coefficient of the generator of ``self``. EXAMPLES:: @@ -2027,7 +2026,6 @@ def hom(self, x, codomain=None): Traceback (most recent call last): ... ValueError: Ore polynomial does not define a morphism - """ # When `x` is in the function ring (or something that coerces to it): if self.function_ring().has_coerce_map_from(x.parent()): @@ -2073,7 +2071,6 @@ def scalar_multiplication(self, x): sage: phi.hom(T^2 + 1) Endomorphism of Drinfeld module defined by T |--> z*t^3 + t^2 + z Defn: z^2*t^6 + (3*z^2 + z + 1)*t^5 + t^4 + 2*z^2*t^3 + (3*z^2 + z + 1)*t^2 + z^2 + 1 - """ if not self.function_ring().has_coerce_map_from(x.parent()): raise ValueError("%s is not element of the function ring" % x) diff --git a/src/sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py b/src/sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py index 470dfc495d7..15809061112 100644 --- a/src/sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +++ b/src/sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py @@ -125,7 +125,7 @@ class DrinfeldModule_finite(DrinfeldModule): def __init__(self, gen, category): """ - Initialize `self`. + Initialize ``self``. Validity of the input is checked in `__classcall_private__`. The `__init__` just saves attributes. @@ -138,7 +138,7 @@ def __init__(self, gen, category): - ``gen`` -- the generator of the Drinfeld module as a list of coefficients or an Ore polynomial - - ``name`` (default: `'t'`) -- the name of the Ore polynomial + - ``name`` -- (default: ``'t'``) the name of the Ore polynomial ring gen TESTS:: @@ -290,8 +290,8 @@ def frobenius_charpoly(self, var='X', algorithm='crystalline'): INPUT: - - ``var`` (default: ``'X'``) -- the name of the second variable - - ``algorithm`` (default: ``'crystalline'``) -- the algorithm + - ``var`` -- (default: ``'X'``) the name of the second variable + - ``algorithm`` -- (default: ``'crystalline'``) the algorithm used to compute the characteristic polynomial EXAMPLES:: @@ -336,11 +336,11 @@ def frobenius_charpoly(self, var='X', algorithm='crystalline'): The available options for 'algorithm' are: - - ``'crystalline'`` -- Computes the characteristic polynomial of the + - ``'crystalline'`` -- computes the characteristic polynomial of the Frobenius endomorphism on the crystalline cohomology of a Drinfeld module. - - ``'motive'`` -- Based on computing the characteristic polynomial of + - ``'motive'`` -- based on computing the characteristic polynomial of the Frobenius endomorphism on the motive of a Drinfeld module. This instantiates the Frobenius as a morphism object and calls its ``'characteristic_polynomial'`` method. @@ -639,7 +639,6 @@ def invert(self, ore_pol): Traceback (most recent call last): ... TypeError: input must be an Ore polynomial - """ deg = ore_pol.degree() r = self.rank() @@ -763,7 +762,6 @@ def is_supersingular(self): False sage: psi.is_supersingular() False - """ return self.height() == self.rank() @@ -788,6 +786,5 @@ def is_ordinary(self): sage: phi = DrinfeldModule(A, [1, z6, 0, z6]) sage: phi.is_ordinary() True - """ return self.height() == 1 diff --git a/src/sage/rings/function_field/drinfeld_modules/homset.py b/src/sage/rings/function_field/drinfeld_modules/homset.py index d50e943686b..41a79e7fe6a 100644 --- a/src/sage/rings/function_field/drinfeld_modules/homset.py +++ b/src/sage/rings/function_field/drinfeld_modules/homset.py @@ -64,7 +64,6 @@ class DrinfeldModuleMorphismAction(Action): From: Drinfeld module defined by T |--> z*t^2 + t + z To: Drinfeld module defined by T |--> (2*z^2 + 4*z + 4)*t^2 + (z^2 + 4*z + 3)*t + z Defn: t + 2 - """ def __init__(self, A, H, is_left, op): r""" @@ -76,7 +75,7 @@ def __init__(self, A, H, is_left, op): - ``H`` -- a homset between Drinfeld modules - - ``is_left`` -- a boolean + - ``is_left`` -- boolean - ``op`` -- an operator @@ -95,7 +94,6 @@ def __init__(self, A, H, is_left, op): sage: right_action = DrinfeldModuleMorphismAction(A, H, False, operator.mul) sage: TestSuite(right_action).run(skip='_test_pickling') - """ Action.__init__(self, A, H, is_left, op) if is_left: @@ -120,7 +118,6 @@ def _act_(self, a, f): From: Drinfeld module defined by T |--> z*t^3 + t^2 + z To: Drinfeld module defined by T |--> (2*z^2 + 4*z + 4)*t^3 + (3*z^2 + 2*z + 2)*t^2 + (2*z^2 + 3*z + 4)*t + z Defn: (2*z^2 + 4*z + 4)*t^4 + (z + 1)*t^3 + t^2 + (2*z^2 + 4*z + 4)*t + z - """ u = f.ore_polynomial() if self._is_left: @@ -234,7 +231,6 @@ class DrinfeldModuleHomset(Homset): False sage: frobenius_endomorphism in H False - """ Element = DrinfeldModuleMorphism @@ -248,10 +244,11 @@ def __init__(self, X, Y, category=None, check=True): - ``Y`` -- the codomain of the homset - - ``category`` (default: ``None``) -- the Drinfeld modules category of + - ``category`` -- (default: ``None``) the Drinfeld modules category of the domain and codomain - - ``check`` (default: ``True``) -- check the validity of the category + - ``check`` -- boolean (default: ``True``); check the validity of the + category TESTS:: diff --git a/src/sage/rings/function_field/drinfeld_modules/morphism.py b/src/sage/rings/function_field/drinfeld_modules/morphism.py index c7e1f6c3bfe..82c1d7a0da1 100644 --- a/src/sage/rings/function_field/drinfeld_modules/morphism.py +++ b/src/sage/rings/function_field/drinfeld_modules/morphism.py @@ -122,7 +122,6 @@ class DrinfeldModuleMorphism(Morphism, UniqueRepresentation, Defn: t + z^5 + z^3 + z + 1 sage: DrinfeldModuleMorphism(Hom(phi, psi), ore_pol) is morphism True - """ @staticmethod def __classcall_private__(cls, parent, x): @@ -459,7 +458,6 @@ def __add__(self, other): sage: F + T Endomorphism of Drinfeld module defined by T |--> z*t^3 + t^2 + z Defn: (z + 1)*t^3 + t^2 + z - """ return self.parent()(self.ore_polynomial() + other.ore_polynomial()) @@ -480,7 +478,6 @@ def _composition_(self, other, H): sage: f * f # indirect doctest Endomorphism of Drinfeld module defined by T |--> z^2*t^3 + z*t^2 + t + z Defn: t^6 - """ return H(self.ore_polynomial() * other.ore_polynomial()) @@ -525,7 +522,6 @@ def inverse(self): Traceback (most recent call last): ... ZeroDivisionError: this morphism is not invertible - """ return self.__invert__() @@ -547,7 +543,6 @@ def __invert__(self): True sage: (g*f).is_identity() True - """ if not self.is_isomorphism(): raise ZeroDivisionError("this morphism is not invertible") @@ -573,7 +568,6 @@ def _motive_matrix(self): sage: f._motive_matrix() [ T + 3 + z 3 + 3*z + 2*z^2] [(1 + z + z^2)*T + 3 + 2*z - z^2 T + 2 - z + 2*z^2] - """ phi = self.domain() phiT = phi.gen() @@ -614,10 +608,10 @@ def norm(self, ideal=True): INPUT: - - ``ideal`` -- a boolean (default: ``True``); if ``True``, - return the norm as an ideal in the function ring of the Drinfeld - modules; if ``False``, return the norm as an element in this - function ring (only relevant for endomorphisms) + - ``ideal`` -- boolean (default: ``True``); if ``True``, return the + norm as an ideal in the function ring of the Drinfeld modules; if + ``False``, return the norm as an element in this function ring (only + relevant for endomorphisms) EXAMPLES:: @@ -660,7 +654,6 @@ def norm(self, ideal=True): Traceback (most recent call last): ... ValueError: norm is defined as an actual element only for endomorphisms - """ nu = self._motive_matrix().det() # We cast to A @@ -720,7 +713,6 @@ def dual_isogeny(self): Traceback (most recent call last): ... ValueError: the dual isogeny of the zero morphism is not defined - """ if not self.is_isogeny(): raise ValueError("the dual isogeny of the zero morphism is not defined") @@ -736,7 +728,7 @@ def characteristic_polynomial(self, var='X'): INPUT: - - ``var`` -- a string (default: ``X``), the name of the + - ``var`` -- string (default: ``X``), the name of the variable of the characteristic polynomial EXAMPLES:: @@ -772,7 +764,6 @@ def characteristic_polynomial(self, var='X'): Traceback (most recent call last): ... ValueError: characteristic polynomial is only defined for endomorphisms - """ if self.domain() is not self.codomain(): raise ValueError("characteristic polynomial is only defined for endomorphisms") @@ -788,7 +779,7 @@ def charpoly(self, var='X'): INPUT: - - ``var`` -- a string (default: ``X``), the name of the + - ``var`` -- string (default: ``'X'``); the name of the variable of the characteristic polynomial EXAMPLES:: @@ -822,6 +813,5 @@ def charpoly(self, var='X'): sage: f.charpoly(var='Y') Y^3 + (T + 1)*Y^2 + (2*T + 3)*Y + 2*T^3 + T + 1 - """ return self.characteristic_polynomial(var) diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index 5e8254e8294..093325f249c 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -146,7 +146,6 @@ cdef class FunctionFieldElement(FieldElement): Traceback (most recent call last): ... NotImplementedError: PARI does not support general function field elements. - """ raise NotImplementedError("PARI does not support general function field elements.") @@ -172,8 +171,8 @@ cdef class FunctionFieldElement(FieldElement): INPUT: - - ``base`` -- a function field (default: ``None``), if ``None``, then - the matrix is formed over the base field of this function field. + - ``base`` -- a function field (default: ``None``); if ``None``, then + the matrix is formed over the base field of this function field EXAMPLES: @@ -641,8 +640,8 @@ cdef class FunctionFieldElement(FieldElement): OUTPUT: If the element is in the valuation ring at the place, then an element - in the residue field at the place is returned. Otherwise, ``ValueError`` - is raised. + in the residue field at the place is returned. Otherwise, a + :exc:`ValueError` is raised. EXAMPLES:: @@ -683,7 +682,7 @@ cdef class FunctionFieldElement(FieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: @@ -709,7 +708,7 @@ cdef class FunctionFieldElement(FieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index 55e887ea491..2d92da20bfe 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -114,7 +114,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): cpdef _richcmp_(self, other, int op): """ - Do rich comparison with the other element with respect to ``op`` + Do rich comparison with the other element with respect to ``op``. EXAMPLES:: @@ -257,7 +257,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: @@ -293,7 +293,6 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): x sage: L(x^9).nth_root(-27)^-27 x^9 - """ if n == 1: return self @@ -323,7 +322,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer ALGORITHM: @@ -345,7 +344,6 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): False sage: L(x).is_nth_power(2) True - """ if n == 0: return self.is_one() diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index 5ad0d81341d..19a63d9ef90 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -61,7 +61,6 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): sage: K. = FunctionField(QQ) sage: ((a+1)/(a-1)).__pari__() # needs sage.libs.pari (a + 1)/(a - 1) - """ return self.element().__pari__() @@ -146,7 +145,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): cpdef _richcmp_(self, other, int op): """ - Compare the element with the other element with respect to ``op`` + Compare the element with the other element with respect to ``op``. INPUT: @@ -213,7 +212,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): cpdef _mul_(self, right): """ - Multiply the element with the other element + Multiply the element with the other element. INPUT: @@ -231,7 +230,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): cpdef _div_(self, right): """ - Divide the element with the other element + Divide the element with the other element. INPUT: @@ -367,7 +366,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: @@ -419,7 +418,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: diff --git a/src/sage/rings/function_field/extensions.py b/src/sage/rings/function_field/extensions.py index e65532db39e..94e810a9f87 100644 --- a/src/sage/rings/function_field/extensions.py +++ b/src/sage/rings/function_field/extensions.py @@ -82,7 +82,6 @@ class ConstantFieldExtension(FunctionFieldExtension): - ``F`` -- a function field whose constant field is `k` - ``k_ext`` -- an extension of `k` - """ def __init__(self, F, k_ext): """ diff --git a/src/sage/rings/function_field/function_field.py b/src/sage/rings/function_field/function_field.py index 315f58cdc39..7c633aba808 100644 --- a/src/sage/rings/function_field/function_field.py +++ b/src/sage/rings/function_field/function_field.py @@ -438,9 +438,7 @@ def extension(self, f, names=None): - ``names`` -- string or tuple of length 1 that names the variable `y` - OUTPUT: - - - a function field + OUTPUT: a function field EXAMPLES:: @@ -475,9 +473,7 @@ def order_with_basis(self, basis, check=True): basis is really linearly independent and that the module it spans is closed under multiplication, and contains the identity element. - OUTPUT: - - - an order in the function field + OUTPUT: an order in the function field EXAMPLES:: @@ -800,17 +796,15 @@ def _convert_map_from_(self, R): def _intermediate_fields(self, base): """ - Return the fields which lie in between base and the function field in the - tower of function fields. + Return the fields which lie in between base and the function field in + the tower of function fields. INPUT: - ``base`` -- function field, either this field or a field from which this field has been created as an extension - OUTPUT: - - - a list of fields; the first entry is this field, the last entry is ``base`` + OUTPUT: list of fields; the first entry is this field, the last entry is ``base`` EXAMPLES:: @@ -999,7 +993,6 @@ def valuation(self, prime): sage: v = L.valuation(x); v # needs sage.rings.function_field (x)-adic valuation - """ from sage.rings.function_field.valuation import FunctionFieldValuation return FunctionFieldValuation(self, prime) @@ -1235,7 +1228,7 @@ def hilbert_symbol(self, a, b, P): INPUT: - - ``a`` and ``b`` -- elements of this function field + - ``a``, ``b`` -- elements of this function field - ``P`` -- a place of this function field diff --git a/src/sage/rings/function_field/function_field_polymod.py b/src/sage/rings/function_field/function_field_polymod.py index fd8c975e682..b384ca7486f 100644 --- a/src/sage/rings/function_field/function_field_polymod.py +++ b/src/sage/rings/function_field/function_field_polymod.py @@ -247,8 +247,7 @@ def _to_base_field(self, f): INPUT: - - ``f`` -- element of the function field which lies in the base - field. + - ``f`` -- element of the function field which lies in the base field EXAMPLES:: @@ -323,7 +322,7 @@ def monic_integral_model(self, names=None): INPUT: - - ``names`` -- a string or a tuple of up to two strings (default: + - ``names`` -- string or a tuple of up to two strings (default: ``None``), the name of the generator of the field, and the name of the generator of the underlying rational function field (if a tuple); if not given, then the names are chosen automatically. @@ -410,7 +409,6 @@ def monic_integral_model(self, names=None): To: Function field in yy defined by yy^2 - xx Defn: y |--> yy x |--> xx) - """ if names: if not isinstance(names, tuple): @@ -528,7 +526,7 @@ def degree(self, base=None): INPUT: - ``base`` -- a function field (default: ``None``), a function field - from which this field has been constructed as a finite extension. + from which this field has been constructed as a finite extension EXAMPLES:: @@ -554,7 +552,6 @@ def degree(self, base=None): Traceback (most recent call last): ... ValueError: base must be the rational function field itself - """ if base is None: base = self.base_field() @@ -659,7 +656,6 @@ def is_separable(self, base=None): sage: L. = K.extension(y^5 - 1) sage: L.is_separable() False - """ if base is None: base = self.base_field() @@ -701,10 +697,10 @@ def free_module(self, base=None, basis=None, map=True): space is over this subfield `R`, which defaults to the base field of this function field. - - ``basis`` -- a basis for this field over the base. + - ``basis`` -- a basis for this field over the base - - ``maps`` -- boolean (default ``True``), whether to return - `R`-linear maps to and from `V`. + - ``maps`` -- boolean (default: ``True``); whether to return + `R`-linear maps to and from `V` OUTPUT: @@ -785,7 +781,6 @@ def free_module(self, base=None, basis=None, map=True): Isomorphism: From: Function field in z defined by z^2 - y To: Vector space of dimension 10 over Rational function field in x over Rational Field) - """ if basis is not None: raise NotImplementedError @@ -891,7 +886,7 @@ def hom(self, im_gens, base_morphism=None): INPUT: - ``im_gens`` -- list of images of the generators of the function field - and of successive base rings. + and of successive base rings - ``base_morphism`` -- homomorphism of the base ring, after the ``im_gens`` are used. Thus if ``im_gens`` has length 2, then @@ -986,7 +981,6 @@ def hom(self, im_gens, base_morphism=None): To: Function field in y defined by y^2 - x^3 - 1 Defn: xx |--> x yy |--> y - """ if not isinstance(im_gens, (list, tuple)): im_gens = [im_gens] @@ -1051,7 +1045,7 @@ def _simple_model(self, name='v'): INPUT: - - ``name`` -- a string, the name of the generator of `N` + - ``name`` -- string; the name of the generator of `N` ALGORITHM: @@ -1127,7 +1121,6 @@ def _simple_model(self, name='v'): To: Function field in v defined by v^6 + x*v^4 + x^2*v^2 + x^3 + 1 Defn: z |--> v^4 + x^2 y |--> v^4 + v + x^2) - """ M = self L = M.base_field() @@ -1188,7 +1181,7 @@ def simple_model(self, name=None): INPUT: - - ``name`` -- a string (default: ``None``), the name of generator of + - ``name`` -- string (default: ``None``); the name of generator of the simple extension. If ``None``, then the name of the generator will be the same as the name of the generator of this function field. @@ -1366,7 +1359,7 @@ def separable_model(self, names=None): INPUT: - - ``names`` -- a tuple of two strings or ``None`` (default: ``None``); + - ``names`` -- tuple of two strings or ``None`` (default: ``None``); the second entry will be used as the variable name of the rational function field, the first entry will be used as the variable name of its separable extension. If ``None``, then the variable names will be @@ -1512,7 +1505,6 @@ def separable_model(self, names=None): Defn: z |--> x_ y |--> x_^3 x |--> x_^6) - """ if names is None: pass @@ -1582,7 +1574,7 @@ def change_variable_name(self, name): INPUT: - - ``name`` -- a string or a tuple consisting of a strings, the names of + - ``name`` -- string or a tuple consisting of a strings, the names of the new variables starting with a generator of this field and going down to the rational function field. @@ -1642,7 +1634,6 @@ def change_variable_name(self, name): Defn: z |--> zz y |--> yy x |--> xx) - """ if not isinstance(name, tuple): name = (name,) @@ -1736,7 +1727,7 @@ def places_above(self, p): INPUT: - - ``p`` -- place of the base rational function field. + - ``p`` -- place of the base rational function field EXAMPLES:: @@ -2096,7 +2087,7 @@ def get_place(self, degree): INPUT: - - ``degree`` -- a positive integer + - ``degree`` -- positive integer OUTPUT: a place of ``degree`` if any exists; otherwise ``None`` @@ -2122,7 +2113,6 @@ def get_place(self, degree): 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) - """ for p in self._places_finite(degree): return p diff --git a/src/sage/rings/function_field/function_field_rational.py b/src/sage/rings/function_field/function_field_rational.py index bb2075b1ecf..a84d0046ae1 100644 --- a/src/sage/rings/function_field/function_field_rational.py +++ b/src/sage/rings/function_field/function_field_rational.py @@ -123,7 +123,6 @@ class RationalFunctionField(FunctionField): + Place (x, y - 1) + Place (x, y + 1) - Place (x + i, y) - """ Element = FunctionFieldElement_rational @@ -204,7 +203,6 @@ def __hash__(self): sage: K. = FunctionField(QQ) sage: hash(K) == hash((K.constant_base_field(), K.variable_names())) True - """ return self._hash @@ -253,7 +251,6 @@ def _element_constructor_(self, x): sage: I = S * [x^2 - y^2, y - t] sage: I.groebner_basis() # needs sage.rings.function_field [x^2 - t^2, y - t] - """ if isinstance(x, FunctionFieldElement): return self.element_class(self, self._field(x._x)) @@ -275,7 +272,7 @@ def _to_constant_base_field(self, f): INPUT: - ``f`` -- element of the rational function field which is a - constant of the underlying rational function field. + constant of the underlying rational function field EXAMPLES:: @@ -295,7 +292,6 @@ def _to_constant_base_field(self, f): True sage: x in QQ False - """ K = self.constant_base_field() if f.denominator() in K and f.numerator() in K: @@ -310,7 +306,8 @@ def _to_polynomial(self, f): INPUT: - - ``f`` -- an element of this rational function field whose denominator is a constant. + - ``f`` -- an element of this rational function field whose denominator + is a constant EXAMPLES:: @@ -332,9 +329,7 @@ def _to_bivariate_polynomial(self, f): - ``f`` -- univariate polynomial over the function field - OUTPUT: - - - bivariate polynomial, denominator + OUTPUT: bivariate polynomial, denominator EXAMPLES:: @@ -405,7 +400,6 @@ def _factor_univariate_polynomial(self, f, proof=None): sage: F = t*x sage: F.factor(proof=False) (x) * t - """ old_variable_name = f.variable_name() # the variables of the bivariate polynomial must be distinct @@ -445,9 +439,7 @@ def extension(self, f, names=None): - ``names`` -- string or length-1 tuple - OUTPUT: - - - a function field + OUTPUT: a function field EXAMPLES:: @@ -506,7 +498,7 @@ def free_module(self, base=None, basis=None, map=True): - ``basis`` -- (ignored) a basis for the vector space - - ``map`` -- (default ``True``), whether to return maps to and from the vector space + - ``map`` -- (default: ``True``), whether to return maps to and from the vector space OUTPUT: @@ -538,7 +530,6 @@ def free_module(self, base=None, basis=None, map=True): 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) - """ if basis is not None: raise NotImplementedError @@ -648,11 +639,9 @@ def hom(self, im_gens, base_morphism=None): ``base_morphism``; this is not checked. - ``base_morphism`` -- a homomorphism from the base field into the - other ring. If ``None``, try to use a coercion map. - - OUTPUT: + other ring; if ``None``, try to use a coercion map - - a map between function fields + OUTPUT: a map between function fields EXAMPLES: @@ -706,7 +695,6 @@ def field(self): .. SEEALSO:: :meth:`sage.rings.fraction_field.FractionField_1poly_field.function_field` - """ return self._field @@ -800,7 +788,7 @@ def change_variable_name(self, name): INPUT: - - ``name`` -- a string or a tuple consisting of a single string, the + - ``name`` -- string or a tuple consisting of a single string, the name of the new variable OUTPUT: @@ -825,7 +813,6 @@ def change_variable_name(self, name): Defn: x |--> y) sage: L.change_variable_name('x')[0] is K True - """ if isinstance(name, tuple): if len(name) != 1: @@ -974,7 +961,7 @@ def get_place(self, degree): INPUT: - - ``degree`` -- a positive integer + - ``degree`` -- positive integer EXAMPLES:: @@ -990,7 +977,6 @@ def get_place(self, degree): Place (x^4 + x + 1) sage: K.get_place(5) # needs sage.libs.pari Place (x^5 + x^2 + 1) - """ for p in self._places_finite(degree): return p diff --git a/src/sage/rings/function_field/jacobian_base.py b/src/sage/rings/function_field/jacobian_base.py index 7954a842f13..405d90bfc3f 100644 --- a/src/sage/rings/function_field/jacobian_base.py +++ b/src/sage/rings/function_field/jacobian_base.py @@ -238,7 +238,7 @@ def _apply_functor(self, jacobian): def merge(self, other): """ - Return the functor merging ``self`` and ``other`` + Return the functor merging ``self`` and ``other``. INPUT: @@ -549,7 +549,7 @@ def get_points(self, n): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -633,7 +633,7 @@ def _an_element_(self): def __call__(self, x): """ - Return the point of ``self`` constructed from ``x`` + Return the point of ``self`` constructed from ``x``. It is assumed that ``self`` and ``x`` are points of the Jacobians attached to the same function field. @@ -776,7 +776,7 @@ def set_base_place(self, place): INPUT: - - ``place`` -- a rational place of the function field. + - ``place`` -- a rational place of the function field The base place `B` is used to map a rational place `P` of the function field to the point of the Jacobian defined by the divisor `P - B`. diff --git a/src/sage/rings/function_field/jacobian_hess.py b/src/sage/rings/function_field/jacobian_hess.py index 13e930fd620..a85bc10e256 100644 --- a/src/sage/rings/function_field/jacobian_hess.py +++ b/src/sage/rings/function_field/jacobian_hess.py @@ -832,7 +832,7 @@ def zero(self): class JacobianGroup_finite_field(JacobianGroup, JacobianGroup_finite_field_base): """ - Jacobian groups of function fields over finite fields + Jacobian groups of function fields over finite fields. INPUT: diff --git a/src/sage/rings/function_field/jacobian_khuri_makdisi.py b/src/sage/rings/function_field/jacobian_khuri_makdisi.py index 012dc983355..2c9a2e5da97 100644 --- a/src/sage/rings/function_field/jacobian_khuri_makdisi.py +++ b/src/sage/rings/function_field/jacobian_khuri_makdisi.py @@ -66,7 +66,6 @@ allows representing points of Jacobian as matrices once we fix a basis of the Riemann-Roch space. - EXAMPLES:: sage: P2. = ProjectiveSpace(GF(17), 2) @@ -170,7 +169,6 @@ class JacobianPoint(JacobianPoint_base): [0 0 0 1 0 0 0 0 5] [0 0 0 0 0 1 0 0 5] [0 0 0 0 0 0 1 0 4] - """ def __init__(self, parent, w): """ @@ -338,7 +336,7 @@ def _rmul_(self, n): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -361,7 +359,7 @@ def multiple(self, n): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: diff --git a/src/sage/rings/function_field/khuri_makdisi.pyx b/src/sage/rings/function_field/khuri_makdisi.pyx index 266a83a5c54..5933abcd1ce 100644 --- a/src/sage/rings/function_field/khuri_makdisi.pyx +++ b/src/sage/rings/function_field/khuri_makdisi.pyx @@ -472,7 +472,7 @@ cdef class KhuriMakdisi_large(KhuriMakdisi_base): cpdef Matrix addflip(self, Matrix wd1, Matrix wd2): """ - Theorem 4.3 (addflip) + Theorem 4.3 (addflip). TESTS:: diff --git a/src/sage/rings/function_field/maps.py b/src/sage/rings/function_field/maps.py index 2863a953f20..6b37456c64c 100644 --- a/src/sage/rings/function_field/maps.py +++ b/src/sage/rings/function_field/maps.py @@ -157,7 +157,6 @@ def _richcmp_(self, other, op): sage: g = K.coerce_map_from(L) sage: f == g False - """ if type(self) is not type(other): return NotImplemented @@ -245,7 +244,6 @@ def _call_(self, v): ....: for i in range(100): ....: a = F.random_element() ....: assert(f(t(a)) == a) - """ fields = self._K._intermediate_fields(self._V.base_field()) fields.pop() @@ -325,7 +323,7 @@ def __init__(self, K, V): sage: K. = FunctionField(QQ); R. = K[] sage: L. = K.extension(y^2 - x*y + 4*x^3) sage: V, f, t = L.vector_space() - sage: TestSuite(t).run(skip="_test_category") + sage: TestSuite(t).run(skip='_test_category') """ self._V = V self._K = K @@ -359,7 +357,6 @@ def _call_(self, x): ....: for i in range(100): ....: a = V.random_element() ....: assert(t(f(a)) == a) - """ ret = [x] fields = self._K._intermediate_fields(self._V.base_field()) @@ -393,7 +390,7 @@ def __init__(self, parent, im_gen, base_morphism): sage: f = K.hom(1/x); f Function Field endomorphism of Rational function field in x over Rational Field Defn: x |--> 1/x - sage: TestSuite(f).run(skip="_test_category") + sage: TestSuite(f).run(skip='_test_category') """ RingHomomorphism.__init__(self, parent) @@ -461,7 +458,7 @@ def __init__(self, parent, im_gen, base_morphism): sage: K. = FunctionField(GF(7)); R. = K[] sage: L. = K.extension(y^3 + 6*x^3 + x) sage: f = L.hom(y*2) - sage: TestSuite(f).run(skip="_test_category") + sage: TestSuite(f).run(skip='_test_category') """ FunctionFieldMorphism.__init__(self, parent, im_gen, base_morphism) # Verify that the morphism is valid: @@ -579,7 +576,8 @@ def __init__(self, parent): def _repr_type(self) -> str: r""" - Return the type of this map (a conversion), for the purposes of printing out self. + Return the type of this map (a conversion), for the purposes of + printing out ``self``. EXAMPLES:: @@ -588,7 +586,6 @@ def _repr_type(self) -> str: Conversion map: From: Rational function field in x over Rational Field To: Rational Field - """ return "Conversion" @@ -599,7 +596,6 @@ def _call_(self, x): sage: K. = FunctionField(QQ) sage: QQ(K(1)) # indirect doctest 1 - """ return x.parent()._to_constant_base_field(x) @@ -628,7 +624,6 @@ class FunctionFieldToFractionField(FunctionFieldVectorSpaceIsomorphism): sage: isinstance(f, FunctionFieldToFractionField) True sage: TestSuite(f).run() - """ def _call_(self, f): r""" @@ -641,7 +636,6 @@ def _call_(self, f): sage: f = K.coerce_map_from(L) sage: f(~L.gen()) 1/x - """ return self.codomain()(f.numerator(), f.denominator()) @@ -832,7 +826,7 @@ def _repr_type(self) -> str: def _call_(self, f): """ - Call the completion for f + Call the completion for f. EXAMPLES:: diff --git a/src/sage/rings/function_field/order_basis.py b/src/sage/rings/function_field/order_basis.py index eebaeab97d1..e4fa3dfe39e 100644 --- a/src/sage/rings/function_field/order_basis.py +++ b/src/sage/rings/function_field/order_basis.py @@ -28,8 +28,8 @@ class FunctionFieldOrder_basis(FunctionFieldOrder): - ``basis`` -- list of elements of the function field - - ``check`` -- (default: ``True``) if ``True``, check whether the module - that ``basis`` generates forms an order + - ``check`` -- boolean (default: ``True``); if ``True``, check whether the + module that ``basis`` generates forms an order EXAMPLES:: diff --git a/src/sage/rings/function_field/order_polymod.py b/src/sage/rings/function_field/order_polymod.py index ad760aad0b6..3f734bdaa01 100644 --- a/src/sage/rings/function_field/order_polymod.py +++ b/src/sage/rings/function_field/order_polymod.py @@ -248,8 +248,8 @@ def _ideal_from_vectors_and_denominator(self, vecs, d=1, check=True): - ``d`` -- (default: 1) a nonzero element of the polynomial ring - - ``check`` -- boolean (default: ``True``); if ``True``, compute the real - denominator of the vectors, possibly different from ``d``. + - ``check`` -- boolean (default: ``True``); if ``True``, compute the + real denominator of the vectors, possibly different from ``d`` EXAMPLES:: @@ -617,7 +617,6 @@ def decomposition(self, ideal): Use Kummer's theorem to shortcut this code if possible, like as done in :meth:`FunctionFieldMaximalOrder_global.decomposition()` - """ from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra import FiniteDimensionalAlgebra from sage.matrix.constructor import matrix @@ -680,7 +679,7 @@ def decomposition(self, ideal): # not be in pO. To ensure that beta*P is in pO, multiplying # beta by each of P's generators must produce a vector whose # elements are multiples of p. We can ensure that all this - # occurs by constructing a matrix in k, and finding a non-zero + # occurs by constructing a matrix in k, and finding a nonzero # vector in the kernel of the matrix. m = [] diff --git a/src/sage/rings/function_field/order_rational.py b/src/sage/rings/function_field/order_rational.py index b21712bcf2c..87cbbdb4858 100644 --- a/src/sage/rings/function_field/order_rational.py +++ b/src/sage/rings/function_field/order_rational.py @@ -287,7 +287,6 @@ def _residue_field_global(self, q, name=None): 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 - """ # polynomial ring over the base field R = self._ring @@ -494,7 +493,8 @@ def basis(self): def gen(self, n=0): """ - Return the ``n``-th generator of self. Since there is only one generator ``n`` must be 0. + Return the `n`-th generator of ``self``. Since there is only one + generator `n` must be `0`. EXAMPLES:: diff --git a/src/sage/rings/function_field/place_polymod.py b/src/sage/rings/function_field/place_polymod.py index ee9e8de5874..7a5f2b90cad 100644 --- a/src/sage/rings/function_field/place_polymod.py +++ b/src/sage/rings/function_field/place_polymod.py @@ -387,7 +387,7 @@ def _residue_field(self, name=None): INPUT: - - ``name`` -- string (default: `None`); name of the generator + - ``name`` -- string (default: ``None``); name of the generator of the residue field EXAMPLES:: diff --git a/src/sage/rings/function_field/valuation.py b/src/sage/rings/function_field/valuation.py index 5bd32b7901e..fe9d6d38e79 100644 --- a/src/sage/rings/function_field/valuation.py +++ b/src/sage/rings/function_field/valuation.py @@ -180,7 +180,6 @@ class FunctionFieldValuationFactory(UniqueFactory): 1 See :meth:`sage.rings.function_field.function_field.FunctionField.valuation` for further examples. - """ def create_key_and_extra_args(self, domain, prime): r""" @@ -207,7 +206,6 @@ def create_key_and_extra_args(self, domain, prime): sage: w = K.valuation(w) sage: w is K.valuation((w, K.hom([~K.gen()]), K.hom([~K.gen()]))) False - """ from sage.categories.function_fields import FunctionFields if domain not in FunctionFields(): @@ -257,7 +255,6 @@ def create_key_and_extra_args_from_place(self, domain, generator): sage: K. = FunctionField(QQ) sage: v = K.valuation(1/x) # indirect doctest - """ if generator not in domain.base_field(): raise NotImplementedError("a place must be defined over a rational function field") @@ -313,7 +310,6 @@ def create_key_and_extra_args_from_valuation(self, domain, 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 assert valuation.domain() is not domain @@ -358,7 +354,6 @@ def create_key_and_extra_args_from_valuation_on_isomorphic_field(self, domain, v 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 if valuation.domain() not in FunctionFields(): @@ -404,7 +399,6 @@ def create_object(self, version, key, **extra_args): sage: w = valuations.GaussValuation(R, QQ.valuation(2)) sage: v = K.valuation(w); v # indirect doctest 2-adic valuation - """ domain, valuation = key from sage.rings.valuation.valuation_space import DiscretePseudoValuationSpace @@ -469,7 +463,6 @@ class FunctionFieldValuation_base(DiscretePseudoValuation): sage: from sage.rings.function_field.valuation import FunctionFieldValuation_base sage: isinstance(v, FunctionFieldValuation_base) True - """ @@ -484,7 +477,6 @@ class DiscreteFunctionFieldValuation_base(DiscreteValuation): sage: from sage.rings.function_field.valuation import DiscreteFunctionFieldValuation_base sage: isinstance(v, DiscreteFunctionFieldValuation_base) True - """ def extensions(self, L): r""" @@ -597,7 +589,6 @@ class RationalFunctionFieldValuation_base(FunctionFieldValuation_base): sage: from sage.rings.function_field.valuation import RationalFunctionFieldValuation_base sage: isinstance(v, RationalFunctionFieldValuation_base) True - """ @cached_method def element_with_valuation(self, s): @@ -618,7 +609,6 @@ def element_with_valuation(self, s): 2/x sage: w.element_with_valuation(1) 2 - """ constant_valuation = self.restriction(self.domain().constant_base_field()) if constant_valuation.is_trivial(): @@ -642,7 +632,6 @@ class ClassicalFunctionFieldValuation_base(DiscreteFunctionFieldValuation_base): sage: from sage.rings.function_field.valuation import ClassicalFunctionFieldValuation_base sage: isinstance(v, ClassicalFunctionFieldValuation_base) True - """ def _test_classical_residue_field(self, **options): r""" @@ -654,7 +643,6 @@ def _test_classical_residue_field(self, **options): sage: K. = FunctionField(QQ) sage: v = K.valuation(x^2 + 1) sage: v._test_classical_residue_field() # needs sage.rings.number_field - """ tester = self._tester(**options) @@ -673,7 +661,6 @@ def _ge_(self, other): False sage: w >= v False - """ if other.is_trivial(): return other.is_discrete_valuation() @@ -691,7 +678,6 @@ class InducedRationalFunctionFieldValuation_base(FunctionFieldValuation_base): sage: K. = FunctionField(QQ) sage: v = K.valuation(x^2 + 1) # indirect doctest - """ def __init__(self, parent, base_valuation): r""" @@ -702,7 +688,6 @@ def __init__(self, parent, base_valuation): sage: from sage.rings.function_field.valuation import InducedRationalFunctionFieldValuation_base sage: isinstance(v, InducedRationalFunctionFieldValuation_base) True - """ FunctionFieldValuation_base.__init__(self, parent) @@ -721,7 +706,6 @@ def uniformizer(self): sage: K. = FunctionField(QQ) sage: K.valuation(x).uniformizer() x - """ return self.domain()(self._base_valuation.uniformizer()) @@ -738,7 +722,6 @@ def lift(self, F): 0 sage: v.lift(1) 1 - """ F = self.residue_ring().coerce(F) if F in self._base_valuation.residue_ring(): @@ -761,7 +744,6 @@ def value_group(self): sage: K. = FunctionField(QQ) sage: K.valuation(x).value_group() Additive Abelian Group generated by 1 - """ return self._base_valuation.value_group() @@ -775,7 +757,6 @@ def reduce(self, f): sage: v = K.valuation(x^2 + 1) sage: v.reduce(x) # needs sage.rings.number_field u1 - """ f = self.domain().coerce(f) @@ -806,7 +787,6 @@ def _repr_(self): sage: K. = FunctionField(QQ) sage: K.valuation(x^2 + 1) # indirect doctest (x^2 + 1)-adic valuation - """ from sage.rings.valuation.augmented_valuation import AugmentedValuation_base from sage.rings.valuation.gauss_valuation import GaussValuation @@ -832,7 +812,6 @@ def extensions(self, L): sage: L. = FunctionField(GaussianIntegers().fraction_field()) sage: v.extensions(L) # indirect doctest [(x - I)-adic valuation, (x + I)-adic valuation] - """ K = self.domain() if L is K: @@ -865,7 +844,6 @@ def _call_(self, f): sage: v = K.valuation(x) # indirect doctest sage: v((x+1)/x^2) -2 - """ return self._base_valuation(f.numerator()) - self._base_valuation(f.denominator()) @@ -878,7 +856,6 @@ def residue_ring(self): sage: K. = FunctionField(QQ) sage: K.valuation(x).residue_ring() Rational Field - """ return self._base_valuation.residue_ring().fraction_field() @@ -891,7 +868,6 @@ def restriction(self, ring): sage: K. = FunctionField(QQ) sage: K.valuation(x).restriction(QQ) Trivial valuation on Rational Field - """ if ring.is_subring(self._base_valuation.domain()): return self._base_valuation.restriction(ring) @@ -923,7 +899,6 @@ def simplify(self, f, error=None, force=False): sage: v.simplify(f, force=True) 3 - """ f = self.domain().coerce(f) @@ -984,7 +959,6 @@ def _relative_size(self, f): sage: v.simplify(f, force=True) -1 - """ return max(self._base_valuation._relative_size(f.numerator()), self._base_valuation._relative_size(f.denominator())) @@ -1015,7 +989,6 @@ class FiniteRationalFunctionFieldValuation(InducedRationalFunctionFieldValuation sage: q = L.valuation(x^6 - t); q (x^6 + 2*t)-adic valuation - """ def __init__(self, parent, base_valuation): r""" @@ -1026,7 +999,6 @@ def __init__(self, parent, base_valuation): sage: from sage.rings.function_field.valuation import FiniteRationalFunctionFieldValuation sage: isinstance(v, FiniteRationalFunctionFieldValuation) True - """ InducedRationalFunctionFieldValuation_base.__init__(self, parent, base_valuation) ClassicalFunctionFieldValuation_base.__init__(self, parent) @@ -1044,7 +1016,6 @@ class NonClassicalRationalFunctionFieldValuation(InducedRationalFunctionFieldVal sage: v = GaussValuation(QQ['x'], QQ.valuation(2)) sage: w = K.valuation(v); w # indirect doctest 2-adic valuation - """ def __init__(self, parent, base_valuation): r""" @@ -1061,7 +1032,6 @@ def __init__(self, parent, base_valuation): sage: from sage.rings.function_field.valuation import NonClassicalRationalFunctionFieldValuation sage: isinstance(w, NonClassicalRationalFunctionFieldValuation) True - """ InducedRationalFunctionFieldValuation_base.__init__(self, parent, base_valuation) RationalFunctionFieldValuation_base.__init__(self, parent) @@ -1100,7 +1070,6 @@ def residue_ring(self): sage: w = K.valuation(vv) sage: w.residue_ring() Finite Field of size 2 - """ if not self.is_discrete_valuation(): # A pseudo valuation attaining negative infinity does typically not have a function field as its residue ring @@ -1121,7 +1090,6 @@ class FunctionFieldFromLimitValuation(FiniteExtensionFromLimitValuation, Discret 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 - """ def __init__(self, parent, approximant, G, approximants): r""" @@ -1136,7 +1104,6 @@ def __init__(self, parent, approximant, G, approximants): sage: from sage.rings.function_field.valuation import FunctionFieldFromLimitValuation sage: isinstance(w, FunctionFieldFromLimitValuation) True - """ FiniteExtensionFromLimitValuation.__init__(self, parent, approximant, G, approximants) DiscreteFunctionFieldValuation_base.__init__(self, parent) @@ -1155,7 +1122,6 @@ def _to_base_domain(self, f): 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 - """ return f.element() @@ -1173,7 +1139,6 @@ def scale(self, scalar): sage: w = v.extension(L) sage: 3*w 3 * (x - 1)-adic valuation - """ if scalar in QQ and scalar > 0 and scalar != 1: return self.domain().valuation(self._base_valuation._initial_approximation.scale(scalar)) @@ -1190,7 +1155,6 @@ class FunctionFieldMappedValuation_base(FunctionFieldValuation_base, MappedValua sage: K. = FunctionField(GF(2)) sage: v = K.valuation(1/x); v Valuation at the infinite place - """ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_valuation_domain): r""" @@ -1201,7 +1165,6 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuation_base sage: isinstance(v, FunctionFieldMappedValuation_base) True - """ FunctionFieldValuation_base.__init__(self, parent) MappedValuation_base.__init__(self, parent, base_valuation) @@ -1222,7 +1185,6 @@ def _to_base_domain(self, f): sage: w = v.extension(L) # needs sage.rings.function_field sage: w._to_base_domain(y) # needs sage.rings.function_field x^2*y - """ return self._to_base(f) @@ -1256,7 +1218,6 @@ def scale(self, scalar): 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) - """ from sage.rings.rational_field import QQ if scalar in QQ and scalar > 0 and scalar != 1: @@ -1275,7 +1236,6 @@ def _repr_(self): sage: v = K.valuation(1/x) sage: v.extension(L) # indirect doctest # needs sage.rings.function_field Valuation at the infinite place - """ to_base = repr(self._to_base) if hasattr(self._to_base, '_repr_defn'): @@ -1296,7 +1256,6 @@ def is_discrete_valuation(self): sage: w0,w1 = v.extensions(L) sage: w0.is_discrete_valuation() True - """ return self._base_valuation.is_discrete_valuation() @@ -1312,7 +1271,6 @@ class FunctionFieldMappedValuationRelative_base(FunctionFieldMappedValuation_bas sage: K. = FunctionField(GF(2)) sage: v = K.valuation(1/x); v Valuation at the infinite place - """ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_valuation_domain): r""" @@ -1323,7 +1281,6 @@ def __init__(self, parent, base_valuation, to_base_valuation_domain, from_base_v sage: from sage.rings.function_field.valuation import FunctionFieldMappedValuationRelative_base sage: isinstance(v, FunctionFieldMappedValuationRelative_base) True - """ FunctionFieldMappedValuation_base.__init__(self, parent, base_valuation, to_base_valuation_domain, from_base_valuation_domain) if self.domain().constant_base_field() is not base_valuation.domain().constant_base_field(): @@ -1338,7 +1295,6 @@ def restriction(self, ring): sage: K. = FunctionField(GF(2)) sage: K.valuation(1/x).restriction(GF(2)) Trivial valuation on Finite Field of size 2 - """ if ring.is_subring(self.domain().constant_base_field()): return self._base_valuation.restriction(ring) @@ -1360,7 +1316,6 @@ class RationalFunctionFieldMappedValuation(FunctionFieldMappedValuationRelative_ 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) - """ def __init__(self, parent, base_valuation, to_base_valuation_doain, from_base_valuation_domain): r""" @@ -1374,7 +1329,6 @@ def __init__(self, parent, base_valuation, to_base_valuation_doain, from_base_va sage: from sage.rings.function_field.valuation import RationalFunctionFieldMappedValuation sage: isinstance(v, RationalFunctionFieldMappedValuation) True - """ FunctionFieldMappedValuationRelative_base.__init__(self, parent, base_valuation, to_base_valuation_doain, from_base_valuation_domain) RationalFunctionFieldValuation_base.__init__(self, parent) @@ -1388,7 +1342,6 @@ class InfiniteRationalFunctionFieldValuation(FunctionFieldMappedValuationRelativ sage: K. = FunctionField(QQ) sage: v = K.valuation(1/x) # indirect doctest - """ def __init__(self, parent): r""" @@ -1399,7 +1352,6 @@ def __init__(self, parent): sage: from sage.rings.function_field.valuation import InfiniteRationalFunctionFieldValuation sage: isinstance(v, InfiniteRationalFunctionFieldValuation) True - """ x = parent.domain().gen() FunctionFieldMappedValuationRelative_base.__init__(self, parent, FunctionFieldValuation(parent.domain(), x), parent.domain().hom([1/x]), parent.domain().hom([1/x])) @@ -1415,7 +1367,6 @@ def _repr_(self): sage: K. = FunctionField(QQ) sage: K.valuation(1/x) # indirect doctest Valuation at the infinite place - """ return "Valuation at the infinite place" @@ -1448,7 +1399,6 @@ class FunctionFieldExtensionMappedValuation(FunctionFieldMappedValuationRelative sage: from sage.rings.function_field.valuation import FunctionFieldExtensionMappedValuation sage: isinstance(w, FunctionFieldExtensionMappedValuation) # needs sage.rings.function_field True - """ def _repr_(self): r""" @@ -1472,7 +1422,6 @@ def _repr_(self): 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] - """ assert (self.domain().base() is not self.domain()) if repr(self._base_valuation) == repr(self.restriction(self.domain().base())): diff --git a/src/sage/rings/invariants/invariant_theory.py b/src/sage/rings/invariants/invariant_theory.py index 11416436ced..7660b2fee34 100644 --- a/src/sage/rings/invariants/invariant_theory.py +++ b/src/sage/rings/invariants/invariant_theory.py @@ -4265,7 +4265,7 @@ def binary_form_from_invariants(self, degree, invariants, variables=None, as_for (0, 1, -1, 0) For binary cubics, there is no class implemented yet, so ``as_form=True`` - will yield an ``NotImplementedError``:: + will yield a :exc:`NotImplementedError`:: sage: invariant_theory.binary_form_from_invariants(3, [discriminant]) Traceback (most recent call last): diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 705aca5d3e0..a8b0556b0df 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -411,22 +411,22 @@ def __getitem__(self, n): def coefficients(self, n=None): r""" - Return the first `n` non-zero coefficients of ``self``. + Return the first `n` nonzero coefficients of ``self``. INPUT: - - ``n`` -- (optional) the number of non-zero coefficients to return + - ``n`` -- (optional) the number of nonzero coefficients to return - If the series has fewer than `n` non-zero coefficients, only + If the series has fewer than `n` nonzero coefficients, only these are returned. If ``n`` is ``None``, a :class:`~sage.misc.lazy_list.lazy_list_generic` with all - non-zero coefficients is returned instead. + nonzero coefficients is returned instead. .. WARNING:: - If there are fewer than `n` non-zero coefficients, but + If there are fewer than `n` nonzero coefficients, but this cannot be detected, this method will not return. EXAMPLES:: @@ -434,7 +434,7 @@ def coefficients(self, n=None): sage: L. = LazyPowerSeriesRing(QQ) sage: f = L([1,2,3]) sage: f.coefficients(5) - doctest:...: DeprecationWarning: the method coefficients now only returns the non-zero coefficients. Use __getitem__ instead. + doctest:...: DeprecationWarning: the method coefficients now only returns the nonzero coefficients. Use __getitem__ instead. See https://github.com/sagemath/sage/issues/32367 for details. [1, 2, 3] @@ -460,7 +460,7 @@ def coefficients(self, n=None): return [] from itertools import repeat, chain, islice from sage.misc.lazy_list import lazy_list - # prepare a generator of the non-zero coefficients + # prepare a generator of the nonzero coefficients P = self.parent() if isinstance(coeff_stream, Stream_exact): if coeff_stream._constant: @@ -480,7 +480,7 @@ def coefficients(self, n=None): if isinstance(self, LazyPowerSeries) and self.parent()._arity == 1: from sage.misc.superseded import deprecation - deprecation(32367, 'the method coefficients now only returns the non-zero coefficients. Use __getitem__ instead.') + deprecation(32367, 'the method coefficients now only returns the nonzero coefficients. Use __getitem__ instead.') if P._internal_poly_ring.base_ring() is not P._laurent_poly_ring: return list(islice(coeffs, n)) @@ -574,7 +574,6 @@ def map_coefficients(self, f): sage: f = z + z^2 + z^3 sage: f.map_coefficients(lambda c: c + 1) 2*z + 2*z^2 + 2*z^3 - """ P = self.parent() coeff_stream = self._coeff_stream @@ -1025,7 +1024,7 @@ def _richcmp_(self, other, op): def __hash__(self): """ - Return the hash of ``self`` + Return the hash of ``self``. TESTS:: @@ -1179,8 +1178,8 @@ def is_nonzero(self, proof=False): INPUT: - - ``proof`` -- (default: ``False``) if ``True``, this will also return - an index such that ``self`` has a nonzero coefficient + - ``proof`` -- boolean (default: ``False``); if ``True``, this will + also return an index such that ``self`` has a nonzero coefficient .. WARNING:: @@ -2697,7 +2696,6 @@ def arcsinh(self): sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic sage: asinh(z)[0:6] == asinh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True - """ from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) @@ -2735,7 +2733,6 @@ def arctanh(self): sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic sage: atanh(z)[0:6] == atanh(x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True - """ from .lazy_series_ring import LazyLaurentSeriesRing P = LazyLaurentSeriesRing(self.base_ring(), "z", sparse=self.parent()._sparse) @@ -2770,7 +2767,6 @@ def hypergeometric(self, a, b): sage: L. = LazyLaurentSeriesRing(SR); x = var("x") # needs sage.symbolic sage: z.hypergeometric([1,1],[1])[0:6] == hypergeometric([1,1],[1], x).series(x, 6).coefficients(sparse=False) # needs sage.symbolic True - """ from .lazy_series_ring import LazyLaurentSeriesRing from sage.arith.misc import rising_factorial @@ -3834,8 +3830,8 @@ def __call__(self, g): composition `(f \circ g)(z) = f(g(z))` is defined if and only if: - `g = 0` and `\mathrm{val}(f) \geq 0`, - - `g` is non-zero and `f` has only finitely many non-zero coefficients, - - `g` is non-zero and `\mathrm{val}(g) > 0`. + - `g` is nonzero and `f` has only finitely many nonzero coefficients, + - `g` is nonzero and `\mathrm{val}(g) > 0`. INPUT: @@ -4031,7 +4027,7 @@ def __call__(self, g): ZeroDivisionError: the valuation of the series must be nonnegative `g \neq 0` and `\mathrm{val}(g) \leq 0` and `f` has infinitely many - non-zero coefficients:: + nonzero coefficients:: sage: g = z^-1 + z^-2 sage: g.valuation() <= 0 @@ -4122,7 +4118,6 @@ def __call__(self, g): sage: g = L([2]) sage: f(g) 0 - """ # Find a good parent for the result from sage.structure.element import get_coercion_model @@ -4139,7 +4134,7 @@ def __call__(self, g): and isinstance(g._coeff_stream, Stream_zero))): if self._coeff_stream._approximate_order >= 0: return P(self[0]) - # Perhaps we just don't yet know if the valuation is non-negative + # Perhaps we just don't yet know if the valuation is nonnegative if any(self._coeff_stream[i] for i in range(self._coeff_stream._approximate_order, 0)): raise ZeroDivisionError("the valuation of the series must be nonnegative") self._coeff_stream._approximate_order = 0 @@ -4705,7 +4700,7 @@ def approximate_series(self, prec, name=None): INPUT: - - ``prec`` -- an integer + - ``prec`` -- integer - ``name`` -- name of the variable; if it is ``None``, the name of the variable of the series is used @@ -4806,7 +4801,6 @@ def polynomial(self, degree=None, name=None): sage: L.zero().polynomial() 0 - """ S = self.parent() @@ -4937,7 +4931,7 @@ def exponential(self): def compute_coefficients(self, i): r""" - Computes all the coefficients of ``self`` up to ``i``. + Compute all the coefficients of ``self`` up to ``i``. This method is deprecated, it has no effect anymore. @@ -4976,7 +4970,6 @@ def _im_gens_(self, codomain, im_gens, base_map=None): sage: f = 1/(1+x*q-t) sage: f._im_gens_(S, [s, x*s], base_map=cc) 1 + 2*x*s + 4*x^2*s^2 + 8*x^3*s^3 + 16*x^4*s^4 + 32*x^5*s^5 + 64*x^6*s^6 + O(s^7) - """ if base_map is None: return codomain(self(*im_gens)) @@ -5628,7 +5621,7 @@ def adams_operator(self, p): INPUT: - - ``p`` -- a positive integer + - ``p`` -- positive integer EXAMPLES: @@ -6401,16 +6394,16 @@ def __call__(self, *args): - `g_i = 0`, or - setting all alphabets except the `i`-th in `f` to zero yields a symmetric function with only finitely many - non-zero coefficients, or + nonzero coefficients, or - `\mathrm{val}(g) > 0`. If `f` is a univariate 'exact' lazy symmetric function, we - can check whether `f` has only finitely many non-zero + can check whether `f` has only finitely many nonzero coefficients. However, if `f` has larger arity, we have no way to test whether setting all but one alphabets of `f` to zero yields a polynomial, except if `f` itself is 'exact' and therefore a symmetric function with only finitely many - non-zero coefficients. + nonzero coefficients. INPUT: @@ -6669,7 +6662,6 @@ def revert(self): - Andrew Gainer-Dewar - Martin Rubey - """ P = self.parent() if P._arity != 1: @@ -6833,7 +6825,7 @@ def derivative_with_respect_to_p1(self, n=1): def suspension(self): r""" - Return the suspension of `self``. + Return the suspension of ``self``. This is an involution, that maps the homogeneous component `f_n` of degree `n` to `(-1)^{n - 1} \omega(f_n)`, where @@ -6919,7 +6911,7 @@ def functorial_composition(self, *args): sage: P.functorial_composition(P2)[4].coefficient([2,2])[3] # needs sage.libs.pari sage.modules 8 - labellings of their vertices with two 1's and two 2's. + labellings of their vertices with two 1s and two 2s. The symmetric function `h_1 \sum_n h_n` is the neutral element with respect to functorial composition:: @@ -7194,7 +7186,6 @@ def arithmetic_product(self, *args): sage: L = LazySymmetricFunctions(s) # needs sage.modules sage: L(s([2])).arithmetic_product(s([1,1,1])) # needs sage.modules s[2, 2, 1, 1] + s[3, 1, 1, 1] + s[3, 2, 1] + s[3, 3] - """ if len(args) != self.parent()._arity: raise ValueError("arity must be equal to the number of arguments provided") @@ -7319,7 +7310,6 @@ def symmetric_function(self, degree=None): 0 sage: f4.symmetric_function(0) # needs lrcalc_python s[] - """ S = self.parent() R = S._laurent_poly_ring @@ -7512,7 +7502,7 @@ def __invert__(self): sage: f[1] Traceback (most recent call last): ... - ZeroDivisionError: the Dirichlet inverse only exists if the coefficient with index 1 is non-zero + ZeroDivisionError: the Dirichlet inverse only exists if the coefficient with index 1 is nonzero sage: f = ~L(lambda n: n-1) sage: f[1] diff --git a/src/sage/rings/multi_power_series_ring.py b/src/sage/rings/multi_power_series_ring.py index d399fdb6c0b..d7b07fc09cf 100644 --- a/src/sage/rings/multi_power_series_ring.py +++ b/src/sage/rings/multi_power_series_ring.py @@ -306,7 +306,6 @@ def __classcall__(cls, base_ring, num_gens, name_list, sage: P2 = PowerSeriesRing(QQ,4,'f', order='degrevlex') sage: P1 is P2 # indirect doctest True - """ order = TermOrder(order, num_gens) return super().__classcall__(cls, base_ring, num_gens, name_list, @@ -315,7 +314,7 @@ def __classcall__(cls, base_ring, num_gens, name_list, def __init__(self, base_ring, num_gens, name_list, order='negdeglex', default_prec=10, sparse=False): """ - Initializes a multivariate power series ring. See PowerSeriesRing + Initialize a multivariate power series ring. See PowerSeriesRing for complete documentation. INPUT: @@ -324,7 +323,7 @@ def __init__(self, base_ring, num_gens, name_list, - ``num_gens`` -- number of generators - - ``name_list`` -- List of indeterminate names or a single name. + - ``name_list`` -- list of indeterminate names or a single name If a single name is given, indeterminates will be this name followed by a number from 0 to num_gens - 1. If a list is given, these will be the indeterminate names and the length @@ -333,11 +332,11 @@ def __init__(self, base_ring, num_gens, name_list, - ``order`` -- ordering of variables; default is negative degree lexicographic - - ``default_prec`` -- The default total-degree precision for - elements. The default value of default_prec is 10. + - ``default_prec`` -- (default: 10) the default total-degree precision + for elements - - ``sparse`` -- whether or not the power series are sparse. - The underlying polynomial ring is always sparse. + - ``sparse`` -- whether or not the power series are sparse; the + underlying polynomial ring is always sparse EXAMPLES:: @@ -364,7 +363,6 @@ def __init__(self, base_ring, num_gens, name_list, sage: P.category() Category of commutative rings sage: TestSuite(P).run() - """ self._term_order = order if not base_ring.is_commutative(): @@ -397,7 +395,7 @@ def __init__(self, base_ring, num_gens, name_list, def _repr_(self): """ - Prints out a multivariate power series ring. + Print out a multivariate power series ring. EXAMPLES:: @@ -420,7 +418,7 @@ def _repr_(self): def _latex_(self): """ - Returns latex representation of power series ring + Return latex representation of power series ring. EXAMPLES:: @@ -465,7 +463,7 @@ def is_noetherian(self, proof=False): def term_order(self): """ - Print term ordering of self. Term orderings are implemented by the + Print term ordering of ``self``. Term orderings are implemented by the TermOrder class. EXAMPLES:: @@ -476,7 +474,7 @@ def term_order(self): sage: m = y*z^12 - y^6*z^8 - x^7*y^5*z^2 + x*y^2*z + M.O(15); m x*y^2*z + y*z^12 - x^7*y^5*z^2 - y^6*z^8 + O(x, y, z)^15 - sage: N = PowerSeriesRing(ZZ,3,'x,y,z', order="deglex") + sage: N = PowerSeriesRing(ZZ,3,'x,y,z', order='deglex') sage: N.term_order() Degree lexicographic term order sage: N(m) @@ -486,7 +484,7 @@ def term_order(self): def characteristic(self): """ - Return characteristic of base ring, which is characteristic of self. + Return characteristic of base ring, which is characteristic of ``self``. EXAMPLES:: @@ -499,8 +497,8 @@ def characteristic(self): return self.base_ring().characteristic() def construction(self): - """ - Returns a functor F and base ring R such that F(R) == self. + r""" + Return a functor `F` and base ring `R` such that ``F(R) == self``. EXAMPLES:: @@ -533,7 +531,6 @@ def construction(self): sage: c,R = M3.construction() sage: c(R)==M3 True - """ from sage.categories.pushout import CompletionFunctor extras = {'order':self.term_order(), 'num_gens':self.ngens()} @@ -545,10 +542,10 @@ def construction(self): def change_ring(self, R): """ - Returns the power series ring over R in the same variable as self. + Return the power series ring over `R` in the same variable as ``self``. This function ignores the question of whether the base ring of self - is or can extend to the base ring of R; for the latter, use - base_extend. + is or can extend to the base ring of `R`; for the latter, use + ``base_extend``. EXAMPLES:: @@ -576,7 +573,7 @@ def change_ring(self, R): def remove_var(self, *var): """ - Remove given variable or sequence of variables from self. + Remove given variable or sequence of variables from ``self``. EXAMPLES:: @@ -598,7 +595,6 @@ def remove_var(self, *var): sage: M.remove_var(*M.gens()) Finite Field of size 5 - """ vars = list(self.variable_names()) for v in var: @@ -617,7 +613,7 @@ def remove_var(self, *var): def _coerce_impl(self, f): """ Return the canonical coercion of ``f`` into this multivariate power - series ring, if one is defined, or raise a TypeError. + series ring, if one is defined, or raise a :exc:`TypeError`. The rings that canonically coerce to this multivariate power series ring are: @@ -881,7 +877,7 @@ def _element_constructor_(self, f, prec=None): def laurent_series_ring(self): """ - Laurent series not yet implemented for multivariate power series rings + Laurent series not yet implemented for multivariate power series rings. TESTS:: @@ -915,7 +911,7 @@ def _poly_ring(self, x=None): def _mpoly_ring(self, x=None): """ - Same as _poly_ring + Same as ``_poly_ring``. TESTS:: @@ -940,7 +936,6 @@ def _bg_ps_ring(self, x=None): t, u over Rational Field sage: R._bg_ps_ring(4).parent() == R False - """ if x is None: return self._bg_power_series_ring @@ -949,7 +944,7 @@ def _bg_ps_ring(self, x=None): def is_sparse(self): """ - Is self sparse? + Check whether ``self`` is sparse. EXAMPLES:: @@ -966,7 +961,7 @@ def is_sparse(self): def is_dense(self): """ - Is self dense? (opposite of sparse) + Is ``self`` dense? (opposite of sparse) EXAMPLES:: @@ -983,7 +978,7 @@ def is_dense(self): def gen(self, n=0): """ - Return the nth generator of self. + Return the `n`-th generator of ``self``. EXAMPLES:: @@ -998,7 +993,7 @@ def gen(self, n=0): def ngens(self): """ - Return number of generators of self. + Return number of generators of ``self``. EXAMPLES:: diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 32e16def317..db189f7c5db 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -223,20 +223,22 @@ class MPowerSeries(PowerSeries): INPUT: - - ``parent`` -- A multivariate power series. + - ``parent`` -- a multivariate power series - - ``x`` -- The element (default: 0). This can be another + - ``x`` -- the element (default: 0). This can be another :class:`MPowerSeries` object, or an element of one of the following: - the background univariate power series ring - the foreground polynomial ring - a ring that coerces to one of the above two - - ``prec`` -- (default: ``infinity``) The precision + - ``prec`` -- (default: ``infinity``) the precision - - ``is_gen`` -- (default: ``False``) Is this element one of the generators? + - ``is_gen`` -- boolean (default: ``False``); whether this element is one + of the generators - - ``check`` -- (default: ``False``) Needed by univariate power series class + - ``check`` -- boolean (default: ``False``); needed by univariate power + series class EXAMPLES: @@ -346,7 +348,6 @@ def __init__(self, parent, x=0, prec=infinity, is_gen=False, check=False): sage: b = B(d) # test coercion from univariate power series ring sage: b in B True - """ PowerSeries.__init__(self, parent, prec, is_gen=is_gen) self._PowerSeries__is_gen = is_gen @@ -634,7 +635,7 @@ def _latex_(self): def _im_gens_(self, codomain, im_gens, base_map=None): """ - Returns the image of this series under the map that sends the + Return the image of this series under the map that sends the generators to ``im_gens``. This is used internally for computing homomorphisms. @@ -1410,7 +1411,7 @@ def valuation(self): if self._bg_value == 0: return infinity - # at this stage, self is probably a non-zero + # at this stage, self is probably a nonzero # element of the base ring for a in range(len(self._bg_value.list())): if self._bg_value.list()[a] != 0: @@ -1620,7 +1621,7 @@ def integral(self, *args): .. warning:: Coefficient division. If the base ring is not a field (e.g. `ZZ`), or if it has a - non-zero characteristic, (e.g. `ZZ/3ZZ`), integration is not + nonzero characteristic, (e.g. `ZZ/3ZZ`), integration is not always possible while staying with the same base ring. In the first case, Sage will report that it has not been able to coerce some coefficient to the base ring:: @@ -1644,7 +1645,7 @@ def integral(self, *args): sage: f.integral(b) b^2 + O(a, b)^6 - In non-zero characteristic, Sage will report that a zero division + In nonzero characteristic, Sage will report that a zero division occurred :: sage: T. = PowerSeriesRing(Zmod(3), 2) @@ -1719,7 +1720,7 @@ def _integral(self, xx): def ogf(self): """ - Method from univariate power series not yet implemented + Method from univariate power series not yet implemented. TESTS:: @@ -1734,7 +1735,7 @@ def ogf(self): def egf(self): """ - Method from univariate power series not yet implemented + Method from univariate power series not yet implemented. TESTS:: @@ -1749,7 +1750,7 @@ def egf(self): def __pari__(self): """ - Method from univariate power series not yet implemented + Method from univariate power series not yet implemented. TESTS:: @@ -1882,8 +1883,8 @@ def exp(self, prec=infinity): INPUT: - - ``prec`` -- Integer or ``infinity``. The degree to truncate - the result to. + - ``prec`` -- integer or ``infinity``; the degree to truncate + the result to OUTPUT: @@ -1977,8 +1978,8 @@ def log(self, prec=infinity): INPUT: - - ``prec`` -- Integer or ``infinity``. The degree to truncate - the result to. + - ``prec`` -- integer or ``infinity``; the degree to truncate + the result to OUTPUT: @@ -2033,14 +2034,14 @@ def log(self, prec=infinity): sage: a.log(prec=10) Traceback (most recent call last): ... - ValueError: Can only take formal power series for non-zero constant term. + ValueError: Can only take formal power series for nonzero constant term. """ R = self.parent() Rbg = R._bg_power_series_ring c = self.constant_coefficient() if c.is_zero(): - raise ValueError('Can only take formal power series for non-zero constant term.') + raise ValueError('Can only take formal power series for nonzero constant term.') if c.is_one(): log_c = self.base_ring().zero() else: diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py index 399f98bf776..dca776907d9 100644 --- a/src/sage/rings/number_field/S_unit_solver.py +++ b/src/sage/rings/number_field/S_unit_solver.py @@ -88,7 +88,7 @@ def column_Log(SUK, iota, U, prec=106): - ``SUK`` -- a group of `S`-units - ``iota`` -- an element of ``K`` - - ``U`` -- a list of places (finite or infinite) of ``K`` + - ``U`` -- list of places (finite or infinite) of ``K`` - ``prec`` -- the precision of the real field (default: 106) OUTPUT: the log vector as a list of real numbers @@ -143,7 +143,6 @@ def c3_func(SUK, prec=106): REFERENCES: - [AKMRVW]_ :arxiv:`1903.00977` - """ R = RealField(prec) @@ -204,15 +203,18 @@ def c4_func(SUK, v, A, prec=106): def beta_k(betas_and_ns): r""" - Return a pair `[\beta_k,|beta_k|_v]`, where `\beta_k` has the smallest nonzero valuation in absolute value of the list ``betas_and_ns``. + Return a pair `[\beta_k,|beta_k|_v]`, where `\beta_k` has the smallest + nonzero valuation in absolute value of the list ``betas_and_ns``. INPUT: - - ``betas_and_ns`` -- a list of pairs ``[beta,val_v(beta)]`` outputted from the function where ``beta`` is an element of ``SUK.fundamental_units()`` + - ``betas_and_ns`` -- list of pairs ``[beta,val_v(beta)]`` outputted from + the function where ``beta`` is an element of ``SUK.fundamental_units()`` OUTPUT: - The pair ``[beta_k,v(beta_k)]``, where ``beta_k`` is an element of ``K`` and ``val_v(beta_k)`` is a integer + The pair ``[beta_k,v(beta_k)]``, where ``beta_k`` is an element of ``K`` + and ``val_v(beta_k)`` is a integer. EXAMPLES:: @@ -249,7 +251,7 @@ def mus(SUK, v): - ``SUK`` -- a group of `S`-units - ``v`` -- a finite place of ``K`` - OUTPUT: a list ``[mus]`` where each ``mu`` is an element of ``K`` + OUTPUT: list ``[mus]`` where each ``mu`` is an element of ``K`` EXAMPLES:: @@ -265,7 +267,6 @@ def mus(SUK, v): REFERENCES: - [AKMRVW]_ - """ betas = SUK.fundamental_units() beta_and_ns = [[beta,beta.valuation(v)] for beta in betas] @@ -287,7 +288,7 @@ def possible_mu0s(SUK, v): - ``SUK`` -- a group of `S`-units - ``v`` -- a finite place of ``K`` - OUTPUT: a list ``[mu0s]`` where each ``mu0`` is an element of ``K`` + OUTPUT: list ``[mu0s]`` where each ``mu0`` is an element of ``K`` EXAMPLES:: @@ -311,7 +312,6 @@ def possible_mu0s(SUK, v): - [AKMRVW]_ - [Sma1995]_ pp. 824-825, but we modify the definition of ``sigma`` (``sigma_tilde``) to make it easier to code - """ beta_and_ns = [[beta,beta.valuation(v)] for beta in SUK.fundamental_units()] betak, nk = beta_k(beta_and_ns) @@ -466,7 +466,7 @@ def Yu_modified_height(mu, n, v, prec=106): INPUT: - ``mu`` -- an element of a field K - - ``n`` -- number of mu_j to be considered in Yu's Theorem. + - ``n`` -- number of mu_j to be considered in Yu's Theorem - ``v`` -- a place of K - ``prec`` -- the precision of the real field @@ -519,7 +519,8 @@ def Omega_prime(dK, v, mu_list, prec=106): - ``dK`` -- the degree of a number field `K` - ``v`` -- a finite place of `K` - - ``mu_list`` -- a list of nonzero elements of `K`. It is assumed that the sublist ``mu_list[1:]`` is multiplicatively independent. + - ``mu_list`` -- list of nonzero elements of `K`. It is assumed that the + sublist ``mu_list[1:]`` is multiplicatively independent - ``prec`` -- the precision of the real field OUTPUT: the constant `\Omega'` @@ -841,7 +842,8 @@ def K1_func(SUK, v, A, prec=106): - ``SUK`` -- a group of `S`-units - ``v`` -- an infinite place of `K` (element of ``SUK.number_field().places(prec)``) - - ``A`` -- a list of all products of each potential `a`, `b` in the `S`-unit equation `ax + by + 1 = 0` with each root of unity of `K` + - ``A`` -- list of all products of each potential `a`, `b` in the `S`-unit + equation `ax + by + 1 = 0` with each root of unity of `K` - ``prec`` -- the precision of the real field (default: 106) OUTPUT: the constant `K_1`, a real number @@ -865,7 +867,6 @@ def K1_func(SUK, v, A, prec=106): REFERENCES: - [Sma1995]_ p. 825 - """ R = RealField(prec) @@ -969,7 +970,7 @@ def reduction_step_complex_case(place, B0, list_of_gens, torsion_gen, c13): - ``place`` -- (ring morphism) an infinite place of a number field `K` - ``B0`` -- the initial bound - - ``list_of_gens`` -- a set of generators of the free part of the group + - ``list_of_gens`` -- set of generators of the free part of the group - ``torsion_gen`` -- an element of the torsion part of the group - ``c13`` -- a positive real number @@ -1040,7 +1041,7 @@ def reduction_step_complex_case(place, B0, list_of_gens, torsion_gen, c13): A = A.transpose() - # Note that l is the lower bound on the square of the magnitude of the shortest non-zero vector in the lattice generated by A + # Note that l is the lower bound on the square of the magnitude of the shortest nonzero vector in the lattice generated by A l = minimal_vector(A, zero_vector(ZZ,n+1)) # Checking hypotheses of Lemma 5.3 in our paper: @@ -1079,7 +1080,7 @@ def reduction_step_complex_case(place, B0, list_of_gens, torsion_gen, c13): # We apply Lemma 5.3 from [AKMRVW] A = A.transpose() l = minimal_vector(A, zero_vector(ZZ,n+1)) - # Note that l is the a lower bound on the square of the magnitude of the shortest non-zero vector in the lattice generated by A + # Note that l is the a lower bound on the square of the magnitude of the shortest nonzero vector in the lattice generated by A # Checking hypothesis of lemma 5.3 in [AKMRVW] if l <= T**2 + S: C *= 2 @@ -1126,7 +1127,7 @@ def reduction_step_complex_case(place, B0, list_of_gens, torsion_gen, c13): # We apply Lemma 5.2 from [AKMRVW] A = A.transpose() l = minimal_vector(A, zero_vector(ZZ,n+1)) - # Note that l is the a lower bound on the square of the magnitude of the shortest non-zero vector in the lattice generated by A + # Note that l is the a lower bound on the square of the magnitude of the shortest nonzero vector in the lattice generated by A # Checking hypothesis of lemma 5.2 in [AKMRVW] if l <= T**2 + S: C *= 2 @@ -1150,7 +1151,8 @@ def cx_LLL_bound(SUK, A, prec=106): INPUT: - ``SUK`` -- a group of `S`-units - - ``A`` -- a list of all products of each potential `a`, `b` in the `S`-unit equation `ax + by + 1 = 0` with each root of unity of `K` + - ``A`` -- list of all products of each potential `a`, `b` in the `S`-unit + equation `ax + by + 1 = 0` with each root of unity of `K` - ``prec`` -- precision of real field (default: 106) OUTPUT: a bound for the exponents at the infinite place, as a real number @@ -1204,15 +1206,18 @@ def log_p(a, prime, prec): - ``a`` -- an element of a number field `K` - ``prime`` -- a prime ideal of the number field `K` - - ``prec`` -- a positive integer + - ``prec`` -- positive integer OUTPUT: - An element of `K` which is congruent to the ``prime``-adic logarithm of `a` with respect to ``prime`` modulo ``p^prec``, where `p` is the rational prime below ``prime`` + An element of `K` which is congruent to the ``prime``-adic logarithm of `a` + with respect to ``prime`` modulo ``p^prec``, where `p` is the rational + prime below ``prime``. .. NOTE:: - Here we take into account the other primes in `K` above `p` in order to get coefficients with small values + Here we take into account the other primes in `K` above `p` in order to + get coefficients with small values. EXAMPLES:: @@ -1269,15 +1274,16 @@ def log_p_series_part(a, prime, prec): - ``a`` -- an element of a number field `K` - ``prime`` -- a prime ideal of the number field `K` - - ``prec`` -- a positive integer + - ``prec`` -- positive integer OUTPUT: - The ``prime``-adic logarithm of `a` and accuracy ``p^prec``, where `p` is the rational prime below ``prime`` + The ``prime``-adic logarithm of `a` and accuracy ``p^prec``, where `p` is + the rational prime below ``prime``. ALGORITHM: - The algorithm is based on the algorithm on page 30 of [Sma1998]_ + The algorithm is based on the algorithm on page 30 of [Sma1998]_. EXAMPLES:: @@ -1472,11 +1478,12 @@ def p_adic_LLL_bound_one_prime(prime, B0, M, M_logp, m0, c3, prec=106): - ``prime`` -- a prime ideal of a number field `K` - ``B0`` -- the initial bound - - ``M`` -- a list of elements of `K`, the `\mu_i`'s from Lemma IX.3 of [Sma1998]_ + - ``M`` -- list of elements of `K`, the `\mu_i`'s from Lemma IX.3 of [Sma1998]_ - ``M_logp`` -- the p-adic logarithm of elements in `M` - ``m0`` -- an element of `K`, this is `\mu_0` from Lemma IX.3 of [Sma1998]_ - ``c3`` -- a positive real constant - - ``prec`` -- the precision of the calculations (default: 106), i.e., values are known to ``O(p^prec)`` + - ``prec`` -- the precision of the calculations (default: 106), i.e., + values are known to ``O(p^prec)`` OUTPUT: a pair consisting of: @@ -1528,7 +1535,7 @@ def p_adic_LLL_bound_one_prime(prime, B0, M, M_logp, m0, c3, prec=106): False """ if any(g.valuation(prime) != 0 for g in M+[m0]): - raise ValueError('There is an element with non zero valuation') + raise ValueError('There is an element with nonzero valuation') K = prime.ring() w = K.number_of_roots_of_unity() @@ -1617,12 +1624,14 @@ def p_adic_LLL_bound_one_prime(prime, B0, M, M_logp, m0, c3, prec=106): def p_adic_LLL_bound(SUK, A, prec=106): r""" - Return the maximum of all of the `K_0`'s as they are LLL-optimized for each finite place `v`. + Return the maximum of all of the `K_0`'s as they are LLL-optimized for each + finite place `v`. INPUT: - ``SUK`` -- a group of `S`-units - - ``A`` -- a list of all products of each potential `a`, `b` in the `S`-unit equation `ax + by + 1 = 0` with each root of unity of `K` + - ``A`` -- list of all products of each potential `a`, `b` in the `S`-unit + equation `ax + by + 1 = 0` with each root of unity of `K` - ``prec`` -- precision for p-adic LLL calculations (default: 106) OUTPUT: @@ -1677,14 +1686,15 @@ def p_adic_LLL_bound(SUK, A, prec=106): def split_primes_large_lcm(SUK, bound): r""" - Return a list `L` of rational primes `q` which split completely in `K` and which have desirable properties (see NOTE). + Return a list `L` of rational primes `q` which split completely in `K` and + which have desirable properties (see NOTE). INPUT: - - ``SUK`` -- the `S`-unit group of an absolute number field `K`. - - ``bound`` -- a positive integer + - ``SUK`` -- the `S`-unit group of an absolute number field `K` + - ``bound`` -- positive integer - OUTPUT: a list `L` of rational primes `q`, with the following properties: + OUTPUT: list `L` of rational primes `q`, with the following properties: - each prime `q` in `L` splits completely in `K` - if `Q` is a prime in `S` and `q` is the rational @@ -1721,7 +1731,6 @@ def split_primes_large_lcm(SUK, bound): Traceback (most recent call last): ... ValueError: Not enough split primes found. Increase bound. - """ K = SUK.number_field() @@ -1750,9 +1759,10 @@ def sieve_ordering(SUK, q): INPUT: - ``SUK`` -- the `S`-unit group of a number field `K` - - ``q`` -- a rational prime number which splits completely in `K` + - ``q`` -- a rational prime number which splits completely in `K` - OUTPUT: a list of tuples, ``[ideals_over_q, residue_fields, rho_images, product_rho_orders]``, where + OUTPUT: list of tuples; + ``[ideals_over_q, residue_fields, rho_images, product_rho_orders]``, where: 1. ``ideals_over_q`` is a list of the `d = [K:\QQ]` ideals in `K` over `q` 2. ``residue_fields[i]`` is the residue field of ``ideals_over_q[i]`` @@ -1817,9 +1827,10 @@ def clean_rfv_dict(rfv_dictionary): INPUT: - - ``rfv_dictionary`` -- a dictionary whose keys are exponent vectors and whose values are residue field vectors + - ``rfv_dictionary`` -- dictionary whose keys are exponent vectors and + whose values are residue field vectors - OUTPUT: ``None``. But it removes some keys from the input dictionary + OUTPUT: none, but it removes some keys from the input dictionary .. NOTE:: @@ -1851,14 +1862,17 @@ def clean_rfv_dict(rfv_dictionary): def construct_rfv_to_ev(rfv_dictionary, q, d, verbose=False): r""" - Return a reverse lookup dictionary, to find the exponent vectors associated to a given residue field vector. + Return a reverse lookup dictionary, to find the exponent vectors associated + to a given residue field vector. INPUT: - - ``rfv_dictionary`` -- a dictionary whose keys are exponent vectors and whose values are the associated residue field vectors + - ``rfv_dictionary`` -- dictionary whose keys are exponent vectors and + whose values are the associated residue field vectors - ``q`` -- a prime (assumed to split completely in the relevant number field) - ``d`` -- the number of primes in `K` above the rational prime `q` - - ``verbose`` -- a boolean flag to indicate more detailed output is desired (default: ``False``) + - ``verbose`` -- boolean (default: ``False``); flag to indicate more + detailed output is desired OUTPUT: @@ -1986,14 +2000,17 @@ def construct_rfv_to_ev(rfv_dictionary, q, d, verbose=False): def construct_comp_exp_vec(rfv_to_ev_dict, q): r""" - Constructs a dictionary associating complement vectors to residue field vectors. + Construct a dictionary associating complement vectors to residue field vectors. INPUT: - - ``rfv_to_ev_dict`` -- a dictionary whose keys are residue field vectors and whose values are lists of exponent vectors with the associated residue field vector. + - ``rfv_to_ev_dict`` -- dictionary whose keys are residue field vectors and + whose values are lists of exponent vectors with the associated residue + field vector - ``q`` -- the characteristic of the residue field - OUTPUT: a dictionary whose typical key is an exponent vector ``a``, and whose associated value is a list of complementary exponent vectors to ``a`` + OUTPUT: a dictionary whose typical key is an exponent vector ``a``, and + whose associated value is a list of complementary exponent vectors to ``a`` EXAMPLES: @@ -2060,11 +2077,12 @@ def drop_vector(ev, p, q, complement_ev_dict): - ``ev`` -- an exponent vector modulo `p-1` - ``p`` -- the prime such that ``ev`` is an exponent vector modulo `p-1` - ``q`` -- a prime, distinct from `p`, that is a key in the ``complement_ev_dict`` - - ``complement_ev_dict`` -- a dictionary of dictionaries, whose keys are primes. + - ``complement_ev_dict`` -- dictionary of dictionaries, whose keys are primes ``complement_ev_dict[q]`` is a dictionary whose keys are exponent vectors modulo `q-1` and whose values are lists of complementary exponent vectors modulo `q-1` - OUTPUT: returns ``True`` if ``ev`` may be dropped from the complement exponent vector dictionary, and ``False`` if not + OUTPUT: ``True`` if ``ev`` may be dropped from the complement exponent + vector dictionary, and ``False`` if not .. NOTE:: @@ -2121,15 +2139,17 @@ def construct_complement_dictionaries(split_primes_list, SUK, verbose=False): INPUT: - - ``split_primes_list`` -- a list of rational primes which split completely in the number field `K` + - ``split_primes_list`` -- list of rational primes which split completely + in the number field `K` - ``SUK`` -- the `S`-unit group for a number field `K` - - ``verbose`` -- a boolean to provide additional feedback (default: ``False``) + - ``verbose`` -- boolean to provide additional feedback (default: ``False``) OUTPUT: - A dictionary of dictionaries. The keys coincide with the primes in ``split_primes_list`` - For each `q`, ``comp_exp_vec[q]`` is a dictionary whose keys are exponent vectors modulo `q-1`, - and whose values are lists of exponent vectors modulo `q-1` + A dictionary of dictionaries. The keys coincide with the primes in + ``split_primes_list``. For each `q`, ``comp_exp_vec[q]`` is a dictionary + whose keys are exponent vectors modulo `q-1`, and whose values are lists of + exponent vectors modulo `q-1`. If `w` is an exponent vector in ``comp_exp_vec[q][v]``, then the residue field vectors modulo `q` for `v` and `w` sum to ``[1,1,...,1]`` @@ -2379,16 +2399,17 @@ def compatible_vectors(a, m0, m1, g): INPUT: - - ``a`` -- an exponent vector for the modulus ``m0`` - - ``m0`` -- a positive integer (specifying the modulus for ``a``) - - ``m1`` -- a positive integer (specifying the alternate modulus) + - ``a`` -- an exponent vector for the modulus ``m0`` + - ``m0`` -- positive integer (specifying the modulus for ``a``) + - ``m1`` -- positive integer (specifying the alternate modulus) - ``g`` -- the gcd of ``m0`` and ``m1`` - OUTPUT: a list of exponent vectors modulo ``m1`` which are compatible with ``a`` + OUTPUT: list of exponent vectors modulo ``m1`` which are compatible with ``a`` .. NOTE:: - - Exponent vectors must agree exactly in the 0th position in order to be compatible. + Exponent vectors must agree exactly in the 0th position in order to be + compatible. EXAMPLES:: @@ -2418,14 +2439,16 @@ def compatible_vectors(a, m0, m1, g): def compatible_systems(split_prime_list, complement_exp_vec_dict): r""" - Given dictionaries of complement exponent vectors for various primes that split in `K`, compute all possible compatible systems. + Given dictionaries of complement exponent vectors for various primes that + split in `K`, compute all possible compatible systems. INPUT: - - ``split_prime_list`` -- a list of rational primes that split completely in `K` - - ``complement_exp_vec_dict`` -- a dictionary of dictionaries. The keys are primes from ``split_prime_list``. + - ``split_prime_list`` -- list of rational primes that split completely in `K` + - ``complement_exp_vec_dict`` -- dictionary of dictionaries; the keys are + primes from ``split_prime_list`` - OUTPUT: a list of compatible systems of exponent vectors + OUTPUT: list of compatible systems of exponent vectors .. NOTE:: @@ -2482,13 +2505,15 @@ def compatible_systems(split_prime_list, complement_exp_vec_dict): def compatible_system_lift(compatible_system, split_primes_list): r""" - Given a compatible system of exponent vectors and complementary exponent vectors, return a lift to the integers. + Given a compatible system of exponent vectors and complementary exponent + vectors, return a lift to the integers. INPUT: - - ``compatible_system`` -- a list of pairs ``[ [v0, w0], [v1, w1], .., [vk, wk] ]`` - where [vi, wi] is a pair of complementary exponent vectors modulo ``qi - 1``, and all pairs are compatible. - - ``split_primes_list`` -- a list of primes ``[ q0, q1, .., qk ]`` + - ``compatible_system`` -- list of pairs ``[ [v0, w0], [v1, w1], .., [vk, wk] ]`` + where [vi, wi] is a pair of complementary exponent vectors modulo ``qi - 1``, + and all pairs are compatible + - ``split_primes_list`` -- list of primes ``[ q0, q1, .., qk ]`` OUTPUT: a pair of vectors ``[v, w]`` satisfying: @@ -2541,15 +2566,17 @@ def compatible_system_lift(compatible_system, split_primes_list): def solutions_from_systems(SUK, bound, cs_list, split_primes_list): r""" - Lift compatible systems to the integers and return the `S`-unit equation solutions that the lifts yield. + Lift compatible systems to the integers and return the `S`-unit equation + solutions that the lifts yield. INPUT: - ``SUK`` -- the group of `S`-units where we search for solutions - ``bound`` -- a bound for the entries of all entries of all lifts - - ``cs_list`` -- a list of compatible systems of exponent vectors modulo `q-1` for - various primes `q` - - ``split_primes_list`` -- a list of primes giving the moduli of the exponent vectors in ``cs_list`` + - ``cs_list`` -- list of compatible systems of exponent vectors modulo + `q-1` for various primes `q` + - ``split_primes_list`` -- list of primes giving the moduli of the exponent + vectors in ``cs_list`` OUTPUT: @@ -2602,11 +2629,9 @@ def clean_sfs(sfs_list): INPUT: - - ``sfs_list`` -- a list of solutions to the `S`-unit equation - - OUTPUT: + - ``sfs_list`` -- list of solutions to the `S`-unit equation - A list of solutions to the `S`-unit equation + OUTPUT: list of solutions to the `S`-unit equation .. NOTE:: @@ -2634,17 +2659,23 @@ def clean_sfs(sfs_list): def sieve_below_bound(K, S, bound=10, bump=10, split_primes_list=[], verbose=False): r""" - Return all solutions to the `S`-unit equation `x + y = 1` over `K` with exponents below the given bound. + Return all solutions to the `S`-unit equation `x + y = 1` over `K` with + exponents below the given bound. INPUT: - ``K`` -- a number field (an absolute extension of the rationals) - - ``S`` -- a list of finite primes of `K` - - ``bound`` -- a positive integer upper bound for exponents, solutions with exponents having absolute value below this bound will be found (default: 10) - - ``bump`` -- a positive integer by which the minimum LCM will be increased if not enough split primes are found in sieving step (default: 10) - - ``split_primes_list`` -- a list of rational primes that split completely in the extension `K/\QQ`, used for sieving. - For complete list of solutions should have lcm of `\{(p_i-1)\} for primes `p_i` greater than bound (default: ``[]``) - - ``verbose`` -- an optional parameter allowing the user to print information during the sieving process (default: ``False``) + - ``S`` -- list of finite primes of `K` + - ``bound`` -- positive integer upper bound for exponents, solutions with + exponents having absolute value below this bound will be found (default: 10) + - ``bump`` -- positive integer by which the minimum LCM will be increased + if not enough split primes are found in sieving step (default: 10) + - ``split_primes_list`` -- list of rational primes that split completely in + the extension `K/\QQ`, used for sieving. For complete list of solutions + should have lcm of `\{(p_i-1)\} for primes `p_i` greater than bound + (default: ``[]``). + - ``verbose`` -- an optional parameter allowing the user to print + information during the sieving process (default: ``False``) OUTPUT: @@ -2701,11 +2732,15 @@ def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound= INPUT: - ``K`` -- a number field (an absolute extension of the rationals) - - ``S`` -- a list of finite primes of `K` - - ``prec`` -- precision used for computations in real, complex, and p-adic fields (default: 106) - - ``include_exponents`` -- whether to include the exponent vectors in the returned value (default: ``True``). - - ``include_bound`` -- whether to return the final computed bound (default: ``False``) - - ``verbose`` -- whether to print information during the sieving step (default: ``False``) + - ``S`` -- list of finite primes of `K` + - ``prec`` -- precision used for computations in real, complex, and p-adic + fields (default: 106) + - ``include_exponents`` -- whether to include the exponent vectors in the + returned value (default: ``True``) + - ``include_bound`` -- whether to return the final computed bound + (default: ``False``) + - ``verbose`` -- whether to print information during the sieving step + (default: ``False``) OUTPUT: diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py index 5dcdb941c6c..45f08aa4711 100644 --- a/src/sage/rings/number_field/bdd_height.py +++ b/src/sage/rings/number_field/bdd_height.py @@ -50,13 +50,11 @@ def bdd_norm_pr_gens_iq(K, norm_list): INPUT: - - `K` -- an imaginary quadratic number field + - ``K`` -- an imaginary quadratic number field - - ``norm_list`` -- a list of positive integers + - ``norm_list`` -- list of positive integers - OUTPUT: - - - a dictionary of number field elements, keyed by norm + OUTPUT: dictionary of number field elements, keyed by norm EXAMPLES: @@ -114,13 +112,11 @@ def bdd_height_iq(K, height_bound): INPUT: - - `K` -- an imaginary quadratic number field + - ``K`` -- an imaginary quadratic number field - ``height_bound`` -- a real number - OUTPUT: - - - an iterator of number field elements + OUTPUT: an iterator of number field elements EXAMPLES:: @@ -219,13 +215,11 @@ def bdd_norm_pr_ideal_gens(K, norm_list): INPUT: - - `K` -- a number field + - ``K`` -- a number field - - ``norm_list`` -- a list of positive integers + - ``norm_list`` -- list of positive integers - OUTPUT: - - - a dictionary of number field elements, keyed by norm + OUTPUT: dictionary of number field elements, keyed by norm EXAMPLES: @@ -253,7 +247,6 @@ def bdd_norm_pr_ideal_gens(K, norm_list): sage: key = ZZ(28) sage: b[key] [157*g^4 - 139*g^3 - 369*g^2 + 848*g + 158, g^4 + g^3 - g - 7] - """ negative_norm_units = K.elements_of_norm(-1) gens = {} @@ -285,9 +278,7 @@ def integer_points_in_polytope(matrix, interval_radius): - ``interval_radius`` -- a real number - OUTPUT: - - - a list of tuples of integers + OUTPUT: list of tuples of integers EXAMPLES: diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py index 17aa61993b8..34a48931f8e 100644 --- a/src/sage/rings/number_field/class_group.py +++ b/src/sage/rings/number_field/class_group.py @@ -261,7 +261,8 @@ def representative_prime(self, norm_bound=1000): INPUT: - - ``norm_bound`` -- (positive integer) upper bound on the norm of primes tested. + - ``norm_bound`` -- (positive integer) upper bound on the norm of + primes tested EXAMPLES:: diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py index 364abc0f706..6ea1068ab2f 100644 --- a/src/sage/rings/number_field/galois_group.py +++ b/src/sage/rings/number_field/galois_group.py @@ -277,7 +277,7 @@ def __init__(self, number_field, algorithm='pari', names=None, gc_numbering=None You can specify the variable name for the Galois closure:: sage: x = polygen(ZZ, 'x') - sage: G = NumberField(x^3 - 2, 'b').galois_group(names="c"); G + sage: G = NumberField(x^3 - 2, 'b').galois_group(names='c'); G Galois group 3T2 (S3) with order 6 of x^3 - 2 sage: G._galois_closure Number Field in c with defining polynomial x^6 + 108 @@ -324,7 +324,7 @@ def _pol_galgp(self, algorithm=None): sage: G = K.galois_group() sage: G._pol_galgp() PARI group [6, -1, 2, "S3"] of degree 3 - sage: G._pol_galgp(algorithm="gap") # optional - gap_packages + sage: G._pol_galgp(algorithm='gap') # optional - gap_packages Transitive group number 2 of degree 3 """ algorithm = self._get_algorithm(algorithm) @@ -342,7 +342,7 @@ def group(self): sage: R. = ZZ[] sage: x = polygen(ZZ, 'x') sage: K. = NumberField(x^3 + 2*x + 2) - sage: G = K.galois_group(type="pari") + sage: G = K.galois_group(type='pari') ...DeprecationWarning: the different Galois types have been merged into one class See https://github.com/sagemath/sage/issues/28782 for details. sage: G.group() @@ -357,7 +357,7 @@ def group(self): @cached_method(key=_alg_key) def order(self, algorithm=None, recompute=False): """ - Return the order of this Galois group + Return the order of this Galois group. EXAMPLES:: @@ -423,7 +423,7 @@ def transitive_number(self, algorithm=None, recompute=False): 2 sage: x = polygen(ZZ, 'x') sage: L. = NumberField(x^13 + 2*x + 2) - sage: H = L.galois_group(algorithm="gap") + sage: H = L.galois_group(algorithm='gap') sage: H.transitive_number() # optional - gap_packages 9 """ @@ -484,7 +484,7 @@ def signature(self): @lazy_attribute def _gcdata(self): """ - Return the Galois closure, together with the embedding of the top field into it + Return the Galois closure, together with the embedding of the top field into it. EXAMPLES:: @@ -693,7 +693,7 @@ def is_galois(self): def _repr_(self): r""" - String representation of this Galois group + String representation of this Galois group. EXAMPLES:: @@ -1028,24 +1028,27 @@ def artin_symbol(self, P): class GaloisGroup_subgroup(GaloisSubgroup_perm): r""" - A subgroup of a Galois group, as returned by functions such as ``decomposition_group``. + A subgroup of a Galois group, as returned by functions such as + ``decomposition_group``. INPUT: - ``ambient`` -- the ambient Galois group - - ``gens`` -- a list of generators for the group + - ``gens`` -- list of generators for the group - ``gap_group`` -- a gap or libgap permutation group, or a string defining one (default: ``None``) - - ``domain`` -- a set on which this permutation group acts; extracted from ``ambient`` if not specified + - ``domain`` -- set on which this permutation group acts; extracted from + ``ambient`` if not specified - ``category`` -- the category for this object - ``canonicalize`` -- if ``True``, sorts and removes duplicates - - ``check`` -- whether to check that generators actually lie in the ambient group + - ``check`` -- whether to check that generators actually lie in the + ambient group EXAMPLES:: @@ -1106,7 +1109,7 @@ def fixed_field(self, name=None, polred=None, threshold=None): INPUT: - - ``name`` -- a variable name for the new field. + - ``name`` -- a variable name for the new field - ``polred`` -- whether to optimize the generator of the newly created field for a simpler polynomial, using PARI's :pari:`polredbest`. @@ -1254,8 +1257,8 @@ def as_hom(self): def __call__(self, x): r""" - Return the action of self on an element x in the number field of self - (or its Galois closure). + Return the action of ``self`` on an element x in the number field of + ``self`` (or its Galois closure). EXAMPLES:: diff --git a/src/sage/rings/number_field/morphism.py b/src/sage/rings/number_field/morphism.py index a16ccd2bbc6..579c925ed01 100644 --- a/src/sage/rings/number_field/morphism.py +++ b/src/sage/rings/number_field/morphism.py @@ -26,7 +26,7 @@ class NumberFieldHomomorphism_im_gens(RingHomomorphism_im_gens): def __invert__(self): r""" - Return the inverse of an isomorphism of absolute number fields + Return the inverse of an isomorphism of absolute number fields. EXAMPLES:: @@ -88,16 +88,16 @@ def __invert__(self): def preimage(self, y): r""" Compute a preimage of `y` in the domain, provided one exists. - Raises a :class:`ValueError` if `y` has no preimage. + Raises a :exc:`ValueError` if `y` has no preimage. INPUT: - - ``y`` -- an element of the codomain of ``self``. + - ``y`` -- an element of the codomain of ``self`` OUTPUT: Returns the preimage of `y` in the domain, if one exists. - Raises a :class:`ValueError` if `y` has no preimage. + Raises a :exc:`ValueError` if `y` has no preimage. EXAMPLES:: @@ -221,7 +221,7 @@ def im_gens(self): def _richcmp_(self, other, op): """ - Compare + Compare. EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py index 347752e7e93..450d3189d06 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py @@ -234,19 +234,19 @@ def NumberField(polynomial, name=None, check=True, names=None, embedding=None, INPUT: - ``polynomial`` -- a polynomial over `\QQ` or a number field, or a list - of such polynomials. + of such polynomials - ``names`` (or ``name``) -- a string or a list of strings, the names of the generators - - ``check`` -- a boolean (default: ``True``); do type checking and - irreducibility checking. + - ``check`` -- boolean (default: ``True``); do type checking and + irreducibility checking - ``embedding`` -- ``None``, an element, or a list of elements, the images of the generators in an ambient field (default: ``None``) - ``latex_names`` (or ``latex_name``) -- ``None``, a string, or a - list of strings (default: ``None``), how the generators are printed + list of strings (default: ``None``); how the generators are printed for latex output - - ``assume_disc_small`` -- a boolean (default: ``False``); if ``True``, + - ``assume_disc_small`` -- boolean (default: ``False``); if ``True``, assume that no square of a prime greater than PARI's primelimit - (which should be 500000); only applies for absolute fields at + (which should be 500000). Only applies for absolute fields at present. - ``maximize_at_primes`` -- ``None`` or a list of primes (default: ``None``); if not ``None``, then the maximal order is computed by @@ -565,17 +565,17 @@ class NumberFieldFactory(UniqueFactory): INPUT: - - ``polynomial`` -- a polynomial over `\QQ` or a number field. - - ``name`` -- a string (default: ``'a'``), the name of the generator - - ``check`` -- a boolean (default: ``True``); do type checking and - irreducibility checking. + - ``polynomial`` -- a polynomial over `\QQ` or a number field + - ``name`` -- string (default: ``'a'``); the name of the generator + - ``check`` -- boolean (default: ``True``); do type checking and + irreducibility checking - ``embedding`` -- ``None`` or an element, the images of the generator in an ambient field (default: ``None``) - - ``latex_name`` -- ``None`` or a string (default: ``None``), how the + - ``latex_name`` -- ``None`` or string (default: ``None``); how the generator is printed for latex output - - ``assume_disc_small`` -- a boolean (default: ``False``); if ``True``, + - ``assume_disc_small`` -- boolean (default: ``False``); if ``True``, assume that no square of a prime greater than PARI's primelimit - (which should be 500000); only applies for absolute fields at + (which should be 500000). Only applies for absolute fields at present. - ``maximize_at_primes`` -- ``None`` or a list of primes (default: ``None``); if not ``None``, then the maximal order is computed by @@ -608,7 +608,6 @@ class NumberFieldFactory(UniqueFactory): Isomorphism given by variable name change map: From: Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? To: Number Field in b with defining polynomial x^2 - 2) - """ def create_key_and_extra_args(self, polynomial, name, check, embedding, latex_name, assume_disc_small, maximize_at_primes, structure): r""" @@ -623,7 +622,6 @@ def create_key_and_extra_args(self, polynomial, name, check, embedding, latex_na ....: latex_name=None, assume_disc_small=False, maximize_at_primes=None, structure=None) ((Rational Field, x^2 + 1, ('a',), None, 'a', None, False, None), {'check': False}) - """ if name is None: raise TypeError("You must specify the name of the generator.") @@ -678,7 +676,6 @@ def create_object(self, version, key, check): sage: R. = QQ[] sage: nff.create_object(None, (QQ, x^2 + 1, ('a',), None, None, None, False, None), check=False) Number Field in a with defining polynomial x^2 + 1 - """ base, polynomial, name, embedding, latex_name, maximize_at_primes, assume_disc_small, structure = key @@ -704,21 +701,21 @@ def NumberFieldTower(polynomials, names, check=True, embeddings=None, latex_name INPUT: - - ``polynomials`` -- a list of polynomials. Each entry must be polynomial + - ``polynomials`` -- list of polynomials. Each entry must be polynomial which is irreducible over the number field generated by the roots of the following entries. - - ``names`` -- a list of strings or a string, the names of the generators of + - ``names`` -- list of strings or a string, the names of the generators of the relative number fields. If a single string, then names are generated from that string. - - ``check`` -- a boolean (default: ``True``), whether to check that the + - ``check`` -- boolean (default: ``True``); whether to check that the polynomials are irreducible - - ``embeddings`` -- a list of elements or ``None`` (default: ``None``), - embeddings of the relative number fields in an ambient field. - - ``latex_names`` -- a list of strings or ``None`` (default: ``None``), names - used to print the generators for latex output. - - ``assume_disc_small`` -- a boolean (default: ``False``); if ``True``, + - ``embeddings`` -- list of elements or ``None`` (default: ``None``); + embeddings of the relative number fields in an ambient field + - ``latex_names`` -- list of strings or ``None`` (default: ``None``); names + used to print the generators for latex output + - ``assume_disc_small`` -- boolean (default: ``False``); if ``True``, assume that no square of a prime greater than PARI's ``primelimit`` - (which should be 500000); only applies for absolute fields at + (which should be 500000). Only applies for absolute fields at present. - ``maximize_at_primes`` -- ``None`` or a list of primes (default: ``None``); if not ``None``, then the maximal order is computed by @@ -868,14 +865,13 @@ def QuadraticField(D, name='a', check=True, embedding=True, latex_name='sqrt', * - ``name`` -- variable name (default: ``'a'``) - - ``check`` -- bool (default: ``True``) + - ``check`` -- boolean (default: ``True``) - - ``embedding`` -- bool or square root of `D` in an - ambient field (default: ``True``) + - ``embedding`` -- boolean or square root of `D` in an ambient field + (default: ``True``) - ``latex_name`` -- latex variable name (default: `\sqrt{D}`) - OUTPUT: a number field defined by a quadratic polynomial. Unless otherwise specified, it has an embedding into `\RR` or `\CC` by sending the generator to the positive @@ -1041,23 +1037,24 @@ def is_AbsoluteNumberField(x): class CyclotomicFieldFactory(UniqueFactory): r""" - Return the `n`-th cyclotomic field, where n is a positive integer, - or the universal cyclotomic field if ``n==0``. + Return the `n`-th cyclotomic field, where `n` is a positive integer, + or the universal cyclotomic field if `n=0`. For the documentation of the universal cyclotomic field, see :class:`~sage.rings.universal_cyclotomic_field.UniversalCyclotomicField`. INPUT: - - ``n`` -- a nonnegative integer, default: ``0`` + - ``n`` -- nonnegative integer (default: `0`) - - ``names`` -- name of generator (default: ``zetan``) + - ``names`` -- name of generator (default: ``zetan``) - - ``bracket`` -- Defines the brackets in the case of ``n==0``, and - is ignored otherwise. Can be any even length string, with ``"()"`` being the default. + - ``bracket`` -- defines the brackets in the case of ``n==0``, and + is ignored otherwise. Can be any even length string, with ``'()'`` being + the default. - - ``embedding`` -- bool or `n`-th root of unity in an - ambient field (default: ``True``) + - ``embedding`` -- boolean or `n`-th root of unity in an ambient field + (default: ``True``) EXAMPLES: @@ -1078,7 +1075,7 @@ class CyclotomicFieldFactory(UniqueFactory): zeta7 The default embedding sends the generator to the complex primitive - `n^{th}` root of unity of least argument. + `n`-th root of unity of least argument. :: @@ -1318,7 +1315,6 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): ....: for f in D: ....: elt = f.q_eigenform(10, 'alpha')[3] ....: assert elt.is_integral() - """ def __init__(self, polynomial, name, latex_name, check=True, embedding=None, category=None, @@ -1442,7 +1438,6 @@ def _convert_map_from_(self, other): 1/6*b^3 + 1/6*b sage: L(b) i - a - """ from sage.categories.map import Map if self._structure is not None: @@ -1576,7 +1571,6 @@ def construction(self): sage: F, R = K.construction() sage: F(R) == K True - """ from sage.categories.pushout import AlgebraicExtensionFunctor from sage.rings.rational_field import QQ @@ -2102,18 +2096,17 @@ def random_element(self, num_bound=None, den_bound=None, INPUT: - - ``num_bound`` -- Bound on numerator of the coefficients of + - ``num_bound`` -- bound on numerator of the coefficients of the resulting element - - ``den_bound`` -- Bound on denominators of the coefficients + - ``den_bound`` -- bound on denominators of the coefficients of the resulting element - - ``integral_coefficients`` -- (default: ``False``) If ``True``, then - the resulting element will have integral - coefficients. This option overrides any - value of ``den_bound``. + - ``integral_coefficients`` -- boolean (default: ``False``); if + ``True``, then the resulting element will have integral coefficients. + This option overrides any value of ``den_bound``. - - ``distribution`` -- Distribution to use for the coefficients + - ``distribution`` -- distribution to use for the coefficients of the resulting element OUTPUT: element of this number field @@ -2182,14 +2175,14 @@ def subfield(self, alpha, name=None, names=None): INPUT: - - ``alpha`` -- an element of ``self``, or something that - coerces to an element of ``self``. + - ``alpha`` -- an element of ``self``, or something that + coerces to an element of ``self`` OUTPUT: - ``K`` -- a number field - ``from_K`` -- a homomorphism from `K` to ``self`` that - sends the generator of `K` to ``alpha``. + sends the generator of `K` to ``alpha`` EXAMPLES:: @@ -2358,17 +2351,17 @@ def subfield_from_elements(self, alpha, name=None, polred=True, threshold=None): - ``name`` -- a name for the generator of the new number field - - ``polred`` -- (boolean, default ``True``); whether to optimize the generator of - the newly created field + - ``polred`` -- boolean (default: ``True``); whether to optimize the + generator of the newly created field - - ``threshold`` -- (positive number, default ``None``) threshold to be passed to - the ``do_polred`` function + - ``threshold`` -- positive number (default: ``None``) threshold to be + passed to the ``do_polred`` function OUTPUT: a triple ``(field, beta, hom)`` where - ``field`` -- a subfield of this number field - - ``beta`` -- a list of elements of ``field`` corresponding to ``alpha`` + - ``beta`` -- list of elements of ``field`` corresponding to ``alpha`` - ``hom`` -- inclusion homomorphism from ``field`` to ``self`` @@ -2551,11 +2544,11 @@ def quadratic_defect(self, a, p, check=True): - ``p`` -- a prime ideal - - ``check`` -- (default: ``True``); check if `p` is prime + - ``check`` -- boolean (default: ``True``); check if `p` is prime ALGORITHM: - This is an implementation of Algorithm 3.1.3 from [Kir2016]_ + This is an implementation of Algorithm 3.1.3 from [Kir2016]_. EXAMPLES:: @@ -2684,7 +2677,6 @@ def is_isomorphic(self, other, isomorphism_maps=False) -> bool: sage: k. = NumberField(x) sage: k.is_isomorphic(k) True - """ if not isinstance(other, NumberField_generic): raise ValueError("other must be a generic number field.") @@ -2870,7 +2862,7 @@ def complex_conjugation(self): This is only well-defined for fields contained in CM fields (i.e. for totally real fields and CM fields). Recall that a CM field is a totally imaginary quadratic extension of a totally - real field. For other fields, a :class:`ValueError` is raised. + real field. For other fields, a :exc:`ValueError` is raised. EXAMPLES:: @@ -3039,7 +3031,6 @@ def maximal_totally_real_subfield(self): polynomial x^4 - 2*x^3 + x^2 + 6*x + 3 To: Number Field in z with defining polynomial x^2 - 1/2*a over its base field] - """ try: @@ -3179,7 +3170,6 @@ def real_embeddings(self, prec=53): 0 sage: len(K.embeddings(AA)) 0 - """ K = sage.rings.real_mpfr.RealField(prec) return self.embeddings(K) @@ -3306,13 +3296,13 @@ def algebraic_closure(self): @cached_method def conductor(self, check_abelian=True): r""" - Computes the conductor of the abelian field `K`. + Compute the conductor of the abelian field `K`. If ``check_abelian`` is set to ``False`` and the field is not an abelian extension of `\QQ`, the output is not meaningful. INPUT: - - ``check_abelian`` -- a boolean (default: ``True``); check to see + - ``check_abelian`` -- boolean (default: ``True``); check to see that this is an abelian extension of `\QQ` OUTPUT: integer which is the conductor of the field @@ -3386,7 +3376,7 @@ def dirichlet_group(self): The output is random if the field is not abelian. - OUTPUT: a list of Dirichlet characters + OUTPUT: list of Dirichlet characters EXAMPLES:: @@ -3446,7 +3436,6 @@ def _repr_(self): sage: k. = NumberField(x^13 - (2/3)*x + 3, embedding=-1) sage: k._repr_() 'Number Field in a with defining polynomial x^13 - 2/3*x + 3 with a = -1.106745229567614?' - """ result = "Number Field in {} with defining polynomial {}".format(self.variable_name(), self.polynomial()) gen = self.gen_embedding() @@ -3551,9 +3540,9 @@ def idealchinese(self, ideals, residues): INPUT: - - ``ideals`` -- a list of ideals of the number field. + - ``ideals`` -- list of ideals of the number field - - ``residues`` -- a list of elements of the number field. + - ``residues`` -- list of elements of the number field OUTPUT: @@ -3613,10 +3602,7 @@ def fractional_ideal(self, *gens, **kwds): INPUT: - - - ``gens`` -- a list of generators, or a number field - ideal. - + - ``gens`` -- list of generators, or a number field ideal EXAMPLES:: @@ -3665,7 +3651,7 @@ def ideals_of_bdd_norm(self, bound): INPUT: - - ``bound`` -- a positive integer + - ``bound`` -- positive integer OUTPUT: a dict of all integral ideals `I` such that Norm(`I`) `\leq` ``bound``, keyed by norm. @@ -3721,15 +3707,15 @@ def primes_above(self, x, degree=None): INPUT: - - ``x`` -- usually an element or ideal of ``self``. It - should be such that ``self.ideal(x)`` is sensible. This excludes `x=0`. + - ``x`` -- usually an element or ideal of ``self``. It should be such + that ``self.ideal(x)`` is sensible. This excludes `x=0`. - - ``degree`` -- (default: ``None``) ``None`` or an integer. - If ``None``, find all primes above `x` of any degree. If an - integer, find all primes above `x` such that the resulting - residue field has exactly this degree. + - ``degree`` -- (default: ``None``) ``None`` or an integer. + If ``None``, find all primes above `x` of any degree. If an + integer, find all primes above `x` such that the resulting + residue field has exactly this degree. - OUTPUT: a list of prime ideals of ``self`` lying over `x`. If ``degree`` + OUTPUT: list of prime ideals of ``self`` lying over `x`. If ``degree`` is specified and no such ideal exists, returns the empty list. The output is sorted by residue degree first, then by underlying prime (or equivalently, by norm). @@ -3824,16 +3810,16 @@ def prime_above(self, x, degree=None): INPUT: - - ``x`` -- usually an element or ideal of ``self``. It - should be such that ``self.ideal(x)`` is sensible. This excludes `x=0`. + - ``x`` -- usually an element or ideal of ``self``. It should be such + that ``self.ideal(x)`` is sensible. This excludes `x=0`. - - ``degree`` -- (default: ``None``) ``None`` or an integer. - If one, find a prime above `x` of any degree. If an integer, find a - prime above `x` such that the resulting residue field has exactly - this degree. + - ``degree`` -- (default: ``None``) ``None`` or an integer. + If one, find a prime above `x` of any degree. If an integer, find a + prime above `x` such that the resulting residue field has exactly + this degree. OUTPUT: a prime ideal of ``self`` lying over `x`. If ``degree`` is specified - and no such ideal exists, raises a :class:`ValueError`. + and no such ideal exists, raises a :exc:`ValueError`. EXAMPLES:: @@ -3902,7 +3888,6 @@ def prime_above(self, x, degree=None): Traceback (most recent call last): ... AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors'... - """ ids = self.primes_above(x, degree) if not ids: @@ -3915,8 +3900,8 @@ def primes_of_bounded_norm(self, B): INPUT: - - ``B`` -- a positive integer or real; upper bound on the norms of the - primes generated. + - ``B`` -- positive integer or real; upper bound on the norms of the + primes generated OUTPUT: @@ -3967,9 +3952,9 @@ def primes_of_bounded_norm(self, B): from sage.rings.fast_arith import prime_range if self is QQ: - return prime_range(B + 1, algorithm="pari_isprime") + return prime_range(B + 1, algorithm='pari_isprime') else: - P = (pp for p in prime_range(B + 1, algorithm="pari_isprime") + P = (pp for p in prime_range(B + 1, algorithm='pari_isprime') for pp in self.primes_above(p)) P = [p for p in P if p.norm() <= B] P.sort(key=lambda P: (P.norm(), P)) @@ -3981,8 +3966,8 @@ def primes_of_bounded_norm_iter(self, B): INPUT: - - ``B`` -- a positive integer or real; upper bound on the norms of the - primes generated. + - ``B`` -- positive integer or real; upper bound on the norms of the + primes generated OUTPUT: @@ -4019,10 +4004,10 @@ def primes_of_bounded_norm_iter(self, B): from sage.rings.fast_arith import prime_range if self is QQ: - for p in prime_range(B + 1, algorithm="pari_isprime"): + for p in prime_range(B + 1, algorithm='pari_isprime'): yield p else: - for p in prime_range(B + 1, algorithm="pari_isprime"): + for p in prime_range(B + 1, algorithm='pari_isprime'): for pp in self.primes_above(p): if pp.norm() <= B: yield pp @@ -4086,15 +4071,13 @@ def primes_of_degree_one_list(self, n, num_integer_primes=10000, max_iterations= INPUT: - - ``num_integer_primes`` -- (default: 10000) an - integer. We try to find primes of absolute norm no greater than the - ``num_integer_primes``-th prime number. For example, if - ``num_integer_primes`` is 2, the largest norm found will be 3, since - the second prime is 3. + - ``num_integer_primes`` -- integer (default: 10000). We try to find + primes of absolute norm no greater than the ``num_integer_primes``-th + prime number. For example, if ``num_integer_primes`` is 2, the + largest norm found will be 3, since the second prime is 3. - - ``max_iterations`` -- (default: 100) an integer. We - test ``max_iterations`` integers to find small primes before raising - :class:`StopIteration`. + - ``max_iterations`` -- integer (default: 100). We test ``max_iterations`` + integers to find small primes before raising :class:`StopIteration`. EXAMPLES:: @@ -4118,9 +4101,9 @@ def completely_split_primes(self, B=200): INPUT: - - ``B`` -- a positive integer bound (default: 200) + - ``B`` -- positive integer bound (default: 200) - OUTPUT: a list of all primes `p < B` which split completely in ``K`` + OUTPUT: list of all primes `p < B` which split completely in ``K`` EXAMPLES:: @@ -4299,8 +4282,8 @@ def pari_nf(self, important=True): INPUT: - - ``important`` -- boolean (default: ``True``). If ``False``, - raise a :class:`RuntimeError` if we need to do a difficult + - ``important`` -- boolean (default: ``True``); If ``False``, + raise a :exc:`RuntimeError` if we need to do a difficult discriminant factorization. This is useful when an integral basis is not strictly required, such as for factoring polynomials over this number field. @@ -4421,12 +4404,11 @@ def pari_bnf(self, proof=None, units=True): INPUT: - - ``proof`` -- If ``False``, assume GRH. If ``True``, run PARI's - :pari:`bnfcertify` to make sure that the results are correct. + - ``proof`` -- if ``False``, assume GRH; if ``True``, run PARI's + :pari:`bnfcertify` to make sure that the results are correct - - ``units`` -- (default: ``True) If ``True``, insist on having - fundamental units. If ``False``, the units may or may not be - computed. + - ``units`` -- (default: ``True) if ``True``, insist on having + fundamental units; if ``False``, the units may or may not be computed OUTPUT: the PARI ``bnf`` structure of this number field @@ -4557,12 +4539,11 @@ def class_group(self, proof=None, names='c'): INPUT: - - ``proof`` -- if ``True`` then compute the class group - provably correctly. Default is ``True``. Call :func:`number_field_proof` to - change this default globally. + - ``proof`` -- if ``True`` then compute the class group provably + correctly (default); call :func:`number_field_proof` to change this + default globally - - ``names`` -- names of the generators of this class - group. + - ``names`` -- names of the generators of this class group OUTPUT: the class group of this number field @@ -4619,9 +4600,8 @@ def class_group(self, proof=None, names='c'): default assume the Generalized Riemann Hypothesis. To do class groups computations not provably correctly you must often pass the flag ``proof=False`` to functions or call the function - ``proof.number_field(False)``. It can easily take 1000's of times + ``proof.number_field(False)``. It can easily take 1000s of times longer to do computations with ``proof=True`` (the default). - """ proof = proof_flag(proof) try: @@ -4646,7 +4626,7 @@ def class_number(self, proof=None): INPUT: - - ``proof`` -- bool (default: ``True`` unless you called + - ``proof`` -- boolean (default: ``True``, unless you called ``number_field_proof``) EXAMPLES:: @@ -4668,15 +4648,15 @@ def S_class_group(self, S, proof=None, names='c'): INPUT: - - ``S`` -- a set of primes of the base field + - ``S`` -- set of primes of the base field - - ``proof`` -- if False, assume the GRH in computing the class group. - Default is ``True``. Call ``number_field_proof`` to change this - default globally. + - ``proof`` -- if ``False``, assume the GRH in computing the class + group. Default is ``True``. Call ``number_field_proof`` to change + this default globally. - - ``names`` -- names of the generators of this class group. + - ``names`` -- names of the generators of this class group - OUTPUT: the S-class group of this number field. + OUTPUT: the S-class group of this number field EXAMPLES: @@ -4725,11 +4705,11 @@ def S_units(self, S, proof=True): INPUT: - - ``S`` -- a set of primes of the base field + - ``S`` -- set of primes of the base field - ``proof`` -- if ``False``, assume the GRH in computing the class group - OUTPUT: a list of generators of the unit group + OUTPUT: list of generators of the unit group .. note:: @@ -4774,7 +4754,6 @@ def S_units(self, S, proof=True): sage: J = K.ideal(-2) sage: K.S_units([I, J, I]) [2, -1] - """ return self._S_class_group_and_units(tuple(S), proof=proof)[0] @@ -4785,17 +4764,15 @@ def _S_class_group_and_units(self, S, proof=True): INPUT: - - ``S`` -- a tuple of prime ideals of ``self`` + - ``S`` -- tuple of prime ideals of ``self`` - ``proof`` -- if ``False``, assume the GRH in computing the class group - OUTPUT: + OUTPUT: ``units`` -- list of generators of the unit group - - ``units`` -- A list of generators of the unit group. - - - ``clgp_gens`` -- A list of generators of the `S`-class group. + - ``clgp_gens`` -- list of generators of the `S`-class group Each generator is represented as a pair ``(gen, order)``, - where ``gen`` is a fractional ideal of self and ``order`` is + where ``gen`` is a fractional ideal of ``self`` and ``order`` is its order in the `S`-class group. EXAMPLES:: @@ -4901,14 +4878,14 @@ def selmer_generators(self, S, m, proof=True, orders=False): INPUT: - - ``S`` -- a set of primes of ``self`` + - ``S`` -- set of primes of ``self`` - - ``m`` -- a positive integer + - ``m`` -- positive integer - ``proof`` -- if ``False``, assume the GRH in computing the class group - - ``orders`` -- (default: ``False``) if ``True``, output two lists, the - generators and their orders + - ``orders`` -- boolean (default: ``False``); if ``True``, output two + lists, the generators and their orders OUTPUT: @@ -5027,7 +5004,6 @@ def selmer_generators(self, S, m, proof=True, orders=False): sage: S = K.selmer_generators((), 4) sage: all(4.divides(x.valuation(p)) for x in S) True - """ units, clgp_gens = self._S_class_group_and_units(tuple(S), proof=proof) gens = [] @@ -5079,9 +5055,9 @@ def selmer_group_iterator(self, S, m, proof=True): INPUT: - - ``S`` -- a set of primes of ``self`` + - ``S`` -- set of primes of ``self`` - - ``m`` -- a positive integer + - ``m`` -- positive integer - ``proof`` -- if ``False``, assume the GRH in computing the class group @@ -5125,11 +5101,11 @@ def selmer_space(self, S, p, proof=None): INPUT: - - ``S`` -- a set of primes ideals of ``self`` + - ``S`` -- set of primes ideals of ``self`` - ``p`` -- a prime number - - ``proof`` -- if False, assume the GRH in computing the class group + - ``proof`` -- if ``False``, assume the GRH in computing the class group OUTPUT: @@ -5219,7 +5195,6 @@ def selmer_space(self, S, p, proof=None): sage: K.hilbert_class_field('b') Number Field in b with defining polynomial x^2 + 1 over its base field - """ from sage.rings.number_field.selmer_group import pSelmerGroup return pSelmerGroup(self, S, p, proof) @@ -5239,7 +5214,7 @@ def composite_fields(self, other, names=None, both_maps=False, preserve_embeddin - ``preserve_embedding`` -- boolean (default: ``True``) - OUTPUT: a list of the composite fields, possibly with maps + OUTPUT: list of the composite fields, possibly with maps If ``both_maps`` is ``True``, the list consists of quadruples ``(F, self_into_F, other_into_F, k)`` such that @@ -5958,7 +5933,7 @@ def decomposition_type(self, p): INPUT: - - ``p`` -- a prime element or ideal of the base field. + - ``p`` -- a prime element or ideal of the base field OUTPUT: @@ -6061,10 +6036,7 @@ def gen(self, n=0): INPUT: - - - ``n`` -- must be 0 (the default), or an exception is - raised. - + - ``n`` -- must be 0 (the default), or an exception is raised EXAMPLES:: @@ -6203,15 +6175,15 @@ def galois_group(self, type=None, algorithm='pari', names=None, gc_numbering=Non INPUT: - - ``type`` -- Deprecated; the different versions of Galois groups have been - merged in :issue:`28782`. + - ``type`` -- deprecated; the different versions of Galois groups have been + merged in :issue:`28782` - - ``algorithm`` -- ``'pari'``, ``'gap'``, ``'kash'``, ``'magma'``. (default: ``'pari'``; - for degrees between 12 and 15 default is ``'gap'``, and - when the degree is >= 16 it is ``'kash'``.) + - ``algorithm`` -- ``'pari'``, ``'gap'``, ``'kash'``, or ``'magma'`` + (default: ``'pari'``); for degrees between 12 and 15 default is + ``'gap'``, and when the degree is >= 16 it is ``'kash'``) - - ``names`` -- a string giving a name for the generator of the Galois - closure of ``self``, when this field is not Galois. + - ``names`` -- string giving a name for the generator of the Galois + closure of ``self``, when this field is not Galois - ``gc_numbering`` -- if ``True``, permutations will be written in terms of the action on the roots of a defining polynomial @@ -6300,7 +6272,7 @@ def galois_group(self, type=None, algorithm='pari', names=None, gc_numbering=Non We check that the changes in :issue:`28782` won't break code that used v1 Galois groups:: sage: # needs sage.groups - sage: G = NumberField(x^3 - 2, 'a').galois_group(type="pari") + sage: G = NumberField(x^3 - 2, 'a').galois_group(type='pari') ...DeprecationWarning: the different Galois types have been merged into one class See https://github.com/sagemath/sage/issues/28782 for details. sage: G.group() @@ -6333,7 +6305,6 @@ def _normalize_prime_list(self, v): (3, 5) sage: K._normalize_prime_list([3, 5, -3]) (3, 5) - """ if v is None: v = [] @@ -6385,8 +6356,8 @@ def integral_basis(self, v=None): INPUT: - - ``v`` -- ``None``, a prime, or a list of primes. See the - documentation for :meth:`maximal_order`. + - ``v`` -- ``None``, a prime, or a list of primes; see the + documentation for :meth:`maximal_order` EXAMPLES:: @@ -6416,11 +6387,11 @@ def _pari_integral_basis(self, v=None, important=True): INPUT: - - ``v`` -- ``None``, a prime, or a list of primes. See the - documentation for :meth:``maximal_order``. + - ``v`` -- ``None``, a prime, or a list of primes; see the + documentation for :meth:``maximal_order`` - - ``important`` -- boolean (default: ``True``). If ``False``, - raise a :class:`RuntimeError` if we need to do a difficult + - ``important`` -- boolean (default: ``True``); if ``False``, + raise a :exc:`RuntimeError` if we need to do a difficult discriminant factorization. This is useful when an integral basis is not strictly required. @@ -6489,8 +6460,8 @@ def reduced_basis(self, prec=None): INPUT: - - ``prec`` (default: ``None``) -- the precision with which to - compute the Minkowski embedding. + - ``prec`` -- (default: ``None``) the precision with which to + compute the Minkowski embedding OUTPUT: @@ -6563,8 +6534,8 @@ def reduced_gram_matrix(self, prec=None): INPUT: - - ``prec`` (default: ``None``) -- the precision with which - to calculate the Minkowski embedding. (See NOTE below.) + - ``prec`` -- (default: ``None``) the precision with which + to calculate the Minkowski embedding (see NOTE below) OUTPUT: the Gram matrix `[\langle x_i,x_j \rangle]` of an LLL reduced basis for the maximal order of ``self``, where the integral basis for @@ -6709,8 +6680,8 @@ def narrow_class_group(self, proof=None): INPUT: - - ``proof`` -- default: ``None`` (use the global proof - setting, which defaults to ``True``). + - ``proof`` -- (default: ``None``) use the global proof setting, which + defaults to ``True`` EXAMPLES:: @@ -6879,7 +6850,7 @@ def regulator(self, proof=None): INPUT: - - ``proof`` -- default: ``True``, unless you set it otherwise. + - ``proof`` -- (default: ``True``) unless you set it otherwise EXAMPLES:: @@ -6909,10 +6880,9 @@ def residue_field(self, prime, names=None, check=True): this number field, or an element of the field which generates a principal prime ideal. - - ``names`` -- the name of the variable in the residue - field + - ``names`` -- the name of the variable in the residue field - - ``check`` -- whether or not to check the primality of ``prime``. + - ``check`` -- whether or not to check the primality of ``prime`` OUTPUT: the residue field at this prime @@ -7002,22 +6972,20 @@ def trace_pairing(self, v): A[j, i] = t return A - def uniformizer(self, P, others="positive"): + def uniformizer(self, P, others='positive'): """ Return an element of ``self`` with valuation 1 at the prime ideal `P`. INPUT: + - ``self`` -- a number field - - ``self`` -- a number field - - - ``P`` -- a prime ideal of ``self`` - - - ``others`` -- either ``"positive"`` (default), in which - case the element will have non-negative valuation at all other - primes of ``self``, or ``"negative"``, in which case the element will have - non-positive valuation at all other primes of ``self``. + - ``P`` -- a prime ideal of ``self`` + - ``others`` -- either ``'positive'`` (default), in which case the + element will have nonnegative valuation at all other primes of + ``self``, or ``'negative'``, in which case the element will have + nonpositive valuation at all other primes of ``self``. .. note:: @@ -7103,7 +7071,7 @@ def units(self, proof=None): INPUT: - - ``proof`` (bool, default ``True``) flag passed to PARI. + - ``proof`` -- boolean (default: ``True``); flag passed to PARI .. note:: @@ -7185,7 +7153,7 @@ def unit_group(self, proof=None): INPUT: - - ``proof`` (bool, default ``True``) flag passed to PARI. + - ``proof`` -- boolean (default: ``True``); flag passed to PARI .. note:: @@ -7267,7 +7235,7 @@ def S_unit_group(self, proof=None, S=None): INPUT: - - ``proof`` -- bool (default: ``True``); flag passed to PARI + - ``proof`` -- boolean (default: ``True``); flag passed to PARI - ``S`` -- list or tuple of prime ideals, or an ideal, or a single ideal or element from which an ideal can be constructed, in @@ -7354,7 +7322,6 @@ def S_unit_group(self, proof=None, S=None): -1 * 2^9 * 3^5 sage: U.log(u) (1, 1, 4, 1, 5) - """ proof = proof_flag(proof) @@ -7405,11 +7372,15 @@ def S_unit_solutions(self, S=[], prec=106, include_exponents=False, include_boun INPUT: - - ``S`` -- a list of finite primes in this number field - - ``prec`` -- precision used for computations in real, complex, and p-adic fields (default: 106) - - ``include_exponents`` -- whether to include the exponent vectors in the returned value (default: ``True``). - - ``include_bound`` -- whether to return the final computed bound (default: ``False``) - - ``proof`` -- if ``False``, assume the GRH in computing the class group. Default is ``True``. + - ``S`` -- list of finite primes in this number field + - ``prec`` -- precision used for computations in real, complex, and + p-adic fields (default: 106) + - ``include_exponents`` -- whether to include the exponent vectors in + the returned value (default: ``True``) + - ``include_bound`` -- whether to return the final computed bound + (default: ``False``) + - ``proof`` -- if ``False``, assume the GRH in computing the class group; + default is ``True`` OUTPUT: @@ -7462,11 +7433,10 @@ def zeta(self, n=2, all=False): - ``n`` -- positive integer - - ``all`` -- boolean. If ``False`` (default), return a primitive - `n`-th root of unity in this field, or raise a :class:`ValueError` - exception if there are none. If ``True``, return a list of - all primitive `n`-th roots of unity in this field - (possibly empty). + - ``all`` -- boolean; if ``False`` (default), return a primitive + `n`-th root of unity in this field, or raise a :exc:`ValueError` + exception if there are none. If ``True``, return a list of all + primitive `n`-th roots of unity in this field (possibly empty). .. NOTE:: @@ -7721,11 +7691,11 @@ def solve_CRT(self, reslist, Ilist, check=True): INPUT: - - ``reslist`` -- a list of residues, i.e. integral number field elements + - ``reslist`` -- list of residues, i.e. integral number field elements - - ``Ilist`` -- a list of integral ideals, assumed pairwise coprime + - ``Ilist`` -- list of integral ideals, assumed pairwise coprime - - ``check`` -- (boolean, default ``True``) if ``True``, result is checked + - ``check`` -- boolean (default: ``True``); if ``True``, result is checked OUTPUT: @@ -7862,7 +7832,6 @@ def valuation(self, prime): :meth:`Order.valuation() `, :meth:`pAdicGeneric.valuation() ` - """ from sage.rings.padics.padic_valuation import pAdicValuation return pAdicValuation(self, prime) @@ -7894,7 +7863,6 @@ def some_elements(self): Number Field in a with defining polynomial t sage: K.some_elements() [0, 1, 2, -1, 1/2, -1/2, 1/4, -2, 4] - """ elements = [] @@ -7951,7 +7919,7 @@ def maximal_order(self, v=None, assume_maximal='non-maximal-non-unique'): - if a list, return an order that is maximal at each prime of these primes - ``assume_maximal`` -- ``True``, ``False``, ``None``, or - ``"non-maximal-non-unique"`` (default: ``"non-maximal-non-unique"``) + ``'non-maximal-non-unique'`` (default: ``'non-maximal-non-unique'``) ignored when ``v`` is ``None``; otherwise, controls whether we assume that the order :meth:`order.is_maximal` outside of ``v``. @@ -7962,7 +7930,7 @@ def maximal_order(self, v=None, assume_maximal='non-maximal-non-unique'): - if ``None``, no assumptions are made about primes not in ``v``. - - if ``"non-maximal-non-unique"`` (deprecated), like ``False``, + - if ``'non-maximal-non-unique'`` (deprecated), like ``False``, however, the order is not a unique parent, so creating the same order later does typically not poison caches with the information that the order is not maximal. @@ -8069,7 +8037,6 @@ def maximal_order(self, v=None, assume_maximal='non-maximal-non-unique'): 400160824478095086350656915693814563600 sage: O3.is_maximal() False - """ v = self._normalize_prime_list(v) @@ -8241,7 +8208,6 @@ def _coerce_from_other_number_field(self, x): AUTHORS: - Jeroen Demeyer (2011-09-30): :issue:`11869` - """ # Special case for x in QQ. This is common, so should be fast. xpol = x.polynomial() @@ -8433,7 +8399,6 @@ def _coerce_map_from_(self, R): sage: K. = NumberField(polygen(QQ)^2 - 2) sage: type(K.coerce_map_from(QQ)) - """ if R is int: return self._generic_coerce_map(R) @@ -8735,7 +8700,7 @@ def change_names(self, names): INPUT: - - ``names`` -- should be exactly one variable name. + - ``names`` -- should be exactly one variable name Also, ``K.structure()`` returns ``from_K`` and ``to_K``, where ``from_K`` is an isomorphism from `K` to ``self`` and ``to_K`` is an @@ -8869,7 +8834,6 @@ def _subfields_helper(self, degree=0, name=None, both_maps=True, optimize=False) sage: K = F.subfields(3)[0][0] sage: K Number Field in zeta7_0 with defining polynomial x^3 + x^2 - 2*x - 1 with zeta7_0 = 1.246979603717467? - """ if name is None: name = self.variable_names() @@ -8935,7 +8899,6 @@ def _maximal_order(self, v=(), assume_maximal=None): sage: k. = NumberField(x^3 + x^2 - 2*x+8) sage: k.maximal_order() is k.maximal_order() # indirect doctest True - """ B = [self(b, check=False) for b in self._pari_integral_basis(v=v)] @@ -8951,20 +8914,20 @@ def order(self, *args, **kwds): INPUT: - - ``gens`` -- list of elements in this number field; if no generators - are given, just returns the cardinality of this number field + - ``gens`` -- list of elements in this number field; if no generators + are given, just returns the cardinality of this number field (`\infty`) for consistency. - - ``check_is_integral`` -- bool (default: ``True``), whether to check - that each generator is integral. + - ``check_is_integral`` -- boolean (default: ``True``); whether to + check that each generator is integral - - ``check_rank`` -- bool (default: ``True``), whether to check that the - ring generated by ``gens`` is of full rank. + - ``check_rank`` -- boolean (default: ``True``); whether to check that + the ring generated by ``gens`` is of full rank - - ``allow_subfield`` -- bool (default: ``False``), if ``True`` and the - generators do not generate an order, i.e., they generate a subring - of smaller rank, instead of raising an error, return an order in a - smaller number field. + - ``allow_subfield`` -- boolean (default: ``False``); if ``True`` and + the generators do not generate an order, i.e., they generate a + subring of smaller rank, instead of raising an error, return an order + in a smaller number field EXAMPLES:: @@ -9045,7 +9008,6 @@ def _order(self, gens, **kwds): sage: K.order(a) is K.order(a,a^2) is K.order(a^2,a) True - """ from sage.rings.number_field.order import absolute_order_from_ring_generators return absolute_order_from_ring_generators(gens, **kwds) @@ -9063,7 +9025,7 @@ def free_module(self, base=None, basis=None, map=True): - ``basis`` -- a basis for this field over the base - - ``maps`` -- boolean (default ``True``), whether to return + - ``maps`` -- boolean (default: ``True``); whether to return `R`-linear maps to and from `V` OUTPUT: @@ -9193,7 +9155,8 @@ def galois_closure(self, names=None, map=False): - ``names`` -- variable name for Galois closure - - ``map`` -- (default: ``False``) also return an embedding of ``self`` into `K` + - ``map`` -- boolean (default: ``False``); also return an embedding of + ``self`` into `K` EXAMPLES:: @@ -9494,15 +9457,17 @@ def logarithmic_embedding(self, prec=53): Return the morphism of ``self`` under the logarithmic embedding in the category Set. - The logarithmic embedding is defined as a map from the number field ``self`` to `\RR^n`. + The logarithmic embedding is defined as a map from the number field + ``self`` to `\RR^n`. It is defined under Definition 4.9.6 in [Coh1993]_. INPUT: - - ``prec`` -- desired floating point precision. + - ``prec`` -- desired floating point precision - OUTPUT: the morphism of ``self`` under the logarithmic embedding in the category Set + OUTPUT: the morphism of ``self`` under the logarithmic embedding in the + category Set EXAMPLES:: @@ -9759,9 +9724,7 @@ def relativize(self, alpha, names, structure=None): will return isomorphisms from and to this field. Otherwise, the field will be equipped with ``structure``. - OUTPUT: - - `K` -- relative number field + OUTPUT: `K` -- relative number field Also, ``K.structure()`` returns ``from_K`` and ``to_K``, where ``from_K`` is an isomorphism from `K` to ``self`` and ``to_K`` is an isomorphism @@ -9936,7 +9899,6 @@ def relativize(self, alpha, names, structure=None): sage: K. = L.subfield(z24^3)[0] sage: L.relativize(K.hom(L), L.variable_name()+'0' ) Number Field in z2400 with defining polynomial x^2 + z240^3*x - z240^2 over its base field - """ # step 1: construct the abstract field generated by alpha.w # step 2: make a relative extension of it. @@ -9976,7 +9938,7 @@ def relativize(self, alpha, names, structure=None): basis.append(a**extdeg) # this one makes the basis no longer a basis mat = matrix([b.vector() for b in basis]) soln_space = mat.left_kernel(mat.row_space()(0)) - # the solution space is one dimensional and the last entry is non-zero + # the solution space is one dimensional and the last entry is nonzero # because a satisfies no smaller linear relation assert soln_space.dimension() == 1 (reln, ) = soln_space.basis() @@ -10117,7 +10079,7 @@ def relative_different(self): def hilbert_symbol(self, a, b, P=None): r""" Return the Hilbert symbol `(a,b)_P` for a prime `P` of ``self`` - and non-zero elements `a` and `b` of ``self``. + and nonzero elements `a` and `b` of ``self``. If `P` is omitted, return the global Hilbert symbol `(a,b)` instead. @@ -10125,19 +10087,19 @@ def hilbert_symbol(self, a, b, P=None): - ``a``, ``b`` -- elements of ``self`` - - ``P`` -- (default: ``None``) If ``None``, compute the global + - ``P`` -- (default: ``None``) if ``None``, compute the global symbol. Otherwise, `P` should be either a prime ideal of ``self`` (which may also be given as a generator or set of generators) or a real or complex embedding. OUTPUT: if `a` or `b` is zero, returns 0 - If `a` and `b` are non-zero and `P` is specified, returns + If `a` and `b` are nonzero and `P` is specified, returns the Hilbert symbol `(a,b)_P`, which is `1` if the equation `a x^2 + b y^2 = 1` has a solution in the completion of ``self`` at `P`, and is `-1` otherwise. - If `a` and `b` are non-zero and `P` is unspecified, returns `1` + If `a` and `b` are nonzero and `P` is unspecified, returns `1` if the equation has a solution in ``self`` and `-1` otherwise. EXAMPLES: @@ -10348,11 +10310,11 @@ def hilbert_symbol_negative_at_S(self, S, b, check=True): INPUT: - - ``S`` -- a list of places (or prime ideals) of even cardinality - - ``b`` -- a non-zero rational number which is a non-square locally - at every place in `S`. - - ``check`` -- bool (default: ``True``) perform additional checks on - the input and confirm the output + - ``S`` -- list of places (or prime ideals) of even cardinality + - ``b`` -- a nonzero rational number which is a non-square locally + at every place in `S` + - ``check`` -- boolean (default: ``True``); perform additional checks + on the input and confirm the output OUTPUT: @@ -10569,9 +10531,7 @@ def elements_of_bounded_height(self, **kwds): This is an implementation of the revised algorithm (Algorithm 4) in [DK2013]_. Algorithm 5 is used for imaginary quadratic fields. - INPUT: - - kwds: + INPUT: keyword arguments: - ``bound`` -- a real number @@ -11379,11 +11339,11 @@ def _coerce_from_other_cyclotomic_field(self, x, only_canonical=False): INPUT: - - ``x`` -- number field element + - ``x`` -- number field element - - ``only_canonical`` -- bool (default: ``False``); Attempt - to work, even in some cases when `x` is not in a subfield of the - cyclotomics (as long as `x` is a root of unity). + - ``only_canonical`` -- boolean (default: ``False``); attempt + to work, even in some cases when `x` is not in a subfield of the + cyclotomics (as long as `x` is a root of unity) EXAMPLES:: @@ -11758,7 +11718,7 @@ def discriminant(self, v=None): INPUT: - - ``v`` -- (optional) list of elements of this number field + - ``v`` -- (optional) list of elements of this number field OUTPUT: integer if ``v`` is omitted, and Rational otherwise @@ -11888,15 +11848,15 @@ def zeta(self, n=None, all=False): Return an element of multiplicative order `n` in this cyclotomic field. - If there is no such element, raise a :class:`ValueError`. + If there is no such element, raise a :exc:`ValueError`. INPUT: - ``n`` -- integer (default: ``None``, returns element of maximal order) - - ``all`` -- bool (default: ``False``); whether to return - a list of all primitive `n`-th roots of unity. + - ``all`` -- boolean (default: ``False``); whether to return + a list of all primitive `n`-th roots of unity OUTPUT: root of unity or list @@ -12165,7 +12125,6 @@ def _polymake_init_(self): sage: Z = QuadraticField(7) sage: polymake(Z) # optional - jupymake # indirect doctest QuadraticExtension - """ return '"QuadraticExtension"' @@ -12177,9 +12136,7 @@ def discriminant(self, v=None): INPUT: - - - ``v`` -- (optional) list of element of this number field - + - ``v`` -- (optional) list of element of this number field OUTPUT: integer if ``v`` is omitted, and Rational otherwise @@ -12271,7 +12228,6 @@ def class_number(self, proof=None): sage: type(CyclotomicField(10).class_number()) - """ proof = proof_flag(proof) try: @@ -12495,7 +12451,7 @@ def put_natural_embedding_first(v): INPUT: - - ``v`` -- a list of embeddings of a number field + - ``v`` -- list of embeddings of a number field OUTPUT: ``None``. The list is altered in-place, so that, if possible, the first embedding @@ -12541,12 +12497,12 @@ def refine_embedding(e, prec=None): INPUT: - - ``e`` -- an embedding of a number field into either - `\RR` or `\CC` (with some precision) + - ``e`` -- an embedding of a number field into either `\RR` or `\CC` + (with some precision) - - ``prec`` -- (default ``None``) the desired precision; if ``None``, - current precision is doubled; if ``Infinity``, the equivalent - embedding into either ``QQbar`` or ``AA`` is returned. + - ``prec`` -- (default: ``None``) the desired precision; if ``None``, + current precision is doubled; if ``Infinity``, the equivalent + embedding into either ``QQbar`` or ``AA`` is returned. EXAMPLES:: @@ -12678,7 +12634,7 @@ def refine_embedding(e, prec=None): def is_real_place(v): r""" - Return ``True`` if `v` is real, ``False`` if `v` is complex + Return ``True`` if `v` is real, ``False`` if `v` is complex. INPUT: @@ -12710,7 +12666,6 @@ def is_real_place(v): Traceback (most recent call last): ... AttributeError: 'NumberFieldFractionalIdeal' object has no attribute 'im_gens'... - """ RR = sage.rings.real_mpfr.RealField(53) try: @@ -12754,7 +12709,6 @@ def _splitting_classes_gens_(K, m, d): 11 sage: _splitting_classes_gens_(L,11,5) # needs sage.libs.gap # optional - gap_package_polycyclic [10] - """ from sage.groups.abelian_gps.abelian_group import AbelianGroup diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 6d82c1828dd..b0fef54ab18 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -172,8 +172,8 @@ cdef class NumberFieldElement(NumberFieldElement_base): """ cdef _new(self): """ - Quickly creates a new initialized NumberFieldElement with the same - parent as self. + Quickly create a new initialized NumberFieldElement with the same + parent as ``self``. """ cdef type t = type(self) cdef NumberFieldElement x = t.__new__(t) @@ -184,8 +184,8 @@ cdef class NumberFieldElement(NumberFieldElement_base): cdef number_field(self): r""" + Return the number field of ``self``. Only accessible from Cython. - Return the number field of self. Only accessible from Cython. EXAMPLES:: sage: x = polygen(ZZ, 'x') @@ -210,9 +210,9 @@ cdef class NumberFieldElement(NumberFieldElement_base): """ INPUT: - - ``parent`` -- a number field + - ``parent`` -- a number field - - ``f`` -- defines an element of a number field. + - ``f`` -- defines an element of a number field EXAMPLES: @@ -308,7 +308,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _lift_cyclotomic_element(self, new_parent, bint check=True, int rel=0): """ - Creates an element of the passed field from this field. This is + Create an element of the passed field from this field. This is specific to creating elements in a cyclotomic field from elements in another cyclotomic field, in the case that self.number_field()._n() divides new_parent()._n(). This @@ -449,7 +449,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): b^2 + 1 sage: (a+1)._im_gens_(m, [b^2]) b^2 + 1 - """ # NOTE -- if you ever want to change this so relative number # fields are in terms of a root of a poly. The issue is that @@ -467,7 +466,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _latex_(self): r""" - Returns the latex representation for this element. + Return the latex representation for this element. EXAMPLES:: @@ -480,7 +479,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _gap_init_(self): """ - Return gap string representation of self. + Return gap string representation of ``self``. EXAMPLES:: @@ -599,7 +598,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def __pari__(self, name='y'): r""" - Return PARI representation of self. + Return PARI representation of ``self``. The returned element is a PARI ``POLMOD`` in the variable ``name``, which is by default 'y' - not the name of the generator @@ -607,7 +606,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``name`` -- (default: 'y') the PARI variable name used. + - ``name`` -- (default: ``'y'``) the PARI variable name used EXAMPLES:: @@ -698,7 +697,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _pari_init_(self, name='y'): """ - Return PARI/GP string representation of self. + Return PARI/GP string representation of ``self``. The returned string defines a PARI ``POLMOD`` in the variable ``name``, which is by default 'y' - not the name of the generator @@ -706,7 +705,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``name`` -- (default: 'y') the PARI variable name used. + - ``name`` -- (default: ``'y'``) the PARI variable name used EXAMPLES:: @@ -882,11 +881,11 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``num_bound`` -- Bound for the numerator of coefficients of result + - ``num_bound`` -- bound for the numerator of coefficients of result - - ``den_bound`` -- Bound for the denominator of coefficients of result + - ``den_bound`` -- bound for the denominator of coefficients of result - - ``distribution`` -- Distribution to use for coefficients of result + - ``distribution`` -- distribution to use for coefficients of result EXAMPLES:: @@ -1293,12 +1292,9 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: + - ``prec`` -- integer (default: ``None``); bits of precision - - ``prec`` -- (default: None) integer bits of precision - - - ``i`` -- (default: None) integer, which embedding to - use - + - ``i`` -- integer (default: ``None``); which embedding to use EXAMPLES:: @@ -1357,7 +1353,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: b.abs(prec=53) 1.32471795724475 - """ if (i is None and prec is None and ( self._parent)._embedded_real): @@ -1380,10 +1375,10 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``P`` -- a prime ideal of the parent of ``self`` + - ``P`` -- a prime ideal of the parent of ``self`` - - ``prec`` (int) -- desired floating point precision (default: - default :class:`RealField` precision). + - ``prec`` -- integer (default: default :class:`RealField` precision); + desired floating point precision OUTPUT: @@ -1392,7 +1387,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): normalised absolute value, so that the underlying prime number `p` has absolute value `1/p`. - EXAMPLES:: sage: x = polygen(ZZ, 'x') @@ -1489,9 +1483,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - - ``prec`` -- integer (default: 53) bits of precision - + - ``prec`` -- integer (default: 53); bits of precision EXAMPLES:: @@ -1571,11 +1563,11 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``L`` -- a number field containing `K` = ``self.parent()``. - - ``element`` -- ``True`` or ``False``, whether to also output an element - of which ``self`` is a norm. - - ``proof`` -- If ``True``, then the output is correct unconditionally. - If ``False``, then the output is correct under GRH. + - ``L`` -- a number field containing `K` = ``self.parent()`` + - ``element`` -- boolean; whether to also output an element + of which ``self`` is a norm + - ``proof`` -- if ``True``, then the output is correct unconditionally; + if ``False``, then the output is correct under GRH OUTPUT: @@ -1707,7 +1699,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): algorithm looks for a solution `x` that is an `S`-integer, with `S` a list of places of `L` containing at least the ramified primes, the generators of the class group of `L`, as well as those primes - dividing self. + dividing ``self``. If `L/K` is Galois, then this is enough; otherwise, ``extra_primes`` is used to add more primes to `S`: all the places @@ -1720,10 +1712,10 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - `L` -- a relative number field with base field ``self.parent()`` - - ``proof`` -- whether to certify outputs of PARI init functions. - If ``False``, truth of the output depends on GRH. - - ``extra_primes`` -- an integer as explained above. + - ``L`` -- a relative number field with base field ``self.parent()`` + - ``proof`` -- whether to certify outputs of PARI init functions; + if ``False``, truth of the output depends on GRH + - ``extra_primes`` -- integer; as explained above OUTPUT: @@ -1954,7 +1946,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): elements raised to appropriate powers, with an appropriate unit factor. - Raise :class:`ValueError` if the factorization of the + Raise :exc:`ValueError` if the factorization of the ideal (``self``) contains a non-principal prime ideal. EXAMPLES:: @@ -1982,7 +1974,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): Traceback (most recent call last): ... ArithmeticError: factorization of 0 is not defined - """ if self.is_zero(): raise ArithmeticError("factorization of 0 is not defined") @@ -2033,14 +2024,13 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``self``, ``other`` -- elements of a number field or maximal - order. + - ``self``, ``other`` -- elements of a number field or maximal order OUTPUT: - - A generator of the ideal ``(self, other)``. If the parent is - a number field, this always returns 0 or 1. For maximal orders, - this raises :class:`ArithmeticError` if the ideal is not principal. + A generator of the ideal ``(self, other)``. If the parent is + a number field, this always returns 0 or 1. For maximal orders, + this raises :exc:`ArithmeticError` if the ideal is not principal. EXAMPLES:: @@ -2149,10 +2139,8 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - - ``root`` -- if ``True``, also return a square root (or - ``None`` if ``self`` is not a perfect square) - + - ``root`` -- if ``True``, also return a square root (or ``None`` if + ``self`` is not a perfect square) EXAMPLES:: @@ -2204,7 +2192,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - ``P`` -- a prime ideal - - ``check`` -- (default: ``True``); check if `P` is prime + - ``check`` -- boolean (default: ``True``); check if `P` is prime EXAMPLES:: @@ -2222,10 +2210,10 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``all`` -- optional boolean (default ``False``); whether to return + - ``all`` -- boolean (default: ``False``); whether to return both square roots - - ``extend`` -- optional boolean (default ``True``); whether to extend + - ``extend`` -- boolean (default: ``True``); whether to extend the field by adding the square roots if needed EXAMPLES:: @@ -2304,7 +2292,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def nth_root(self, n, all=False): r""" - Return an `n`'th root of ``self`` in its parent `K`. + Return an `n`-th root of ``self`` in its parent `K`. EXAMPLES:: @@ -2330,7 +2318,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def is_nth_power(self, n): r""" - Return ``True`` if ``self`` is an `n`'th power in its parent `K`. + Return ``True`` if ``self`` is an `n`-th power in its parent `K`. EXAMPLES:: @@ -2494,7 +2482,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): cpdef _mul_(self, right): """ - Returns the product of self and other as elements of a number + Return the product of ``self`` and ``other`` as elements of a number field. EXAMPLES:: @@ -2542,7 +2530,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): cpdef _div_(self, other): """ - Returns the quotient of self and other as elements of a number + Return the quotient of ``self`` and ``other`` as elements of a number field. EXAMPLES:: @@ -2753,7 +2741,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def __invert__(self): """ - Return the multiplicative inverse of self in the number field. + Return the multiplicative inverse of ``self`` in the number field. EXAMPLES:: @@ -2792,7 +2780,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _integer_(self, Z=None): """ - Returns an integer if this element is actually an integer. + Return an integer if this element is actually an integer. EXAMPLES:: @@ -2810,7 +2798,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): def _rational_(self): """ - Returns a rational number if this element is actually a rational + Return a rational number if this element is actually a rational number. EXAMPLES:: @@ -2844,7 +2832,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: AA(alpha) Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real sage: NF. = NumberField(x^5 + 7*x + 3) @@ -2980,7 +2968,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: K. = NumberField(p, embedding=rt) sage: SR(a) # needs sage.symbolic -0.3056815681115094? - """ K = self._parent.fraction_field() @@ -3073,7 +3060,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): This is only well-defined for fields contained in CM fields (i.e. for totally real fields and CM fields). Recall that a CM field is a totally imaginary quadratic extension of a totally - real field. For other fields, a :class:`ValueError` is raised. + real field. For other fields, a :exc:`ValueError` is raised. EXAMPLES:: @@ -3096,7 +3083,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: j.conjugate() -j - Raise a :class:`ValueError` if the field is not contained in a CM field. + Raise a :exc:`ValueError` if the field is not contained in a CM field. :: @@ -3124,7 +3111,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): -1/2*a^3 - a - 1/2 sage: (2*a^2 - 1).conjugate() a^3 - 2*a^2 - 2 - """ nf = self.number_field() @@ -3171,7 +3157,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): 1/2*x^3 + 3*x - 1/2 sage: R(list(b)) y - """ from sage.rings.polynomial.polynomial_ring_constructor import _single_variate as Pol return Pol(QQ, var)(self._coefficients()) @@ -3235,10 +3220,8 @@ cdef class NumberFieldElement(NumberFieldElement_base): Return the coefficients of the underlying polynomial corresponding to this number field element. - OUTPUT: - - - a list whose length corresponding to the degree of this - element written in terms of a generator + OUTPUT: list whose length corresponding to the degree of this element + written in terms of a generator EXAMPLES:: @@ -3740,9 +3723,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - - ``base`` -- field or morphism - + - ``base`` -- field or morphism EXAMPLES: @@ -3863,7 +3844,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``P`` -- a prime ideal of the parent of ``self`` + - ``P`` -- a prime ideal of the parent of ``self`` .. NOTE:: @@ -3930,18 +3911,17 @@ cdef class NumberFieldElement(NumberFieldElement_base): def local_height(self, P, prec=None, weighted=False): r""" - Returns the local height of ``self`` at a given prime ideal `P`. + Return the local height of ``self`` at a given prime ideal `P`. INPUT: - - ``P`` -- a prime ideal of the parent of ``self`` - - ``prec`` (int) -- desired floating point precision (default: - default :class:`RealField` precision). + - ``prec`` -- integer; (default: default :class:`RealField` precision); + desired floating point precision - - ``weighted`` (bool, default ``False``) -- if ``True``, apply local - degree weighting. + - ``weighted`` -- boolean (default: ``False``); if ``True``, apply local + degree weighting OUTPUT: @@ -3987,23 +3967,23 @@ cdef class NumberFieldElement(NumberFieldElement_base): def local_height_arch(self, i, prec=None, weighted=False): r""" - Returns the local height of ``self`` at the `i`'th infinite place. + Return the local height of ``self`` at the `i`-th infinite place. INPUT: - - ``i`` (int) -- an integer in ``range(r+s)`` where `(r,s)` is the - signature of the parent field (so `n=r+2s` is the degree). + - ``i`` -- integer in ``range(r+s)`` where `(r,s)` is the signature of + the parent field (so `n=r+2s` is the degree) - - ``prec`` (int) -- desired floating point precision (default: - default :class:`RealField` precision). + - ``prec`` -- integer (default: default :class:`RealField` precision); + desired floating point precision - - ``weighted`` (bool, default ``False``) -- if ``True``, apply local - degree weighting, i.e. double the value for complex places. + - ``weighted`` -- boolean (default: ``False``); if ``True``, apply local + degree weighting, i.e. double the value for complex places OUTPUT: (real) The archimedean local height of this number field - element at the `i`'th infinite place. If ``weighted`` is + element at the `i`-th infinite place. If ``weighted`` is ``True``, this is multiplied by the local degree (as required for global heights), i.e. 1 for real places and 2 for complex places. @@ -4051,8 +4031,8 @@ cdef class NumberFieldElement(NumberFieldElement_base): INPUT: - - ``prec`` (int) -- desired floating point precision (default: - default RealField precision). + - ``prec`` -- integer (default: default RealField precision); desired + floating point precision OUTPUT: @@ -4101,12 +4081,12 @@ cdef class NumberFieldElement(NumberFieldElement_base): def global_height_arch(self, prec=None): """ - Returns the total archimedean component of the height of ``self``. + Return the total archimedean component of the height of ``self``. INPUT: - - ``prec`` (int) -- desired floating point precision (default: - default :class:`RealField` precision). + - ``prec`` -- integer (default: default :class:`RealField` precision); + desired floating point precision OUTPUT: @@ -4128,12 +4108,12 @@ cdef class NumberFieldElement(NumberFieldElement_base): def global_height(self, prec=None): """ - Returns the absolute logarithmic height of this number field element. + Return the absolute logarithmic height of this number field element. INPUT: - - ``prec`` (int) -- desired floating point precision (default: - default :class:`RealField` precision). + - ``prec`` -- integer (default: default :class:`RealField` precision); + desired floating point precision OUTPUT: @@ -4175,7 +4155,6 @@ cdef class NumberFieldElement(NumberFieldElement_base): 0.346573590279973 sage: (1/s).global_height() #make sure that 11758 is fixed 0.346573590279973 - """ return (self.global_height_non_arch(prec)+self.global_height_arch(prec))/self.number_field().absolute_degree() @@ -4366,14 +4345,14 @@ cdef class NumberFieldElement(NumberFieldElement_base): def inverse_mod(self, I): r""" - Returns the inverse of ``self`` mod the integral ideal `I`. + Return the inverse of ``self`` mod the integral ideal `I`. INPUT: - - ``I`` -- may be an ideal of ``self.parent()``, or an element or list - of elements of ``self.parent()`` generating a nonzero ideal. A :class:`ValueError` - is raised if `I` is non-integral or zero. A :class:`ZeroDivisionError` is - raised if `I + (x) \neq (1)`. + - ``I`` -- may be an ideal of ``self.parent()``, or an element or list + of elements of ``self.parent()`` generating a nonzero ideal. A + :exc:`ValueError` is raised if `I` is non-integral or zero. A + :exc:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. .. NOTE:: @@ -4420,7 +4399,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): .. NOTE:: can also be called for an ideal from sage.rings.number_field_ideal.residue_symbol - .. NOTE:: self is coerced into the number field of the ideal P + .. NOTE:: ``self`` is coerced into the number field of the ideal P .. NOTE:: @@ -4433,9 +4412,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): - ``m`` -- positive integer - OUTPUT: - - - an `m`-th root of unity in the number field + OUTPUT: an `m`-th root of unity in the number field EXAMPLES: @@ -4463,35 +4440,34 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: (w^2 + 3).residue_symbol(K.ideal(17),3) -w - The field must contain the m-th roots of unity:: + The field must contain the `m`-th roots of unity:: sage: K. = NumberField(x^2 - x + 1) sage: (w^2 + 3).residue_symbol(K.ideal(17),5) Traceback (most recent call last): ... ValueError: The residue symbol to that power is not defined for the number field - """ return P.residue_symbol(self,m,check) def descend_mod_power(self, K=QQ, d=2): r""" Return a list of elements of the subfield `K` equal to - ``self`` modulo `d`'th powers. + ``self`` modulo `d`-th powers. INPUT: - - ``K`` (number field, default `\QQ`) -- a subfield of the + - ``K`` -- number field (default: `\QQ`); a subfield of the parent number field `L` of ``self`` - - ``d`` (positive integer, default 2) -- an integer at least 2 + - ``d`` -- positive integer (default: 2); an integer at least 2 OUTPUT: A list, possibly empty, of elements of `K` equal to ``self`` - modulo `d`'th powers, i.e. the preimages of ``self`` under the + modulo `d`-th powers, i.e. the preimages of ``self`` under the map `K^*/(K^*)^d \rightarrow L^*/(L^*)^d` where `L` is the - parent of ``self``. A :class:`ValueError` is raised if `K` does + parent of ``self``. A :exc:`ValueError` is raised if `K` does not embed into `L`. ALGORITHM: @@ -4650,12 +4626,10 @@ cdef class NumberFieldElement_absolute(NumberFieldElement): INPUT: - - - ``magma`` -- a Magma interpreter - + - ``magma`` -- a Magma interpreter OUTPUT: MagmaElement that has parent the Magma object corresponding - to the parent number field. + to the parent number field EXAMPLES:: @@ -4860,7 +4834,6 @@ cdef class NumberFieldElement_absolute(NumberFieldElement): sage: K. = QuadraticField(-3) sage: a.lift() x - """ R = self.number_field().base_field()[var] return R(self.list()) @@ -4924,7 +4897,7 @@ cdef class NumberFieldElement_relative(NumberFieldElement): The current relative number field element implementation does everything in terms of absolute polynomials. - All conversions from relative polynomials, lists, vectors, etc + All conversions from relative polynomials, lists, vectors, etc., should happen in the parent. """ def __init__(self, parent, f): @@ -5021,7 +4994,6 @@ cdef class NumberFieldElement_relative(NumberFieldElement): sage: u = L(1/2*a + 1/2 + b + (a-9)*b^5) sage: u.lift() (a - 9)*x^5 + x + 1/2*a + 1/2 - """ K = self.number_field() # Compute representation of self in terms of relative vector space. @@ -5191,7 +5163,8 @@ cdef class NumberFieldElement_relative(NumberFieldElement): INPUT: - - ``P`` -- a prime ideal of relative number field which is the parent of ``self`` + - ``P`` -- a prime ideal of relative number field which is the parent + of ``self`` EXAMPLES:: @@ -5247,7 +5220,7 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute): cdef _new(self): """ - Quickly creates a new initialized NumberFieldElement with the same + Quickly create a new initialized NumberFieldElement with the same parent as ``self``. EXAMPLES: @@ -5288,10 +5261,10 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute): INPUT: - - ``I`` -- may be an ideal of ``self.parent()``, or an - element or list of elements of ``self.parent()`` generating a nonzero - ideal. A :class:`ValueError` is raised if `I` is non-integral or is zero. - A :class:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. + - ``I`` -- may be an ideal of ``self.parent()``, or an element or list + of elements of ``self.parent()`` generating a nonzero ideal. A + :exc:`ValueError` is raised if `I` is non-integral or is zero. A + :exc:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. EXAMPLES:: @@ -5366,8 +5339,8 @@ cdef class OrderElement_relative(NumberFieldElement_relative): cdef _new(self): """ - Quickly creates a new initialized NumberFieldElement with the same - parent as self. + Quickly create a new initialized NumberFieldElement with the same + parent as ``self``. EXAMPLES: @@ -5420,12 +5393,10 @@ cdef class OrderElement_relative(NumberFieldElement_relative): INPUT: - - - ``I`` -- may be an ideal of ``self.parent()``, or an - element or list of elements of ``self.parent()`` generating a nonzero - ideal. A :class:`ValueError` is raised if `I` is non-integral or is zero. - A :class:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. - + - ``I`` -- may be an ideal of ``self.parent()``, or an + element or list of elements of ``self.parent()`` generating a nonzero + ideal. A :exc:`ValueError` is raised if `I` is non-integral or is zero. + A :exc:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. EXAMPLES:: @@ -5631,7 +5602,7 @@ class CoordinateFunction(): def __eq__(self, other): """ - Test equality + Test equality. EXAMPLES:: @@ -5657,7 +5628,7 @@ class CoordinateFunction(): def __ne__(self, other): """ - Test inequality + Test inequality. EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_element_base.pyx b/src/sage/rings/number_field/number_field_element_base.pyx index 5fee5817cbc..759209f8bb3 100644 --- a/src/sage/rings/number_field/number_field_element_base.pyx +++ b/src/sage/rings/number_field/number_field_element_base.pyx @@ -13,10 +13,11 @@ Number field elements (abstract base class) cdef class NumberFieldElement_base(FieldElement): r""" - Abstract base class for :class:`~sage.rings.number_field.number_field_element.NumberFieldElement` + Abstract base class for + :class:`~sage.rings.number_field.number_field_element.NumberFieldElement`. - This class is defined for the purpose of :func:`isinstance` tests. It should not be - instantiated. + This class is defined for the purpose of :func:`isinstance` tests. + It should not be instantiated. EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pyx b/src/sage/rings/number_field/number_field_element_quadratic.pyx index 670ae1fe7ca..e3062448708 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -227,8 +227,8 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): cdef _new(self): """ - Quickly creates a new initialized NumberFieldElement_quadratic with the - same parent as self. + Quickly create a new initialized NumberFieldElement_quadratic with the + same parent as ``self``. EXAMPLES:: @@ -472,7 +472,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): def _lift_cyclotomic_element(self, new_parent, bint check=True, int rel=0): """ - Creates an element of the passed field from this field. This + Create an element of the passed field from this field. This is specific to creating elements in a cyclotomic field from elements in another cyclotomic field, in the case that self.number_field()._n() divides new_parent()._n(). This @@ -943,7 +943,8 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): def sign(self): r""" - Returns the sign of ``self`` (`0` if zero, `+1` if positive, and `-1` if negative). + Return the sign of ``self`` (`0` if zero, `+1` if positive, and `-1` if + negative). EXAMPLES:: @@ -1296,7 +1297,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): r""" Reduces into canonical form. - WARNING: this mutates self. + WARNING: this mutates ``self``. """ cdef mpz_t gcd # cancel out common factors @@ -1470,7 +1471,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): sage: K. = QuadraticField(5, embedding=AA(5).sqrt()) sage: sqrt5*vector([1,2]) (sqrt5, 2*sqrt5) - """ cdef NumberFieldElement_quadratic other = other_m cdef NumberFieldElement_quadratic res = self._new() @@ -2072,7 +2072,6 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): Traceback (most recent call last): ... ValueError: no way to embed L into parent's base ring K - """ cdef Rational res = Rational.__new__(Rational) @@ -2188,8 +2187,9 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): INPUT: - ``var`` -- the minimal polynomial is defined over a polynomial ring - in a variable with this name. If not specified, this defaults to ``'x'`` - - ``algorithm`` -- for compatibility with general number field elements; ignored + in a variable with this name; if not specified, this defaults to ``'x'`` + - ``algorithm`` -- for compatibility with general number field + elements; ignored EXAMPLES:: @@ -2213,8 +2213,9 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): INPUT: - ``var`` -- the minimal polynomial is defined over a polynomial ring - in a variable with this name. If not specified, this defaults to ``'x'`` - - ``algorithm`` -- for compatibility with general number field elements: and ignored + in a variable with this name; if not specified, this defaults to ``'x'`` + - ``algorithm`` -- for compatibility with general number field + elements; ignored EXAMPLES:: @@ -2262,7 +2263,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): def floor(self): r""" - Returns the floor of ``self``. + Return the floor of ``self``. EXAMPLES:: @@ -2728,9 +2729,9 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): INPUT: - ``var`` -- the minimal polynomial is defined over a polynomial ring - in a variable with this name. If not specified, this defaults to ``'x'`` - - ``algorithm`` -- for compatibility with general number field elements; ignored - + in a variable with this name; if not specified, this defaults to ``'x'`` + - ``algorithm`` -- for compatibility with general number field + elements; ignored EXAMPLES:: @@ -2755,8 +2756,9 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): INPUT: - ``var`` -- the minimal polynomial is defined over a polynomial ring - in a variable with this name. If not specified, this defaults to ``'x'`` - - ``algorithm`` -- for compatibility with general number field elements; ignored + in a variable with this name; if not specified, this defaults to ``'x'`` + - ``algorithm`` -- for compatibility with general number field + elements; ignored EXAMPLES:: @@ -2849,10 +2851,10 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): INPUT: - - ``I`` -- may be an ideal of ``self.parent()``, or an - element or list of elements of ``self.parent()`` generating a nonzero - ideal. A :class:`ValueError` is raised if `I` is non-integral or is zero. - A :class:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. + - ``I`` -- may be an ideal of ``self.parent()``, or an + element or list of elements of ``self.parent()`` generating a nonzero + ideal. A :exc:`ValueError` is raised if `I` is non-integral or is zero. + A :exc:`ZeroDivisionError` is raised if `I + (x) \neq (1)`. EXAMPLES:: @@ -3058,7 +3060,9 @@ cdef class Q_to_quadratic_field_element(Morphism): def __init__(self, K): """ - ``K`` is the target quadratic field + INPUT: + + - ``K`` -- the target quadratic field EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py index 906c39a1e35..b8c06e359d2 100644 --- a/src/sage/rings/number_field/number_field_ideal.py +++ b/src/sage/rings/number_field/number_field_ideal.py @@ -100,7 +100,8 @@ def __init__(self, field, gens, coerce=True): - ``field`` -- a number field - - ``gens`` -- a list of :class:`NumberFieldElement` objects belonging to the field + - ``gens`` -- list of :class:`NumberFieldElement` objects belonging to + the field TESTS: @@ -144,13 +145,10 @@ def _magma_init_(self, magma): INPUT: - - - ``magma`` -- a Magma interpreter - + - ``magma`` -- a Magma interpreter OUTPUT: :class:`MagmaElement` corresponding to this ideal - EXAMPLES:: sage: x = polygen(ZZ) @@ -302,7 +300,8 @@ def coordinates(self, x): INPUT: - - ``x`` -- an element of the number field (or ring of integers) of this ideal. + - ``x`` -- an element of the number field (or ring of integers) of this + ideal OUTPUT: @@ -556,7 +555,7 @@ def __pari__(self): def _pari_init_(self): """ - Return self in PARI Hermite Normal Form as a string + Return ``self`` in PARI Hermite Normal Form as a string. EXAMPLES:: @@ -726,9 +725,9 @@ def free_module(self): def reduce_equiv(self): """ - Return a small ideal that is equivalent to self in the group + Return a small ideal that is equivalent to ``self`` in the group of fractional ideals modulo principal ideals. Very often (but - not always) if self is principal then this function returns + not always) if ``self`` is principal then this function returns the unit ideal. ALGORITHM: Calls :pari:`idealred` function. @@ -848,7 +847,6 @@ def gens_two(self): [12, [0, 12]~] sage: I.gens_two() (12, 0) - """ try: return self.__two_generators @@ -1065,7 +1063,7 @@ def pari_prime(self): INPUT: - - ``self`` -- a prime ideal. + - ``self`` -- a prime ideal OUTPUT: a PARI "prime ideal", i.e. a five-component vector `[p,a,e,f,b]` representing the prime ideal `p O_K + a O_K`, `e`, `f` as usual, `a` as @@ -1097,10 +1095,10 @@ def _cache_bnfisprincipal(self, proof=None, gens=False): - ``self`` -- an ideal - - ``proof`` -- proof flag. If ``proof=False``, assume GRH. + - ``proof`` -- proof flag. If ``proof=False``, assume GRH - - ``gens`` -- (default: ``False``) if True, also computes the reduced - generators of the ideal. + - ``gens`` -- boolean (default: ``False``); if ``True``, also computes + the reduced generators of the ideal OUTPUT: @@ -1271,7 +1269,7 @@ def S_ideal_class_log(self, S): def is_zero(self): """ - Return ``True`` iff ``self`` is the zero ideal + Return ``True`` iff ``self`` is the zero ideal. Note that `(0)` is a :class:`NumberFieldIdeal`, not a :class:`NumberFieldFractionalIdeal`. @@ -1386,7 +1384,7 @@ def number_field(self): def smallest_integer(self): r""" - Return the smallest non-negative integer in `I \cap \ZZ`, + Return the smallest nonnegative integer in `I \cap \ZZ`, where `I` is this ideal. If `I = 0`, returns 0. EXAMPLES:: @@ -1443,17 +1441,17 @@ def smallest_integer(self): def valuation(self, p): r""" - Return the valuation of self at ``p``. + Return the valuation of ``self`` at ``p``. INPUT: - - ``p`` -- a prime ideal `\mathfrak{p}` of this number field. + - ``p`` -- a prime ideal `\mathfrak{p}` of this number field OUTPUT: (integer) The valuation of this fractional ideal at the prime `\mathfrak{p}`. If `\mathfrak{p}` is not prime, raise a - :class:`ValueError`. + :exc:`ValueError`. EXAMPLES:: @@ -1503,10 +1501,10 @@ def decomposition_group(self): def ramification_group(self, v): r""" - Return the `v`'th ramification group of ``self``, i.e. the set of + Return the `v`-th ramification group of ``self``, i.e. the set of elements `s` of the Galois group of the number field of ``self`` (which we assume is Galois) such that `s` acts trivially - modulo the `(v+1)`'st power of self. See the + modulo the `(v+1)`'st power of ``self``. See the :meth:`GaloisGroup.ramification_group` method for further examples and doctests. @@ -1541,7 +1539,7 @@ def random_element(self, *args, **kwds): INPUT: - - ``*args``, ``*kwds`` -- Parameters passed to the random integer + - ``*args``, ``*kwds`` -- parameters passed to the random integer function. See the documentation of ``ZZ.random_element()`` for details. @@ -1557,7 +1555,7 @@ def random_element(self, *args, **kwds): sage: I = K.ideal(1 - a) sage: I.random_element() # random output -a^2 - a - 19 - sage: I.random_element(distribution="uniform") # random output + sage: I.random_element(distribution='uniform') # random output a^2 - 2*a - 8 sage: I.random_element(-30, 30) # random output -7*a^2 - 17*a - 75 @@ -1624,9 +1622,7 @@ def residue_symbol(self, e, m, check=True): - ``m`` -- positive integer - OUTPUT: - - - an m-th root of unity in the number field + OUTPUT: an `m`-th root of unity in the number field EXAMPLES: @@ -1650,7 +1646,6 @@ def residue_symbol(self, e, m, check=True): Traceback (most recent call last): ... ValueError: The residue symbol to that power is not defined for the number field - """ K = self.ring() if m == 2 and K.absolute_degree() == 1: @@ -1840,8 +1835,9 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I def __init__(self, field, gens, coerce=True): """ INPUT: - field -- a number field - x -- a list of NumberFieldElements of the field, not all zero + + - ``field`` -- a number field + - ``x`` -- list of NumberFieldElements of the field, not all zero EXAMPLES:: @@ -1884,7 +1880,7 @@ def __repr__(self): def divides(self, other): """ - Return ``True`` if this ideal divides other and False otherwise. + Return ``True`` if this ideal divides ``other`` and ``False`` otherwise. EXAMPLES:: @@ -2060,7 +2056,7 @@ def is_trivial(self, proof=None): def ramification_index(self): r""" Return the ramification index of this fractional ideal, - assuming it is prime. Otherwise, raise a :class:`ValueError`. + assuming it is prime. Otherwise, raise a :exc:`ValueError`. The ramification index is the power of this prime appearing in the factorization of the prime in `\ZZ` that this prime lies @@ -2194,7 +2190,7 @@ def residues(self): OUTPUT: An iterator through a complete list of residues modulo the integral - ideal self. This list is the set of canonical reduced representatives + ideal ``self``. This list is the set of canonical reduced representatives given by all integral elements with coordinates `(r_0, \dots,r_{n-1})`, where: @@ -2258,8 +2254,8 @@ def invertible_residues(self, reduce=True): INPUT: - - ``reduce`` -- bool. If ``True`` (default), use ``small_residue`` to get - small representatives of the residues. + - ``reduce`` -- boolean; if ``True`` (default), use ``small_residue`` to get + small representatives of the residues OUTPUT: @@ -2324,8 +2320,8 @@ def invertible_residues_mod(self, subgp_gens=[], reduce=True): an iterator through a list of representatives for the invertible residues modulo the integral ideal ``self``. - - ``reduce`` -- bool. If ``True`` (default), use ``small_residues`` to - get small representatives of the residues. + - ``reduce`` -- boolean; if ``True`` (default), use ``small_residues`` to + get small representatives of the residues .. note:: @@ -2474,7 +2470,7 @@ def is_coprime(self, other): INPUT: - ``other`` -- another ideal of the same field, or generators - of an ideal. + of an ideal OUTPUT: ``True`` if ``self`` and ``other`` are coprime, else ``False`` @@ -2538,7 +2534,8 @@ def idealcoprime(self, J): INPUT: - - ``J`` -- another integral ideal of the same field as ``self``, which must also be integral. + - ``J`` -- another integral ideal of the same field as ``self``, which + must also be integral OUTPUT: an element `l` such that ``l*self`` is coprime to the ideal `J` @@ -2611,7 +2608,6 @@ def small_residue(self, f): sage: I = K.ideal(5) sage: I.small_residue(a^2 -13) a^2 + 5*a - 3 - """ if not self.is_integral(): raise ValueError("The ideal must be integral") @@ -2628,9 +2624,7 @@ def _pari_bid_(self, flag=1): `(O_K/I)^*`, which takes more time. By default ``flag=1`` (no generators are computed). - OUTPUT: - - - The pari special structure ``bid``. + OUTPUT: the PARI special structure ``bid`` EXAMPLES:: @@ -2664,11 +2658,11 @@ def idealstar(self, flag=1): INPUT: - - ``flag`` (int default 1) -- when ``flag`` =2, it also + - ``flag`` -- integer (default: 1); when ``flag==2``, it also computes the generators of the group `(O_K/I)^*`, which - takes more time. By default ``flag`` =1 (no generators are + takes more time. By default ``flag==1`` (no generators are computed). In both cases the special PARI structure ``bid`` - is computed as well. If ``flag`` =0 (deprecated) it computes + is computed as well. If ``flag==0`` (deprecated) it computes only the group structure of `(O_K/I)^*` (with generators) and not the special ``bid`` structure. @@ -2734,26 +2728,26 @@ def ideallog(self, x, gens=None, check=True): INPUT: - - ``x`` -- a non-zero element of the number field of ``self``, + - ``x`` -- a nonzero element of the number field of ``self``, which must have valuation equal to 0 at all prime ideals in - the support of the ideal ``self``. - - ``gens`` -- a list of elements of the number field which generate `(R + the support of the ideal ``self`` + - ``gens`` -- list of elements of the number field which generate `(R / I)^*`, where `R` is the ring of integers of the field and `I` is this ideal, or ``None``. If ``None``, use the generators calculated by :meth:`~idealstar`. - - ``check`` -- if ``True``, do a consistency check on the results. Ignored - if ``gens`` is ``None``. + - ``check`` -- if ``True``, do a consistency check on the results. + Ignored if ``gens`` is ``None``. OUTPUT: - a list of non-negative integers `(x_i)` such that `x = + a list of nonnegative integers `(x_i)` such that `x = \prod_i g_i^{x_i}` in `(R/I)^*`, where `x_i` are the generators, and the list `(x_i)` is lexicographically minimal with respect to this requirement. If the `x_i` generate independent cyclic factors of order `d_i`, as is the case for the default generators calculated by :meth:`~idealstar`, this just means that `0 \le x_i < d_i`. - A :class:`ValueError` will be raised if the elements specified in ``gens`` + A :exc:`ValueError` will be raised if the elements specified in ``gens`` do not in fact generate the unit group (even if the element `x` is in the subgroup they generate). @@ -2853,7 +2847,7 @@ def ideallog(self, x, gens=None, check=True): def element_1_mod(self, other): r""" - Return an element `r` in this ideal such that `1-r` is in ``other`` + Return an element `r` in this ideal such that `1-r` is in ``other``. An error is raised if either ideal is not integral of if they are not coprime. @@ -2861,11 +2855,10 @@ def element_1_mod(self, other): INPUT: - ``other`` -- another ideal of the same field, or generators - of an ideal. - - OUTPUT: + of an ideal - An element `r` of the ideal self such that `1-r` is in the ideal ``other`` + OUTPUT: an element `r` of the ideal ``self`` such that `1-r` is in the + ideal ``other`` AUTHOR: Maite Aranes (modified to use PARI's :pari:`idealaddtoone` by Francis Clarke) @@ -2971,7 +2964,7 @@ def prime_to_S_part(self, S): INPUT: - - ``S`` -- a list of prime ideals + - ``S`` -- list of prime ideals OUTPUT: @@ -3011,8 +3004,8 @@ def is_S_unit(self, S): INPUT: - - ``S`` -- a list of prime ideals (not checked if they are - indeed prime). + - ``S`` -- list of prime ideals (not checked if they are + indeed prime) .. note:: @@ -3042,8 +3035,7 @@ def is_S_integral(self, S): INPUT: - - `S` -- a list of prime ideals (not checked if they are indeed - prime). + - ``S`` -- list of prime ideals (not checked if they are indeed prime) .. note:: @@ -3054,7 +3046,7 @@ def is_S_integral(self, S): OUTPUT: ``True``, if the ideal is `S`-integral: that is, if the valuations - of the ideal at all primes not in `S` are non-negative. ``False``, + of the ideal at all primes not in `S` are nonnegative. ``False``, otherwise. EXAMPLES:: @@ -3130,10 +3122,10 @@ def _p_quotient(self, p): OUTPUT: - - `V` -- a vector space of characteristic `p` + - ``V`` -- a vector space of characteristic `p` - ``quo`` -- a partially defined quotient homomorphism from the ambient number field to `V` - - ``lift`` -- a section of ``quo``. + - ``lift`` -- a section of ``quo`` EXAMPLES:: @@ -3213,11 +3205,10 @@ def residue_field(self, names=None): sage: FF(a) w - An example of reduction maps to the residue field: these are - defined on the whole valuation ring, i.e. the subring of the - number field consisting of elements with non-negative - valuation. This shows that the issue raised in :issue:`1951` - has been fixed:: + An example of reduction maps to the residue field: these are defined on + the whole valuation ring, i.e. the subring of the number field + consisting of elements with nonnegative valuation. This shows that the + issue raised in :issue:`1951` has been fixed:: sage: K. = NumberField(x^2 + 1) sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2 @@ -3268,7 +3259,7 @@ def residue_field(self, names=None): def residue_class_degree(self): r""" Return the residue class degree of this fractional ideal, - assuming it is prime. Otherwise, raise a :class:`ValueError`. + assuming it is prime. Otherwise, raise a :exc:`ValueError`. The residue class degree of a prime ideal `I` is the degree of the extension `O_K/I` of its prime subfield. @@ -3376,7 +3367,7 @@ def __call__(self, x): INPUT: - x -- an element of the field + - ``x`` -- an element of the field EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py index 2f04cf27660..0a1557110fe 100644 --- a/src/sage/rings/number_field/number_field_ideal_rel.py +++ b/src/sage/rings/number_field/number_field_ideal_rel.py @@ -139,7 +139,8 @@ def absolute_ideal(self, names='a'): INPUT: - - ``names`` (optional) -- string; name of generator of the absolute field + - ``names`` -- (optional) string; name of generator of the absolute + field EXAMPLES:: @@ -249,7 +250,6 @@ def free_module(self): ... sage: I.free_module().is_submodule(K.maximal_order().free_module()) True - """ return self.absolute_ideal().free_module() @@ -659,7 +659,7 @@ def is_integral(self): def absolute_ramification_index(self): """ Return the absolute ramification index of this fractional ideal, - assuming it is prime. Otherwise, raise a :class:`ValueError`. + assuming it is prime. Otherwise, raise a :exc:`ValueError`. The absolute ramification index is the power of this prime appearing in the factorization of the rational prime that @@ -690,7 +690,7 @@ def absolute_ramification_index(self): def relative_ramification_index(self): """ Return the relative ramification index of this fractional ideal, - assuming it is prime. Otherwise, raise a :class:`ValueError`. + assuming it is prime. Otherwise, raise a :exc:`ValueError`. The relative ramification index is the power of this prime appearing in the factorization of the prime ideal of the @@ -760,7 +760,8 @@ def residue_class_degree(self): def residues(self): """ - Returns a iterator through a complete list of residues modulo this integral ideal. + Return a iterator through a complete list of residues modulo this + integral ideal. An error is raised if this fractional ideal is not integral. @@ -784,19 +785,20 @@ def residues(self): def element_1_mod(self, other): r""" - Returns an element `r` in this ideal such that `1-r` is in ``other``. + Return an element `r` in this ideal such that `1-r` is in ``other``. An error is raised if either ideal is not integral of if they are not coprime. INPUT: - - ``other`` -- another ideal of the same field, or generators of an ideal. + - ``other`` -- another ideal of the same field, or generators of an + ideal OUTPUT: - an element `r` of the ideal self such that `1-r` is in the - ideal ``other``. + an element `r` of the ideal ``self`` such that `1-r` is in the ideal + ``other``. EXAMPLES:: @@ -827,7 +829,7 @@ def element_1_mod(self, other): def smallest_integer(self): r""" - Return the smallest non-negative integer in `I \cap \ZZ`, where `I` is + Return the smallest nonnegative integer in `I \cap \ZZ`, where `I` is this ideal. If `I = 0`, returns `0`. EXAMPLES:: @@ -848,14 +850,13 @@ def valuation(self, p): INPUT: - - ``p`` -- a prime ideal `\mathfrak{p}` of this relative number field. + - ``p`` -- a prime ideal `\mathfrak{p}` of this relative number field OUTPUT: (integer) The valuation of this fractional ideal at the prime `\mathfrak{p}`. If `\mathfrak{p}` is not prime, raise a - :class:`ValueError`. - + :exc:`ValueError`. EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_morphisms.pyx b/src/sage/rings/number_field/number_field_morphisms.pyx index ffee312cc8f..5b1836f584b 100644 --- a/src/sage/rings/number_field/number_field_morphisms.pyx +++ b/src/sage/rings/number_field/number_field_morphisms.pyx @@ -68,7 +68,7 @@ cdef class NumberFieldEmbedding(Morphism): INPUT: - - ``_slots`` -- a dictionary + - ``_slots`` -- dictionary OUTPUT: the given dictionary, with the generator image added @@ -97,7 +97,7 @@ cdef class NumberFieldEmbedding(Morphism): INPUT: - - ``_slots`` -- a dictionary providing values for the c(p)def slots of self. + - ``_slots`` -- dictionary providing values for the c(p)def slots of ``self`` EXAMPLES:: @@ -189,7 +189,6 @@ cdef class EmbeddedNumberFieldMorphism(NumberFieldEmbedding): From: Number Field in i with defining polynomial x^2 + 1 with i = I To: Number Field in i with defining polynomial x^2 + 1 with i = -I Defn: i -> -i - """ cdef readonly ambient_field @@ -237,7 +236,6 @@ cdef class EmbeddedNumberFieldMorphism(NumberFieldEmbedding): Traceback (most recent call last): ... TypeError: No embedding available for Number Field in i with defining polynomial x^2 + 1 - """ if ambient_field is None: if K.coerce_embedding() is None: @@ -486,7 +484,6 @@ def root_from_approx(f, a): Traceback (most recent call last): ... ValueError: sqrt(3) is not a root of x^2 - 2 - """ P = a.parent() if P.is_exact() and not f(a): @@ -632,7 +629,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): INPUT: - - ``_slots`` -- a dictionary + - ``_slots`` -- dictionary OUTPUT: the given dictionary, with _gen_image and ratio added @@ -661,7 +658,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): INPUT: - - ``_slots`` -- a dictionary providing values for the c(p)def slots of self. + - ``_slots`` -- dictionary providing values for the c(p)def slots of ``self`` EXAMPLES:: diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py index 8dfccfab45d..b85d4579c49 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -149,14 +149,14 @@ class NumberField_relative(NumberField_generic): - ``base`` -- the base field - ``polynomial`` -- a polynomial which must be defined in the ring `K[x]`, - where `K` is the base field. + where `K` is the base field - - ``name`` -- a string, the variable name + - ``name`` -- string; the variable name - - ``latex_name`` -- a string or ``None`` (default: ``None``), variable name + - ``latex_name`` -- string or ``None`` (default: ``None``); variable name for latex printing - - ``check`` -- a boolean (default: ``True``), whether to check + - ``check`` -- boolean (default: ``True``); whether to check irreducibility of ``polynomial`` - ``embedding`` -- currently not supported, must be ``None`` @@ -349,7 +349,7 @@ def change_names(self, names): Also, ``K.structure()`` returns ``from_K`` and ``to_K``, where ``from_K`` is an isomorphism from `K` to ``self`` and ``to_K`` is an - isomorphism from self to `K`. + isomorphism from ``self`` to `K`. EXAMPLES:: @@ -513,7 +513,6 @@ def gens(self): (a0, 0) sage: NumberField([x, x^2 - 3], 'a').gens() (0, a1) - """ return ((self._gen_relative(),) + tuple(map(self, self.base_field().gens()))) @@ -564,7 +563,7 @@ def ngens(self): def gen(self, n=0): """ - Return the `n`'th generator of this relative number field. + Return the `n`-th generator of this relative number field. EXAMPLES:: @@ -612,14 +611,15 @@ def composite_fields(self, other, names=None, both_maps=False, preserve_embeddin - ``names`` -- generator name for composite fields - - ``both_maps`` -- (default: ``False``) if ``True``, return quadruples - (`F`, ``self_into_F, ``other_into_F``, `k`) such that ``self_into_F`` maps ``self`` into - `F`, ``other_into_F`` maps ``other`` into `F`. For relative number fields, `k` is - always ``None``. + - ``both_maps`` -- boolean (default: ``False``); if ``True``, return + quadruples (`F`, ``self_into_F, ``other_into_F``, `k`) such that + ``self_into_F`` maps ``self`` into `F`, ``other_into_F`` maps + ``other`` into `F`. For relative number fields, `k` is always + ``None``. - - ``preserve_embedding`` -- (default: ``True``) has no effect, but is kept - for compatibility with the absolute version of this method. In every - case the list of all possible compositums is returned. + - ``preserve_embedding`` -- boolean (default: ``True``); has no effect, + but is kept for compatibility with the absolute version of this, + method. In every case the list of all possible compositums is returned. OUTPUT: list of the composite fields, possibly with maps @@ -698,7 +698,7 @@ def absolute_degree(self): def relative_degree(self): r""" - Returns the relative degree of this relative number field. + Return the relative degree of this relative number field. EXAMPLES:: @@ -730,7 +730,7 @@ def degree(self): @cached_method def _maximal_order(self, v=(), assume_maximal='non-maximal-non-unique'): """ - Implements :meth:`NumberField_generic.maximal_order` for relative + Implement :meth:`NumberField_generic.maximal_order` for relative number fields. EXAMPLES:: @@ -739,7 +739,6 @@ def _maximal_order(self, v=(), assume_maximal='non-maximal-non-unique'): sage: K. = NumberFieldTower([x^2 - 17, x^3 - 2]) sage: K.maximal_order() is K.maximal_order() # indirect doctest True - """ absolute_order = self.absolute_field('z').maximal_order(v=v, assume_maximal=assume_maximal) @@ -845,7 +844,7 @@ def _convert_non_number_field_element(self, x): INPUT: - ``x`` -- a non number field element, e.g., a list, - integer, rational, or polynomial. + integer, rational, or polynomial EXAMPLES:: @@ -1154,8 +1153,8 @@ def _pari_base_bnf(self, proof=False, units=True): INPUT: - - ``proof`` (bool, default: ``True``) -- if True, certify - correctness of calculations (not assuming GRH). + - ``proof`` -- boolean (default: ``True``); if ``True``, certify + correctness of calculations (not assuming GRH) EXAMPLES:: @@ -1245,7 +1244,6 @@ def is_galois_absolute(self): sage: y = polygen(K); L. = K.extension(y^2 - a) sage: L.is_galois_absolute() # needs sage.groups False - """ f = self.absolute_polynomial() return f.galois_group(pari_group=True).order() == self.absolute_degree() @@ -1298,7 +1296,8 @@ def is_isomorphic_relative(self, other, base_isom=None): sage: L2.is_isomorphic_relative(L1cyc, base_isom=phi2) True - Omitting ``base_isom`` raises a :class:`ValueError` when the base fields are not identical:: + Omitting ``base_isom`` raises a :exc:`ValueError` when the base fields + are not identical:: sage: L1.is_isomorphic_relative(L1cyc) Traceback (most recent call last): @@ -1367,7 +1366,6 @@ def is_CM_extension(self): False sage: K.is_CM() True - """ try: @@ -1397,7 +1395,8 @@ def free_module(self, base=None, basis=None, map=True): - ``basis`` -- (optional) a list of elements giving a basis over the subfield - - ``map`` -- (default ``True``) whether to return isomorphisms to and from the vector space + - ``map`` -- (default: ``True``) whether to return isomorphisms to and + from the vector space EXAMPLES:: @@ -1515,7 +1514,6 @@ def vector_space(self, *args, **kwds): ... NotImplementedError: For a relative number field L you must use either L.relative_vector_space() or L.absolute_vector_space() as appropriate - """ raise NotImplementedError("For a relative number field L you must use either L.relative_vector_space() or L.absolute_vector_space() as appropriate") @@ -1609,7 +1607,7 @@ def _pari_relative_structure(self): field, and let `f` be the defining polynomial of `L` over `K`. This method returns a triple ``(g, alpha, beta)``, where - - ``g`` is the defining relative polynomial of the PARI + - ``g`` -- the defining relative polynomial of the PARI ``rnf`` structure (see :meth:`pari_rnf`); - ``alpha`` is the image of `x \bmod f` under some isomorphism @@ -2042,7 +2040,7 @@ def embeddings(self, K): e.g., it could be the complex numbers). This will return an identical result when given `K` as input again. - If possible, the most natural embedding of self into `K` + If possible, the most natural embedding of ``self`` into `K` is put first in the list. INPUT: @@ -2186,7 +2184,7 @@ def logarithmic_embedding(self, prec=53): INPUT: - - ``prec`` -- desired floating point precision. + - ``prec`` -- desired floating point precision OUTPUT: the morphism of ``self`` under the logarithmic embedding in the category Set @@ -2352,7 +2350,7 @@ def absolute_discriminant(self, v=None): INPUT: - - ``v`` (optional) -- list of element of this relative number field. + - ``v`` -- (optional) list of element of this relative number field OUTPUT: integer if ``v`` is omitted, and Rational otherwise @@ -2454,14 +2452,14 @@ def order(self, *gens, **kwds): - ``gens`` -- list of elements of ``self``; if no generators are given, just returns the cardinality of this number field (`\infty`) for consistency. - - ``check_is_integral`` -- bool (default: ``True``), whether to check that each - generator is integral. - - ``check_rank`` -- bool (default: ``True``), whether to check that the ring - generated by ``gens`` is of full rank. - - ``allow_subfield`` -- bool (default: ``False``), if ``True`` and the generators - do not generate an order, i.e., they generate a subring of smaller - rank, instead of raising an error, return an order in a smaller - number field. + - ``check_is_integral`` -- boolean (default: ``True``); whether to + check that each generator is integral + - ``check_rank`` -- boolean (default: ``True``); whether to check that + the ring generated by ``gens`` is of full rank + - ``allow_subfield`` -- boolean (default: ``False``); if ``True`` and + the generators do not generate an order, i.e., they generate a + subring of smaller rank, instead of raising an error, return an order + in a smaller number field. The ``check_is_integral`` and ``check_rank`` inputs must be given as explicit keyword arguments. @@ -2506,7 +2504,7 @@ def is_free(self, proof=None): INPUT: - - ``proof`` -- default: ``True`` + - ``proof`` -- (default: ``True``) EXAMPLES:: @@ -2547,7 +2545,7 @@ def _factor_univariate_polynomial(self, poly, **kwargs): def lift_to_base(self, element): """ Lift an element of this extension into the base field if possible, - or raise a :class:`ValueError` if it is not possible. + or raise a :exc:`ValueError` if it is not possible. EXAMPLES:: @@ -2605,7 +2603,7 @@ def relativize(self, alpha, names): INPUT: - ``alpha`` -- an element of ``self``, or an embedding of a subfield into ``self`` - - ``names`` -- name of generator for output field `K`. + - ``names`` -- name of generator for output field `K` OUTPUT: `K` -- a relative number field @@ -2691,20 +2689,20 @@ def relativize(self, alpha, names): L = K.relativize(beta, names) return K.relativize(beta, names, structure=structure.RelativeFromRelative(L)) - def uniformizer(self, P, others="positive"): + def uniformizer(self, P, others='positive'): """ - Returns an element of ``self`` with valuation 1 at the prime ideal `P`. + Return an element of ``self`` with valuation 1 at the prime ideal `P`. INPUT: - - ``self`` -- a number field + - ``self`` -- a number field - - ``P`` -- a prime ideal of ``self`` + - ``P`` -- a prime ideal of ``self`` - - ``others`` -- either ``"positive"`` (default), in which - case the element will have non-negative valuation at all other - primes of ``self``, or ``"negative"``, in which case the element will have - non-positive valuation at all other primes of ``self``. + - ``others`` -- either ``'positive'`` (default), in which case the + element will have nonnegative valuation at all other primes of + ``self``, or ``'negative'``, in which case the element will have + nonpositive valuation at all other primes of ``self`` .. note:: diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py index 2b39b2ebb8c..4f54fa497f3 100644 --- a/src/sage/rings/number_field/order.py +++ b/src/sage/rings/number_field/order.py @@ -126,7 +126,6 @@ class OrderFactory(UniqueFactory): sage: from sage.rings.number_field.order import AbsoluteOrder, OrderFactory sage: isinstance(AbsoluteOrder, OrderFactory) True - """ def get_object(self, version, key, extra_args): @@ -158,7 +157,6 @@ def get_object(self, version, key, extra_args): True sage: N._is_maximal_at(3) True - """ is_maximal = extra_args.pop("is_maximal", None) is_maximal_at = extra_args.pop("is_maximal_at", {}) @@ -210,7 +208,6 @@ def create_key_and_extra_args(self, K, module_rep, is_maximal=None, check=True, Note how the above is lacking the ``is_maximal`` and ``is_maximal_at`` keywords. These are stripped by :meth:`OrderFactory.get_object` and then put back in by :meth:`reduce_data`. - """ if check: if not K.is_absolute(): @@ -238,7 +235,6 @@ def create_object(self, version, key, is_maximal=None, is_maximal_at=()): sage: OK = K.order(i) sage: loads(dumps(OK)) is OK True - """ K, module_rep = key @@ -272,7 +268,6 @@ def reduce_data(self, order): sage: loads(dumps(N)) is O True - """ reduction = super().reduce_data(order) reduction[1][3]["is_maximal"] = order._is_maximal() @@ -322,7 +317,6 @@ def create_key_and_extra_args(self, K, absolute_order, is_maximal=None, check=Tr keywords. These are stripped by :meth:`OrderFactory.get_object`. Since they are applied to the underlying absolute order, they then get pickled when the underlying order is pickled. - """ return (K, absolute_order), {"is_maximal": is_maximal, "is_maximal_at": {p: True for p in is_maximal_at}} @@ -341,7 +335,6 @@ def create_object(self, version, key, is_maximal=None, is_maximal_at=()): sage: OK = L.order([i, j]) sage: loads(dumps(OK)) is OK True - """ K, absolute_order = key @@ -582,7 +575,7 @@ def _coerce_map_from_(self, R): def __mul__(self, right): """ - Create an ideal in this order using the syntax ``O * gens`` + Create an ideal in this order using the syntax ``O * gens``. EXAMPLES:: @@ -638,7 +631,7 @@ def is_field(self, proof=True): def is_noetherian(self): r""" - Return ``True`` (because orders are always Noetherian) + Return ``True`` (because orders are always Noetherian). EXAMPLES:: @@ -713,7 +706,7 @@ def integral_closure(self): def gen(self, i): r""" - Return `i`'th module generator of this order. + Return `i`-th module generator of this order. EXAMPLES:: @@ -776,7 +769,7 @@ def coordinates(self, x): INPUT: - - ``x`` -- an element of the number field of this order. + - ``x`` -- an element of the number field of this order OUTPUT: @@ -817,7 +810,6 @@ def coordinates(self, x): (23, -14/3) sage: sum([O.basis()[j]*acoords[j] for j in range(2)]) == a True - """ K = self.number_field() V, from_V, to_V = K.absolute_vector_space() @@ -1018,9 +1010,9 @@ def residue_field(self, prime, names=None, check=False): INPUT: - - ``prime`` -- a prime ideal of the maximal order in this number field. - - ``names`` -- the name of the variable in the residue field. - - ``check`` -- whether or not to check the primality of prime. + - ``prime`` -- a prime ideal of the maximal order in this number field + - ``names`` -- the name of the variable in the residue field + - ``check`` -- whether or not to check the primality of prime OUTPUT: the residue field at this prime @@ -1335,7 +1327,7 @@ def random_element(self, *args, **kwds): sage: OK = K.ring_of_integers() sage: OK.random_element() # random output -2*a^2 - a - 2 - sage: OK.random_element(distribution="uniform") # random output + sage: OK.random_element(distribution='uniform') # random output -a^2 - 1 sage: OK.random_element(-10,10) # random output -10*a^2 - 9*a - 2 @@ -1457,7 +1449,6 @@ def valuation(self, p): :meth:`NumberField_generic.valuation() `, :meth:`pAdicGeneric.valuation() ` - """ from sage.rings.padics.padic_valuation import pAdicValuation return pAdicValuation(self, p) @@ -1492,7 +1483,6 @@ def some_elements(self): Maximal Order generated by [] in Number Field in a with defining polynomial t sage: Z.some_elements() [1, 0, 2, -1, -2, 4] - """ elements = list(self.basis()) for a in self.fraction_field().some_elements(): @@ -1561,7 +1551,6 @@ def __init__(self, K, module_rep): sage: loads(dumps(O)) is O True sage: TestSuite(O).run() - """ if K.degree() == 2: self._element_type = OrderElement_quadratic @@ -1610,7 +1599,6 @@ def _element_constructor_(self, x): 10/3*a^2 + 7/3*a + 1/3 sage: K([1,2,3]) 3*a^2 + 2*a + 1 - """ if isinstance(x, (tuple, list)): x = sum(xi*gi for xi, gi in zip(x, self.gens())) @@ -1683,7 +1671,6 @@ def __and__(left, right): Maximal Order generated by [7/12*z^3 + 3/4*z^2 + 1/12*z + 1/4, 1/6*z^3 + 1/6*z, z^2] in Number Field in z with defining polynomial x^4 - 2*x^2 + 9 sage: L.maximal_order() & L.absolute_field('z').maximal_order() Maximal Order generated by [7/12*z^3 + 3/4*z^2 + 1/12*z + 1/4, 1/6*z^3 + 1/6*z, z^2] in Number Field in z with defining polynomial x^4 - 2*x^2 + 9 - """ if isinstance(right, Order_relative): return right & left @@ -1771,8 +1758,8 @@ def is_maximal(self, p=None): INPUT: - - ``p`` -- an integer prime or ``None`` (default: ``None``); if - set, return whether this order is maximal at the prime `p`. + - ``p`` -- integer prime or ``None`` (default: ``None``); if + set, return whether this order is maximal at the prime `p` EXAMPLES:: @@ -1805,7 +1792,6 @@ def is_maximal(self, p=None): sage: O = K.order([3*a, 2*b]) sage: O.is_maximal() False - """ if self._is_maximal() is True: return True @@ -1838,7 +1824,6 @@ def _is_maximal(self): False sage: K.order(1337*t)._is_maximal() False - """ return self.__is_maximal @@ -1873,7 +1858,6 @@ def _is_maximal_at(self, p=None): sage: O = K.maximal_order([13], assume_maximal=None) sage: O._is_maximal_at() {13: True} - """ if p is None: return dict(self.__is_maximal_at) @@ -1921,7 +1905,7 @@ def _assume_maximal(self, is_maximal=True, p=None): sage: O = K.order(1+i) sage: O.is_maximal() True - sage: N = O._assume_maximal(is_maximal="non-maximal-non-unique") + sage: N = O._assume_maximal(is_maximal='non-maximal-non-unique') sage: N._assume_maximal(p=2) is N True sage: N is O @@ -1932,7 +1916,6 @@ def _assume_maximal(self, is_maximal=True, p=None): False sage: N.is_maximal(p=2) True - """ if is_maximal is None: # No assumption made, return the object unchanged. @@ -2003,7 +1986,7 @@ def index_in(self, other): INPUT: - - ``other`` -- another absolute order with the same ambient number field. + - ``other`` -- another absolute order with the same ambient number field OUTPUT: a rational number @@ -2208,7 +2191,6 @@ def __init__(self, K, absolute_order): sage: loads(dumps(O)) is O True sage: TestSuite(O).run() - """ self._absolute_order = absolute_order self._module_rep = absolute_order._module_rep @@ -2287,7 +2269,8 @@ def absolute_order(self, names='z'): INPUT: - - ``names`` -- string (default: 'z'); name of generator of absolute extension. + - ``names`` -- string (default: ``'z'``); name of generator of absolute + extension .. note:: @@ -2414,7 +2397,6 @@ def __and__(left, right): sage: (L.maximal_order() & L.maximal_order()).is_maximal() True - """ if isinstance(right, Order_absolute): return left._absolute_order & right @@ -2433,8 +2415,8 @@ def is_maximal(self, p=None): INPUT: - - ``p`` -- an integer prime or ``None`` (default: ``None``); if - set, return whether this order is maximal at the prime `p`. + - ``p`` -- integer prime or ``None`` (default: ``None``); if + set, return whether this order is maximal at the prime `p` EXAMPLES:: @@ -2460,7 +2442,6 @@ def is_maximal(self, p=None): sage: K.order(3*a, b).is_maximal(p=3) False - """ return self._absolute_order.is_maximal(p=p) @@ -2479,7 +2460,6 @@ def _is_maximal(self): False sage: O._is_maximal() False - """ return self._absolute_order._is_maximal() @@ -2504,7 +2484,6 @@ def _is_maximal_at(self, p=None): True sage: O._is_maximal_at() {2: True, 3: True, 5: True, 7: True} - """ return self._absolute_order._is_maximal_at(p=p) @@ -2548,7 +2527,7 @@ def _assume_maximal(self, is_maximal=True, p=None): sage: O = L.maximal_order([2, 3], assume_maximal=None) sage: O.is_maximal() True - sage: N = O._assume_maximal(is_maximal="non-maximal-non-unique") + sage: N = O._assume_maximal(is_maximal='non-maximal-non-unique') sage: N._assume_maximal(p=2) is N True sage: N is O @@ -2559,7 +2538,6 @@ def _assume_maximal(self, is_maximal=True, p=None): False sage: N.is_maximal(p=2) True - """ absolute_order = self._absolute_order._assume_maximal(is_maximal=is_maximal, p=p) if absolute_order is not self._absolute_order: @@ -2620,7 +2598,7 @@ def index_in(self, other): INPUT: - - ``other`` -- another order with the same ambient absolute number field. + - ``other`` -- another order with the same ambient absolute number field OUTPUT: a rational number @@ -2664,16 +2642,17 @@ def absolute_order_from_ring_generators(gens, check_is_integral=True, """ INPUT: - - ``gens`` -- list of integral elements of an absolute order. - - ``check_is_integral`` -- bool (default: ``True``), whether to check that each - generator is integral. - - ``check_rank`` -- bool (default: ``True``), whether to check that the ring - generated by ``gens`` is of full rank. - - ``is_maximal`` -- bool (or ``None``); set if maximality of the generated order is - known - - ``allow_subfield`` -- bool (default: ``False``), if ``True`` and the generators do - not generate an order, i.e., they generate a subring of smaller rank, - instead of raising an error, return an order in a smaller number field. + - ``gens`` -- list of integral elements of an absolute order + - ``check_is_integral`` -- boolean (default: ``True``); whether to check + that each generator is integral + - ``check_rank`` -- boolean (default: ``True``); whether to check that the + ring generated by ``gens`` is of full rank + - ``is_maximal`` -- boolean (or ``None``); set if maximality of the + generated order is known + - ``allow_subfield`` -- boolean (default: ``False``); if ``True`` and the + generators do not generate an order, i.e., they generate a subring of + smaller rank, instead of raising an error, return an order in a smaller + number field EXAMPLES:: @@ -2736,13 +2715,16 @@ def absolute_order_from_module_generators(gens, INPUT: - ``gens`` -- list of elements of an absolute number field that generates an - order in that number field as a `\ZZ`-*module*. + order in that number field as a `\ZZ`-*module* - ``check_integral`` -- check that each generator is integral - - ``check_rank`` -- check that the ``gens`` span a module of the correct rank + - ``check_rank`` -- check that the ``gens`` span a module of the correct + rank - ``check_is_ring`` -- check that the module is closed under multiplication (this is very expensive) - - ``is_maximal`` -- bool (or ``None``); set if maximality of the generated order is known - - ``is_maximal_at`` -- a tuple of primes where this order is known to be maximal + - ``is_maximal`` -- boolean (or ``None``); set if maximality of the + generated order is known + - ``is_maximal_at`` -- tuple of primes where this order is known to be + maximal OUTPUT: an absolute order @@ -2886,13 +2868,13 @@ def relative_order_from_ring_generators(gens, """ INPUT: - - ``gens`` -- list of integral elements of an absolute order. - - ``check_is_integral`` -- bool (default: ``True``), whether to check that each - generator is integral. - - ``check_rank`` -- bool (default: ``True``), whether to check that the ring - generated by ``gens`` is of full rank. - - ``is_maximal`` -- bool (or ``None``); set if maximality of the generated order is - known. + - ``gens`` -- list of integral elements of an absolute order + - ``check_is_integral`` -- boolean (default: ``True``); whether to check + that each generator is integral + - ``check_rank`` -- boolean (default: ``True``); whether to check that the + ring generated by ``gens`` is of full rank + - ``is_maximal`` -- boolean (or ``None``); set if maximality of the + generated order is known EXAMPLES: @@ -2938,7 +2920,7 @@ def relative_order_from_ring_generators(gens, return RelativeOrder(K, abs_order, check=False) -def GaussianIntegers(names="I", latex_name="i"): +def GaussianIntegers(names='I', latex_name='i'): r""" Return the ring of Gaussian integers. @@ -2966,7 +2948,7 @@ def GaussianIntegers(names="I", latex_name="i"): return nf.ring_of_integers() -def EisensteinIntegers(names="omega"): +def EisensteinIntegers(names='omega'): r""" Return the ring of Eisenstein integers. diff --git a/src/sage/rings/number_field/order_ideal.py b/src/sage/rings/number_field/order_ideal.py index e1dc02e94cb..0f0b2f5d524 100644 --- a/src/sage/rings/number_field/order_ideal.py +++ b/src/sage/rings/number_field/order_ideal.py @@ -567,7 +567,7 @@ def is_equivalent(self, other, narrow=False): If ``narrow`` is ``True``, test narrow equivalence instead. (Two ideals are equivalent if they differ by multiplication - by a non-zero element. They are narrowly equivalent if they + by a nonzero element. They are narrowly equivalent if they differ by multiplication by an element of positive norm.) EXAMPLES:: diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py index f10fad4b988..e2e5b448519 100644 --- a/src/sage/rings/number_field/selmer_group.py +++ b/src/sage/rings/number_field/selmer_group.py @@ -19,8 +19,8 @@ where `O^*_{K,S}` is the group of `S`-units of `K` and `Cl_{K,S}` the `S`-class group. When `m=p` is prime, `K(S,p)` is a finite-dimensional vector space over `GF(p)`. Its generators come -from three sources: units (modulo `p`'th powers); generators of the -`p`'th powers of ideals which are not principal but whose `p`'the +from three sources: units (modulo `p`-th powers); generators of the +`p`-th powers of ideals which are not principal but whose `p`'the powers are principal; and generators coming from the prime ideals in `S`. @@ -57,8 +57,8 @@ def _ideal_generator(I): INPUT: - - ``I`` (fractional ideal or integer) -- either a fractional ideal of a - number field, which must be principal, or a rational integer. + - ``I`` -- either a fractional ideal of a number field, which must be + principal, or a rational integer OUTPUT: a generator of `I` when `I` is a principal ideal, else `I` itself @@ -71,7 +71,6 @@ def _ideal_generator(I): sage: K. = QuadraticField(-11) sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)] [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2] - """ try: return I.gens_reduced()[0] @@ -85,12 +84,12 @@ def _coords_in_C_p(I, C, p): INPUT: - - ``I`` (ideal) -- a fractional ideal of a number field ``K``, - whose ``p``'th power is principal. + - ``I`` -- ideal; a fractional ideal of a number field ``K``, whose + ``p``-th power is principal - - ``C`` (class group) -- the ideal class group of ``K``. + - ``C`` -- (class group) the ideal class group of ``K`` - - ``p`` (prime) -- a prime number. + - ``p`` -- prime number OUTPUT: @@ -121,7 +120,6 @@ def _coords_in_C_p(I, C, p): Traceback (most recent call last): ... ValueError: The 3rd power of Fractional ideal (2, a + 1) is not principal - """ cyclic_orders = C.gens_orders() non_p_indices = [i for i,n in enumerate(cyclic_orders) if not p.divides(n)] @@ -139,11 +137,11 @@ def _coords_in_C_mod_p(I,C,p): INPUT: - - ``I`` (ideal) -- a fractional ideal of a number field ``K``. + - ``I`` -- ideal; a fractional ideal of a number field ``K`` - - ``C`` (class group) -- the ideal class group of ``K``. + - ``C`` -- (class group) the ideal class group of ``K`` - - ``p`` (prime) -- a prime number. + - ``p`` -- prime number OUTPUT: @@ -177,7 +175,6 @@ def _coords_in_C_mod_p(I,C,p): [[1, 0], [1, 1], [1, 1], [0, 1], [1, 0], [0, 1], [0, 0], [0, 1], [0, 0]] sage: [_coords_in_C_mod_p(K.prime_above(p), C, 3) for p in primes(25)] [[2], [0], [1], [0], [0], [1], [0], [2], [0]] - """ cyclic_orders = C.gens_orders() p_indices = [i for i, n in enumerate(cyclic_orders) if p.divides(n)] @@ -186,16 +183,16 @@ def _coords_in_C_mod_p(I,C,p): def _root_ideal(I, C, p): r""" - Return a ``p``'th root of an ideal with respect to the class group. + Return a ``p``-th root of an ideal with respect to the class group. INPUT: - - ``I`` (ideal) -- a fractional ideal of a number field ``K``, - whose ideal class is a ``p``'th power. + - ``I`` -- ideal; a fractional ideal of a number field ``K``, + whose ideal class is a ``p``-th power - - ``C`` (class group) -- the ideal class group of ``K``. + - ``C`` -- (class group) the ideal class group of ``K`` - - ``p`` (prime) -- a prime number. + - ``p`` -- prime number OUTPUT: an ideal `J` such that `J^p` is in the same ideal class as `I` @@ -218,7 +215,6 @@ def _root_ideal(I, C, p): sage: J = _root_ideal(I, C, 3) sage: C(J^3) == C(I) True - """ cyclic_orders = C.gens_orders() cyclic_gens = C.gens_ideals() @@ -241,11 +237,11 @@ def coords_in_U_mod_p(u, U, p): INPUT: - - ``u`` (algebraic unit) -- a unit in a number field ``K``. + - ``u`` -- (algebraic unit) a unit in a number field ``K`` - - ``U`` (unit group) -- the unit group of ``K``. + - ``U`` -- (unit group) the unit group of ``K`` - - ``p`` (prime) -- a prime number. + - ``p`` -- prime number OUTPUT: @@ -276,7 +272,6 @@ def coords_in_U_mod_p(u, U, p): [1, 1, 0, 1] sage: coords_in_U_mod_p(u,U,3) [1, 2, 0] - """ coords = U.log(u) start = 1 - int(p.divides(U.zeta_order())) # 0 or 1 @@ -285,17 +280,17 @@ def coords_in_U_mod_p(u, U, p): def basis_for_p_cokernel(S, C, p): r""" Return a basis for the group of ideals supported on ``S`` (mod - ``p``'th-powers) whose class in the class group ``C`` is a ``p``'th power, + ``p``'th-powers) whose class in the class group ``C`` is a ``p``-th power, together with a function which takes the ``S``-exponents of such an ideal and returns its coordinates on this basis. INPUT: - - ``S`` (list) -- a list of prime ideals in a number field ``K``. + - ``S`` -- list of prime ideals in a number field ``K`` - - ``C`` (class group) -- the ideal class group of ``K``. + - ``C`` -- (class group) the ideal class group of ``K`` - - ``p`` (prime) -- a prime number. + - ``p`` -- prime number OUTPUT: @@ -337,7 +332,6 @@ class is a ``p``'th power; Fractional ideal (3, a + 1), Fractional ideal (5, a + 1), Fractional ideal (5, a + 3)] - """ from sage.matrix.constructor import Matrix M = Matrix(GF(p), [_coords_in_C_mod_p(P, C, p) for P in S]) @@ -356,18 +350,18 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): INPUT: - - ``K`` -- a number field or `\QQ`. + - ``K`` -- a number field or `\QQ` - - ``S`` -- a list of prime ideals in `K`, or prime - numbers when `K` is `\QQ`. + - ``S`` -- list of prime ideals in `K`, or prime + numbers when `K` is `\QQ` - - ``p`` -- a prime number. + - ``p`` -- a prime number - ``proof`` -- if ``True``, compute the class group provably correctly. Default is ``True``. Call :meth:`proof.number_field` to change this default globally. - - ``debug`` -- (boolean, default ``False``) debug flag. + - ``debug`` -- boolean (default: ``False``); debug flag OUTPUT: @@ -397,14 +391,14 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): of the group of roots of unity if its order is divisible by `p`. These have valuation `0` at all primes. - - ``betalist`` is a list of the generators of the `p`'th powers of + - ``betalist`` is a list of the generators of the `p`-th powers of ideals which generate the `p`-torsion in the class group (so is empty if the class number is prime to `p`). These have valuation divisible by `p` at all primes. - ``alphalist`` is a list of generators for each ideal `A` in a - basis of those ideals supported on `S` (modulo `p`'th powers of - ideals) which are `p`'th powers in the class group. We find `B` + basis of those ideals supported on `S` (modulo `p`-th powers of + ideals) which are `p`-th powers in the class group. We find `B` such that `A/B^p` is principal and take a generator of it, for each `A` in a generating set. As a special case, if all the ideals in `S` are principal then ``alphalist`` is a list of @@ -413,12 +407,12 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): The map from the abstract space to `K^*` is easy: we just take the product of the generators to powers given by the coefficient vector. No attempt is made to reduce the resulting product modulo - `p`'th powers. + `p`-th powers. The reverse map is more complicated. Given `a\in K^*`: - write the principal ideal `(a)` in the form `AB^p` with `A` - supported by `S` and `p`'th power free. If this fails, then `a` + supported by `S` and `p`-th power free. If this fails, then `a` does not represent an element of `K(S,p)` and an error is raised. @@ -431,7 +425,7 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): ``alphalist``. - after dividing out by `A`, now `(a)=B^p` (with a different `a` - and `B`). Write the ideal class `[B]`, whose `p`'th power is + and `B`). Write the ideal class `[B]`, whose `p`-th power is trivial, in terms of the generators of `C[p]`; then `B=(b)B_1`, where the coefficients of `B_1` with respect to generators of `C[p]` give the coordinates of the result with respect to the diff --git a/src/sage/rings/number_field/small_primes_of_degree_one.py b/src/sage/rings/number_field/small_primes_of_degree_one.py index fe456005fed..e7e66f43d02 100644 --- a/src/sage/rings/number_field/small_primes_of_degree_one.py +++ b/src/sage/rings/number_field/small_primes_of_degree_one.py @@ -102,17 +102,15 @@ class Small_primes_of_degree_one_iter(): INPUT: - - ``field`` -- a :class:`NumberField`. + - ``field`` -- a :class:`NumberField` - - ``num_integer_primes`` -- (default: 10000) an integer. We try to find - primes of absolute norm no greater than the - ``num_integer_primes``-th prime number. For example, if - ``num_integer_primes`` is 2, the largest norm found will be 3, since - the second prime is 3. + - ``num_integer_primes`` -- integer (default: 10000); we try to find + primes of absolute norm no greater than the ``num_integer_primes``-th + prime number. For example, if ``num_integer_primes`` is 2, the largest + norm found will be 3, since the second prime is 3. - - ``max_iterations`` -- (default: 100) an integer. We test - ``max_iterations`` integers to find small primes before raising - :class:`StopIteration`. + - ``max_iterations`` -- integer (default: 100); we test ``max_iterations`` + integers to find small primes before raising :class:`StopIteration` AUTHOR: @@ -145,7 +143,7 @@ def __init__(self, field, num_integer_primes=10000, max_iterations=100): def __iter__(self): r""" - Return self as an iterator. + Return ``self`` as an iterator. EXAMPLES:: diff --git a/src/sage/rings/number_field/splitting_field.py b/src/sage/rings/number_field/splitting_field.py index 7fefcd02ce5..28c5486f171 100644 --- a/src/sage/rings/number_field/splitting_field.py +++ b/src/sage/rings/number_field/splitting_field.py @@ -90,7 +90,7 @@ def key(self): def poldegree(self): """ - Return the degree of ``self.pol`` + Return the degree of ``self.pol``. EXAMPLES:: @@ -132,7 +132,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No - ``name`` -- a variable name for the number field - - ``map`` -- (default: ``False``) also return an embedding of + - ``map`` -- boolean (default: ``False``); also return an embedding of ``poly`` into the resulting field. Note that computing this embedding might be expensive. @@ -144,14 +144,14 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No if it can be determined that the absolute degree of the splitting field is strictly larger than ``abort_degree``. - - ``simplify`` -- (default: ``True``) during the algorithm, try + - ``simplify`` -- boolean (default: ``True``); during the algorithm, try to find a simpler defining polynomial for the intermediate number fields using PARI's ``polredbest()``. This usually speeds up the computation but can also considerably slow it down. Try and see what works best in the given situation. - - ``simplify_all`` -- (default: ``False``) If ``True``, simplify - intermediate fields and also the resulting number field. + - ``simplify_all`` -- boolean (default: ``False``); if ``True``, simplify + intermediate fields and also the resulting number field OUTPUT: @@ -170,7 +170,7 @@ def splitting_field(poly, name, map=False, degree_multiple=None, abort_degree=No The ``simplify`` and ``simplify_all`` flags usually yield fields defined by polynomials with smaller coefficients. - By default, ``simplify`` is True and ``simplify_all`` is False. + By default, ``simplify`` is ``True`` and ``simplify_all`` is ``False``. :: diff --git a/src/sage/rings/number_field/structure.py b/src/sage/rings/number_field/structure.py index b2b51997528..03748c933a3 100644 --- a/src/sage/rings/number_field/structure.py +++ b/src/sage/rings/number_field/structure.py @@ -88,7 +88,6 @@ class NumberFieldStructure(UniqueRepresentation): sage: LL. = NumberField(x^2 + 1, structure=NameChange(L)) sage: KK is LL False - """ def __init__(self, other): """ @@ -99,7 +98,6 @@ def __init__(self, other): sage: from sage.rings.number_field.structure import NumberFieldStructure sage: type(NumberFieldStructure(QQ)) - """ self.other = other @@ -135,7 +133,6 @@ def create_structure(self, field): j sage: K(j) i - """ raise NotImplementedError @@ -145,7 +142,7 @@ class NameChange(NumberFieldStructure): INPUT: - - ``other`` -- the number field from which this field has been created. + - ``other`` -- the number field from which this field has been created TESTS:: @@ -163,7 +160,6 @@ class NameChange(NumberFieldStructure): 10 sage: [id(v) for v in gc.get_objects() if id(v) == u] [] - """ def create_structure(self, field): r""" @@ -179,7 +175,6 @@ def create_structure(self, field): Isomorphism given by variable name change map: From: Cyclotomic Field of order 5 and degree 4 To: Number Field in a with defining polynomial x^4 + x^3 + x^2 + x + 1) - """ from . import maps return maps.NameChangeMap(field, self.other), maps.NameChangeMap(self.other, field) @@ -191,7 +186,7 @@ class AbsoluteFromRelative(NumberFieldStructure): INPUT: - - ``other`` -- the number field from which this field has been created. + - ``other`` -- the number field from which this field has been created TESTS:: @@ -201,7 +196,6 @@ class AbsoluteFromRelative(NumberFieldStructure): sage: L. = K.extension(x^2 - 3) sage: AbsoluteFromRelative(L) - """ def create_structure(self, field): r""" @@ -220,7 +214,6 @@ def create_structure(self, field): To: Number Field in b with defining polynomial x^2 - 3 over its base field, Isomorphism map: From: Number Field in b with defining polynomial x^2 - 3 over its base field To: Number Field in c with defining polynomial x^4 - 10*x^2 + 1) - """ from . import maps return maps.MapAbsoluteToRelativeNumberField(field, self.other), maps.MapRelativeToAbsoluteNumberField(self.other, field) @@ -233,7 +226,7 @@ class RelativeFromAbsolute(NumberFieldStructure): INPUT: - ``other`` -- the (absolute) number field from which this field has been - created. + created - ``gen`` -- the generator of the intermediate field @@ -242,7 +235,6 @@ class RelativeFromAbsolute(NumberFieldStructure): sage: from sage.rings.number_field.structure import RelativeFromAbsolute sage: RelativeFromAbsolute(QQ, 1/2) - """ def __init__(self, other, gen): r""" @@ -253,7 +245,6 @@ def __init__(self, other, gen): sage: from sage.rings.number_field.structure import RelativeFromAbsolute sage: type(RelativeFromAbsolute(QQ, 1/2)) - """ NumberFieldStructure.__init__(self, other) self.gen = gen @@ -280,7 +271,6 @@ def create_structure(self, field): From: Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? To: Number Field in b with defining polynomial x + a_ over its base field Defn: a |--> -a_) - """ # other field # \ / @@ -310,7 +300,7 @@ class RelativeFromRelative(NumberFieldStructure): INPUT: - ``other`` -- the relative number field used in the construction, see - :meth:`create_structure`; there this field will be called ``field_``. + :meth:`create_structure`; there this field will be called ``field_`` TESTS:: @@ -320,7 +310,6 @@ class RelativeFromRelative(NumberFieldStructure): sage: L. = K.extension(x^2 - 2) sage: RelativeFromRelative(L) - """ def create_structure(self, field): r""" @@ -352,7 +341,6 @@ def create_structure(self, field): To: Number Field in b with defining polynomial x^2 - 2*a*x + 3 over its base field Defn: a |--> a i |--> -b + a) - """ # other and field_ are relative number fields which are isomorphic via # an absolute number field abs. diff --git a/src/sage/rings/number_field/totallyreal.pyx b/src/sage/rings/number_field/totallyreal.pyx index 11d22c8672f..14e55237dd1 100644 --- a/src/sage/rings/number_field/totallyreal.pyx +++ b/src/sage/rings/number_field/totallyreal.pyx @@ -114,11 +114,9 @@ cpdef double odlyzko_bound_totallyreal(int n) noexcept: INPUT: - - ``n`` -- (integer) the degree + - ``n`` -- integer; the degree - OUTPUT: - - a lower bound on the root discriminant (as a real number) + OUTPUT: a lower bound on the root discriminant (as a real number) EXAMPLES:: @@ -172,28 +170,28 @@ def enumerate_totallyreal_fields_prim(n, B, a = [], verbose=0, return_seqs=False INPUT: - - ``n`` -- (integer) the degree - - ``B`` -- (integer) the discriminant bound - - ``a`` -- (list, default: ``[]``) the coefficient list to begin with + - ``n`` -- integer; the degree + - ``B`` -- integer; the discriminant bound + - ``a`` -- list (default: ``[]``); the coefficient list to begin with - ``verbose`` -- (integer or string, default: 0) if ``verbose == 1`` (or ``2``), then print to the screen (really) verbosely; if verbose is a string, then print verbosely to the file specified by verbose. - - ``return_seqs`` -- (boolean, default ``False``) If ``True``, then return - the polynomials as sequences (for easier exporting to a file). + - ``return_seqs`` -- boolean (default: ``False``); if ``True``, then return + the polynomials as sequences (for easier exporting to a file) - ``phc`` -- boolean or integer (default: ``False``) - - ``keep_fields`` -- (boolean or integer, default: ``False``) If + - ``keep_fields`` -- boolean or integer (default: ``False``); if ``keep_fields`` is ``True``, then keep fields up to ``B*log(B)``; if ``keep_fields`` is an integer, then keep fields up to that integer. - - ``t_2`` -- (boolean or integer, default: ``False``) If ``t_2 = T``, then - keep only polynomials with t_2 norm >= T. - - ``just_print`` -- (boolean, default: ``False``): if ``just_print`` is not + - ``t_2`` -- boolean or integer (default: ``False``); if ``t_2 = T``, then + keep only polynomials with ``t_2 norm >= T`` + - ``just_print`` -- boolean (default: ``False``); if ``just_print`` is not ``False``, instead of creating a sorted list of totally real number fields, we simply write each totally real field we find to the file whose filename is given by ``just_print``. In this case, we don't return anything. - - ``return_pari_objects`` -- (boolean, default: ``True``) if + - ``return_pari_objects`` -- boolean (default: ``True``); if both ``return_seqs`` and ``return_pari_objects`` are ``False`` then - it returns the elements as Sage objects; otherwise it returns PARI + it returns the elements as Sage objects. Otherwise it returns PARI objects. OUTPUT: @@ -236,7 +234,6 @@ def enumerate_totallyreal_fields_prim(n, B, a = [], verbose=0, return_seqs=False Univariate Polynomial Ring in x over Rational Field sage: enumerate_totallyreal_fields_prim(2, 10, return_seqs=True)[1][0][1][0].parent() Rational Field - """ cdef pari_gen B_pari, d, d_poly, keepB, nf, t2val, ngt2, ng diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index 8c6ee1e5cb3..694e96235bc 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -457,10 +457,10 @@ cdef class tr_data: INPUT: - n -- integer, the degree - B -- integer, the discriminant bound - a -- list (default: ``[]``), the coefficient list to begin with, where - a[len(a)]*x^n + ... + a[0]x^(n-len(a)) + - ``n`` -- integer; the degree + - ``B`` -- integer; the discriminant bound + - ``a`` -- list (default: ``[]``); the coefficient list to begin with, + where ``a[len(a)]*x^n + ... + a[0]x^(n-len(a))`` OUTPUT: @@ -593,7 +593,7 @@ cdef class tr_data: INPUT: - ``verbose`` -- boolean to print verbosely computational details - - ``haltk`` -- integer, the level at which to halt the inductive + - ``haltk`` -- integer; the level at which to halt the inductive coefficient bounds - ``phc`` -- boolean, if PHCPACK is available, use it when `k = n-5` to compute an improved Lagrange multiplier bound @@ -646,13 +646,13 @@ cdef class tr_data: INPUT: - - f_out -- an integer sequence, to be written with the coefficients of + - ``f_out`` -- integer sequence, to be written with the coefficients of the next polynomial - - verbose -- boolean to print verbosely computational details - - haltk -- integer, the level at which to halt the inductive + - ``verbose`` -- boolean to print verbosely computational details + - ``haltk`` -- integer; the level at which to halt the inductive coefficient bounds - - phc -- boolean, if PHCPACK is available, use it when k == n-5 to - compute an improved Lagrange multiplier bound + - ``phc`` -- boolean; if PHCPACK is available, use it when ``k == n-5`` + to compute an improved Lagrange multiplier bound OUTPUT: @@ -913,7 +913,6 @@ cdef class tr_data: amax = [0, 0, 0, 1] beta = [...] gnk = [...] - """ print("k =", self.k) print("a =", [self.a[i] for i in range(self.n + 1)]) diff --git a/src/sage/rings/number_field/totallyreal_phc.py b/src/sage/rings/number_field/totallyreal_phc.py index 71dd6a1f0e4..a8b5488cb0f 100644 --- a/src/sage/rings/number_field/totallyreal_phc.py +++ b/src/sage/rings/number_field/totallyreal_phc.py @@ -28,8 +28,8 @@ def coefficients_to_power_sums(n, m, a): INPUT: - - ``n`` -- integer, the degree - - ``a`` -- list of integers, the coefficients + - ``n`` -- integer; the degree + - ``a`` -- list of integers; the coefficients OUTPUT: list of integers @@ -62,8 +62,8 @@ def __lagrange_bounds_phc(n, m, a, tmpfile=None): INPUT: - - k -- integer, the index of the next coefficient - - a -- list of integers, the coefficients + - ``k`` -- integer; the index of the next coefficient + - ``a`` -- list of integers; the coefficients OUTPUT: the lower and upper bounds as real numbers diff --git a/src/sage/rings/number_field/totallyreal_rel.py b/src/sage/rings/number_field/totallyreal_rel.py index 8ce8efb1c02..e47476ca2e9 100644 --- a/src/sage/rings/number_field/totallyreal_rel.py +++ b/src/sage/rings/number_field/totallyreal_rel.py @@ -118,7 +118,7 @@ def integral_elements_in_box(K, C): INPUT: - ``K`` -- a totally real number field - - ``C`` -- a list ``[[lower, upper], ...]`` of lower and upper bounds, + - ``C`` -- list ``[[lower, upper], ...]`` of lower and upper bounds, for each embedding EXAMPLES:: @@ -244,11 +244,11 @@ def __init__(self, F, m, B, a=None): INPUT: - - ``F`` -- number field, the base field - - ``m`` -- integer, the relative degree - - ``B`` -- integer, the discriminant bound - - ``a`` -- list (default: ``[]``), the coefficient list to begin with, - corresponding to ``a[len(a)]*x^n + ... + a[0]x^(n-len(a))``. + - ``F`` -- number field; the base field + - ``m`` -- integer; the relative degree + - ``B`` -- integer; the discriminant bound + - ``a`` -- list (default: ``[]``); the coefficient list to begin with, + corresponding to ``a[len(a)]*x^n + ... + a[0]x^(n-len(a))`` OUTPUT: @@ -371,17 +371,15 @@ def incr(self, f_out, verbose=False, haltk=0): INPUT: - - ``f_out`` -- an integer sequence, to be written with the - coefficients of the next polynomial - - ``verbose`` -- boolean or nonnegative integer (default: ``False``) - print verbosely computational details. It prints extra - information if ``verbose`` is set to ``2`` or more - - ``haltk`` -- integer, the level at which to halt the inductive + - ``f_out`` -- integer sequence; to be written with the coefficients of + the next polynomial + - ``verbose`` -- boolean or nonnegative integer (default: ``False``); + print verbosely computational details. It prints extra information if + ``verbose`` is set to ``2`` or more. + - ``haltk`` -- integer; the level at which to halt the inductive coefficient bounds - OUTPUT: - - the successor polynomial as a coefficient list. + OUTPUT: the successor polynomial as a coefficient list """ import numpy @@ -662,23 +660,22 @@ def enumerate_totallyreal_fields_rel(F, m, B, a=[], verbose=0, INPUT: - - ``F`` -- number field, the base field - - ``m`` -- integer, the degree - - ``B`` -- integer, the discriminant bound - - ``a`` -- list (default: ``[]``), the coefficient list to begin with - - ``verbose`` -- boolean or nonnegative integer or string (default: 0) + - ``F`` -- number field; the base field + - ``m`` -- integer; the degree + - ``B`` -- integer; the discriminant bound + - ``a`` -- list (default: ``[]``); the coefficient list to begin with + - ``verbose`` -- boolean or nonnegative integer or string (default: 0); give a verbose description of the computations being performed. If ``verbose`` is set to ``2`` or more then it outputs some extra information. If ``verbose`` is a string then it outputs to a file - specified by ``verbose`` - - ``return_seqs`` -- (boolean, default ``False``) If ``True``, then return + specified by ``verbose``. + - ``return_seqs`` -- boolean (default: ``False``); if ``True``, then return the polynomials as sequences (for easier exporting to a file). This also returns a list of four numbers, as explained in the OUTPUT section below. - - ``return_pari_objects`` -- (boolean, default: ``True``) if - both ``return_seqs`` and ``return_pari_objects`` are ``False`` then - it returns the elements as Sage objects; otherwise it returns PARI - objects. + - ``return_pari_objects`` -- boolean (default: ``True``); if both + ``return_seqs`` and ``return_pari_objects`` are ``False`` then it returns + the elements as Sage objects; otherwise it returns PARI objects. OUTPUT: @@ -910,21 +907,19 @@ def enumerate_totallyreal_fields_all(n, B, verbose=0, return_seqs=False, INPUT: - - ``n`` -- integer, the degree - - ``B`` -- integer, the discriminant bound - - ``verbose`` -- boolean or nonnegative integer or string (default: 0) + - ``n`` -- integer; the degree + - ``B`` -- integer; the discriminant bound + - ``verbose`` -- boolean or nonnegative integer or string (default: 0); give a verbose description of the computations being performed. If - ``verbose`` is set to ``2`` or more, it outputs some extra - information. If ``verbose`` is a string, it outputs to a file - specified by ``verbose`` - - ``return_seqs`` -- (boolean, default ``False``) If ``True``, then return + ``verbose`` is set to ``2`` or more, it outputs some extra information. + If ``verbose`` is a string, it outputs to a file specified by ``verbose`` + - ``return_seqs`` -- boolean (default: ``False``); if ``True``, then return the polynomials as sequences (for easier exporting to a file). This also returns a list of four numbers, as explained in the OUTPUT section below. - - ``return_pari_objects`` -- (boolean, default: ``True``) if both + - ``return_pari_objects`` -- boolean (default: ``True``); if both ``return_seqs`` and ``return_pari_objects`` are ``False`` then it - returns the elements as Sage objects; otherwise it returns PARI - objects. + returns the elements as Sage objects; otherwise it returns PARI objects. EXAMPLES:: diff --git a/src/sage/rings/number_field/unit_group.py b/src/sage/rings/number_field/unit_group.py index a98c1dd0907..eb6b46ed82e 100644 --- a/src/sage/rings/number_field/unit_group.py +++ b/src/sage/rings/number_field/unit_group.py @@ -235,7 +235,7 @@ def __init__(self, number_field, proof=True, S=None): INPUT: - ``number_field`` -- a number field - - ``proof`` -- boolean (default ``True``): proof flag + - ``proof`` -- boolean (default: ``True``); proof flag - ``S`` -- tuple of prime ideals, or an ideal, or a single ideal or element from which an ideal can be constructed, in which case the support is used. If ``None``, the global unit @@ -311,8 +311,6 @@ def __init__(self, number_field, proof=True, S=None): sage: K = QuadraticField(d) sage: K.unit_group(proof=False) Unit group with structure C2 x Z of Number Field in a with defining polynomial x^2 - 12936642 with a = 3596.754370262167? - - """ proof = get_flag(proof, "number_field") K = number_field @@ -369,14 +367,14 @@ def __init__(self, number_field, proof=True, S=None): def _element_constructor_(self, u): """ - Returns the abstract group element corresponding to the unit u. + Return the abstract group element corresponding to the unit u. INPUT: - - ``u`` -- Any object from which an element of the unit group's number + - ``u`` -- any object from which an element of the unit group's number field `K` may be constructed; an error is raised if an element of `K` cannot be constructed from u, or if the element constructed is not a - unit. + unit EXAMPLES:: @@ -515,7 +513,7 @@ def torsion_generator(self): def zeta_order(self): """ - Returns the order of the torsion part of the unit group. + Return the order of the torsion part of the unit group. EXAMPLES:: @@ -564,7 +562,6 @@ def zeta(self, n=2, all=False): ValueError: n (=3) does not divide order of generator sage: U.zeta(3, all=True) [] - """ N = self.__ntu K = self.number_field() @@ -631,13 +628,13 @@ def log(self, u): INPUT: - - ``u`` -- Any object from which an element of the unit group's number + - ``u`` -- any object from which an element of the unit group's number field `K` may be constructed; an error is raised if an element of `K` cannot be constructed from `u`, or if the element constructed is not a - unit. + unit - OUTPUT: a list of integers giving the exponents of `u` with - respect to the unit group's basis. + OUTPUT: list of integers giving the exponents of `u` with + respect to the unit group's basis EXAMPLES:: @@ -678,12 +675,12 @@ def exp(self, exponents): INPUT: - - ``u`` -- Any object from which an element of the unit + - ``u`` -- any object from which an element of the unit group's number field `K` may be constructed; an error is raised if an element of `K` cannot be constructed from `u`, or if the element constructed is not a unit. - OUTPUT: a list of integers giving the exponents of `u` with + OUTPUT: list of integers giving the exponents of `u` with respect to the unit group's basis. EXAMPLES:: diff --git a/src/sage/rings/padics/CA_template.pxi b/src/sage/rings/padics/CA_template.pxi index e4a25cffec1..2c98d86e29c 100644 --- a/src/sage/rings/padics/CA_template.pxi +++ b/src/sage/rings/padics/CA_template.pxi @@ -48,7 +48,7 @@ from sage.categories.homset import Hom cdef class CAElement(pAdicTemplateElement): cdef int _set(self, x, long val, long xprec, absprec, relprec) except -1: """ - Sets the value of this element from given defining data. + Set the value of this element from given defining data. This function is intended for use in conversion, and should not be called on an element created with :meth:`_new_c`. @@ -410,11 +410,9 @@ cdef class CAElement(pAdicTemplateElement): INPUT: - - ``_right`` -- currently integers and `p`-adic exponents are - supported. + - ``_right`` -- currently integers and `p`-adic exponents are supported - - ``dummy`` -- not used (Python's ``__pow__`` signature - includes it) + - ``dummy`` -- not used (Python's ``__pow__`` signature includes it) EXAMPLES:: @@ -536,7 +534,7 @@ cdef class CAElement(pAdicTemplateElement): cdef pAdicTemplateElement _lshift_c(self, long shift): r""" - Multiplies by `\pi^{\mbox{shift}}`. + Multiply by `\pi^{\mbox{shift}}`. Negative shifts may truncate the result. @@ -568,7 +566,7 @@ cdef class CAElement(pAdicTemplateElement): cdef pAdicTemplateElement _rshift_c(self, long shift): r""" - Divides by ``Ï€^{\mbox{shift}}``. + Divide by ``Ï€^{\mbox{shift}}``. Positive shifts may truncate the result. @@ -605,9 +603,10 @@ cdef class CAElement(pAdicTemplateElement): INPUT: - - ``absprec`` -- an integer or infinity + - ``absprec`` -- integer or infinity - OUTPUT: ``self`` with precision set to the minimum of ``self's`` precision and ``prec`` + OUTPUT: ``self`` with precision set to the minimum of ``self``'s + precision and ``prec`` EXAMPLES:: @@ -628,7 +627,6 @@ cdef class CAElement(pAdicTemplateElement): sage: k(3).add_bigoh(-1) O(3^-1) - """ cdef long aprec, newprec if absprec is infinity: @@ -696,7 +694,7 @@ cdef class CAElement(pAdicTemplateElement): INPUT: - - ``absprec`` -- an integer, infinity, or ``None`` + - ``absprec`` -- integer, infinity, or ``None`` EXAMPLES:: @@ -756,7 +754,7 @@ cdef class CAElement(pAdicTemplateElement): - ``right`` -- a `p`-adic element with the same parent - - ``absprec`` -- an integer, infinity, or ``None`` + - ``absprec`` -- integer, infinity, or ``None`` EXAMPLES:: @@ -822,8 +820,7 @@ cdef class CAElement(pAdicTemplateElement): INPUT: - - ``absprec`` -- an integer, at most the precision cap of the - parent + - ``absprec`` -- integer; at most the precision cap of the parent EXAMPLES:: @@ -1101,7 +1098,6 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): TESTS:: sage: TestSuite(f).run() - """ def __init__(self, R): """ @@ -1240,11 +1236,11 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): cdef class pAdicConvert_CA_ZZ(RingMap): """ The map from a capped absolute ring back to the ring of integers that - returns the smallest non-negative integer approximation to its input + returns the smallest nonnegative integer approximation to its input which is accurate up to the precision. - Raises a ``ValueError`` if the input is not in the closure of the image of - the ring of integers. + Raises a :exc:`ValueError` if the input is not in the closure of the image + of the ring of integers. EXAMPLES:: @@ -1289,7 +1285,7 @@ cdef class pAdicConvert_CA_ZZ(RingMap): cdef class pAdicConvert_QQ_CA(Morphism): """ The inclusion map from the rationals to a capped absolute ring that is - defined on all elements with non-negative `p`-adic valuation. + defined on all elements with nonnegative `p`-adic valuation. EXAMPLES:: @@ -1431,7 +1427,6 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): TESTS:: sage: TestSuite(f).run() # needs sage.libs.flint - """ def __init__(self, R, K): """ @@ -1531,7 +1526,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): def section(self): """ Return a map back to the ring that converts elements of - non-negative valuation. + nonnegative valuation. EXAMPLES:: @@ -1575,7 +1570,6 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): a + O(3^20) sage: g(a) == f(a) True - """ _slots = RingHomomorphism._extra_slots(self) _slots['_zero'] = self._zero @@ -1605,7 +1599,6 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): a + O(3^20) sage: g(a) == f(a) True - """ self._zero = _slots['_zero'] self._section = _slots['_section'] @@ -1623,7 +1616,6 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): sage: f = K.coerce_map_from(R) sage: f.is_injective() True - """ return True @@ -1639,7 +1631,6 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): sage: f = K.coerce_map_from(R) sage: f.is_surjective() False - """ return False @@ -1814,7 +1805,6 @@ cdef class pAdicConvert_CA_frac_field(Morphism): a + O(3^20) sage: g(a) == f(a) True - """ self._zero = _slots['_zero'] Morphism._update_slots(self, _slots) diff --git a/src/sage/rings/padics/common_conversion.pyx b/src/sage/rings/padics/common_conversion.pyx index 2a143e6d99e..c820871e667 100644 --- a/src/sage/rings/padics/common_conversion.pyx +++ b/src/sage/rings/padics/common_conversion.pyx @@ -235,10 +235,10 @@ cdef long comb_prec(iprec, long prec) except? -10000: INPUT: - - ``iprec`` -- either infinity, an Integer, a Python int or - something that can be converted to an Integer. + - ``iprec`` -- infinity, integer or something that can be converted to an + integer - - ``prec`` -- a long. + - ``prec`` -- a long """ if iprec is infinity: return prec cdef Integer intprec @@ -265,14 +265,14 @@ cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absol INPUT: - - ``args`` -- a tuple of positional arguments (at most two) + - ``args`` -- tuple of positional arguments (at most two) - - ``kwds`` -- a dictionary of keyword arguments (only + - ``kwds`` -- dictionary of keyword arguments (only ``'relprec'`` and ``'absprec'`` are used) - - ``absolute`` -- (boolean) True if the precision cap of the ring - is a cap on absolute precision, False if a cap on relative - precision. + - ``absolute`` -- boolean; ``True`` if the precision cap of the ring + is a cap on absolute precision, ``False`` if a cap on relative + precision - ``prime_pow`` -- a :class:`sage.rings.padics.pow_computer.PowComputer_class` @@ -281,10 +281,10 @@ cdef int _process_args_and_kwds(long *aprec, long *rprec, args, kwds, bint absol OUTPUT: - ``aprec`` -- (first argument) the maximum absolute precision of - the resulting element. + the resulting element - ``rprec`` -- (second argument) the maximum relative precision of - the resulting element. + the resulting element - error status """ @@ -321,14 +321,14 @@ cdef inline long cconv_mpq_t_shared(mpz_t out, mpq_t x, long prec, bint absolute INPUT: - - ``out`` -- an ``mpz_t`` to store the output. - - ``x`` -- an ``mpq_t`` giving the integer to be converted. - - ``prec`` -- a long, giving the precision desired: absolute or - relative depending on the ``absolute`` input. - - ``absolute`` -- if False then extracts the valuation and returns - it, storing the unit in ``out``; if True then - just reduces ``x`` modulo the precision. - - ``prime_pow`` -- a PowComputer for the ring. + - ``out`` -- an ``mpz_t`` to store the output + - ``x`` -- an ``mpq_t`` giving the integer to be converted + - ``prec`` -- a long, giving the precision desired; absolute or + relative depending on the ``absolute`` input + - ``absolute`` -- if ``False`` then extracts the valuation and returns + it, storing the unit in ``out``; if ``True`` then just reduces ``x`` + modulo the precision + - ``prime_pow`` -- a PowComputer for the ring OUTPUT: @@ -362,10 +362,11 @@ cdef inline long cconv_mpq_t_shared(mpz_t out, mpq_t x, long prec, bint absolute cdef inline int cconv_mpq_t_out_shared(mpq_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1: """ - Converts the underlying `p`-adic element into a rational + Convert the underlying `p`-adic element into a rational - - ``out`` -- gives a rational approximating the input. Currently uses rational reconstruction but - may change in the future to use a more naive method + - ``out`` -- gives a rational approximating the input. Currently uses + rational reconstruction but may change in the future to use a more naive + method - ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element - ``valshift`` -- a long giving the power of `p` to shift `x` by -` ``prec`` -- a long, the precision of ``x``, used in rational reconstruction @@ -392,18 +393,17 @@ cdef inline int cconv_shared(mpz_t out, x, long prec, long valshift, PowComputer INPUT: - - ``out`` -- an ``mpz_t`` to store the output. + - ``out`` -- an ``mpz_t`` to store the output - - ``x`` -- a Sage element that can be converted to a `p`-adic element. + - ``x`` -- a Sage element that can be converted to a `p`-adic element - - ``prec`` -- a long, giving the precision desired: absolute if - `valshift = 0`, relative if `valshift != 0`. + - ``prec`` -- a long, giving the precision desired; absolute if + `valshift = 0`, relative if `valshift != 0` - ``valshift`` -- the power of the uniformizer to divide by before - storing the result in ``out``. - - - ``prime_pow`` -- a PowComputer for the ring. + storing the result in ``out`` + - ``prime_pow`` -- a PowComputer for the ring """ if PyLong_Check(x): x = Integer(x) @@ -456,14 +456,14 @@ cdef inline long cconv_mpz_t_shared(mpz_t out, mpz_t x, long prec, bint absolute INPUT: - - ``out`` -- an ``mpz_t`` to store the output. - - ``x`` -- an ``mpz_t`` giving the integer to be converted. - - ``prec`` -- a long, giving the precision desired: absolute or - relative depending on the ``absolute`` input. - - ``absolute`` -- if False then extracts the valuation and returns - it, storing the unit in ``out``; if True then - just reduces ``x`` modulo the precision. - - ``prime_pow`` -- a PowComputer for the ring. + - ``out`` -- an ``mpz_t`` to store the output + - ``x`` -- an ``mpz_t`` giving the integer to be converted + - ``prec`` -- a long, giving the precision desired; absolute or + relative depending on the ``absolute`` input + - ``absolute`` -- if ``False`` then extracts the valuation and returns + it, storing the unit in ``out``; if ``True`` then just reduces ``x`` + modulo the precision + - ``prime_pow`` -- a PowComputer for the ring OUTPUT: @@ -483,15 +483,14 @@ cdef inline long cconv_mpz_t_shared(mpz_t out, mpz_t x, long prec, bint absolute cdef inline int cconv_mpz_t_out_shared(mpz_t out, mpz_t x, long valshift, long prec, PowComputer_class prime_pow) except -1: """ - Converts the underlying `p`-adic element into an integer if - possible. + Convert the underlying `p`-adic element into an integer if possible. - ``out`` -- stores the resulting integer as an integer between 0 - and `p^{prec + valshift}`. - - ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element. - - ``valshift`` -- a long giving the power of `p` to shift `x` by. - -` ``prec`` -- a long, the precision of ``x``: currently not used. - - ``prime_pow`` -- a PowComputer for the ring. + and `p^{prec + valshift}` + - ``x`` -- an ``mpz_t`` giving the underlying `p`-adic element + - ``valshift`` -- a long giving the power of `p` to shift `x` by + -` ``prec`` -- a long, the precision of ``x``; currently not used + - ``prime_pow`` -- a PowComputer for the ring """ if valshift == 0: mpz_set(out, x) diff --git a/src/sage/rings/puiseux_series_ring.py b/src/sage/rings/puiseux_series_ring.py index d63b5bcc665..977603fde9e 100644 --- a/src/sage/rings/puiseux_series_ring.py +++ b/src/sage/rings/puiseux_series_ring.py @@ -340,7 +340,7 @@ def _element_constructor_(self, x, e=1, prec=infinity): def _coerce_map_from_(self, P): r""" - Return a coercion map from `P` to `self`, or `True`, or `None`. + Return a coercion map from `P` to ``self``, or ``True``, or ``None``. The following rings admit a coercion map to the Puiseux series ring `A((x-a)^(1/e))`: @@ -351,7 +351,7 @@ def _coerce_map_from_(self, P): variable `(x-a)` over a ring admitting a coercion map to `A` - any Puiseux series ring with the same center `a` and ramification - index equal to a multiple of `self`'s ramification index. For + index equal to a multiple of ``self``'s ramification index. For example, Puiseux series in (x-a)^(1/2) can be interpreted as Puiseux series in (x-a)^(1/4). diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index 96aa6eaef6e..902ce96bd7c 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -133,12 +133,12 @@ cdef class PuiseuxSeries(AlgebraElement): - ``parent`` -- the parent ring - - ``f`` -- one of the following types of inputs: + - ``f`` -- one of the following types of inputs: * instance of :class:`PuiseuxSeries` * instance that can be coerced into the Laurent series ring of the parent - - ``e`` -- integer (default: 1) the ramification index + - ``e`` -- integer (default: 1); the ramification index EXAMPLES:: diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py index 73e8878150c..af276ad57c8 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py @@ -124,7 +124,7 @@ sage: AA((-4)^(1/4)) Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real The coercion, however, goes in the other direction, since not all symbolic expressions are algebraic numbers:: @@ -411,7 +411,7 @@ real (has an imaginary component of exactly zero). Converting from either ``AA`` or ``QQbar`` to ``ZZ`` or ``QQ`` succeeds only if the number actually is an integer or rational. If conversion fails, a -ValueError will be raised. +:exc:`ValueError` will be raised. Here are examples of all of these conversions:: @@ -927,7 +927,6 @@ def _factor_multivariate_polynomial(self, f, proof=True): sage: # needs sage.libs.singular sage: AA['x','y'](1).factor() # indirect doctest 1 - """ from sage.interfaces.singular import singular from sage.structure.factorization import Factorization @@ -1149,7 +1148,7 @@ def _element_constructor_(self, x): if x.imag().is_zero(): return x.real() else: - raise ValueError("Cannot coerce algebraic number with non-zero imaginary part to algebraic real") + raise ValueError("Cannot coerce algebraic number with nonzero imaginary part to algebraic real") elif hasattr(x, '_algebraic_'): return x._algebraic_(AA) return AlgebraicReal(x) @@ -1355,7 +1354,7 @@ def zeta(self, n=2): INPUT: - - ``n`` (integer) -- default 2 + - ``n`` -- integer (default: 2) EXAMPLES:: @@ -1447,7 +1446,7 @@ def random_element(self, poly_degree=2, *args, **kwds): INPUT: - - ``poly_degree`` -- default: 2; degree of the random + - ``poly_degree`` -- (default: 2) degree of the random polynomial over the integers of which the returned algebraic real number is a (real part of a) root. This is not necessarily the degree of the minimal polynomial of the @@ -1551,7 +1550,6 @@ def _factor_univariate_polynomial(self, f): (12) * (x^2 + 0.3333333333333334?) sage: AA._factor_univariate_polynomial(EllipticCurve('11a1').change_ring(AA).division_polynomial(5)) # needs sage.schemes (5) * (x - 16.00000000000000?) * (x - 5.000000000000000?) * (x - 1.959674775249769?) * (x + 2.959674775249769?) * (x^2 - 2.854101966249685?*x + 15.47213595499958?) * (x^2 + 1.909830056250526?*x + 1.660606461254312?) * (x^2 + 3.854101966249685?*x + 6.527864045000421?) * (x^2 + 13.09016994374948?*x + 93.33939353874569?) - """ rr = f.roots() cr = [(r, e) for r, e in f.roots(QQbar) if r.imag() > 0] @@ -1681,7 +1679,7 @@ def _element_constructor_(self, x): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -1854,7 +1852,7 @@ def zeta(self, n=4): INPUT: - - ``n`` (integer) -- default 4 + - ``n`` -- integer (default: 4) EXAMPLES:: @@ -1933,7 +1931,7 @@ def random_element(self, poly_degree=2, *args, **kwds): INPUT: - - ``poly_degree`` -- default: 2; degree of the random polynomial over + - ``poly_degree`` -- (default: 2) degree of the random polynomial over the integers of which the returned algebraic number is a root. This is not necessarily the degree of the minimal polynomial of the number. Increase this parameter to achieve a greater diversity of @@ -2110,7 +2108,6 @@ def _factor_univariate_polynomial(self, f): -1 sage: QQbar._factor_univariate_polynomial(EllipticCurve('11a1').change_ring(QQbar).division_polynomial(5)) # needs sage.schemes (5) * (x - 16) * (x - 5) * (x - 1.959674775249769?) * (x - 1.427050983124843? - 3.665468789467727?*I) * (x - 1.427050983124843? + 3.665468789467727?*I) * (x + 0.9549150281252629? - 0.8652998037182486?*I) * (x + 0.9549150281252629? + 0.8652998037182486?*I) * (x + 1.927050983124843? - 1.677599044300515?*I) * (x + 1.927050983124843? + 1.677599044300515?*I) * (x + 2.959674775249769?) * (x + 6.545084971874737? - 7.106423590645660?*I) * (x + 6.545084971874737? + 7.106423590645660?*I) - """ from sage.structure.factorization import Factorization return Factorization([(f.parent()([-r, 1]), e) for r, e in f.roots()], @@ -2336,7 +2333,7 @@ def do_polred(poly, threshold=32): INPUT: - ``poly`` -- a monic irreducible polynomial with integer coefficients - - ``threshold`` -- an integer used to decide whether to run ``polredbest`` + - ``threshold`` -- integer used to decide whether to run ``polredbest`` OUTPUT: @@ -2544,17 +2541,17 @@ def number_field_elements_from_algebraics(numbers, minimal=False, - ``numbers`` -- a number or list of numbers - - ``minimal`` -- Boolean (default: ``False``). Whether to minimize the + - ``minimal`` -- boolean (default: ``False``); whether to minimize the degree of the extension - - ``same_field`` -- Boolean (default: ``False``). See below + - ``same_field`` -- boolean (default: ``False``); see below - - ``embedded`` -- Boolean (default: ``False``). Whether to make the + - ``embedded`` -- boolean (default: ``False``); whether to make the NumberField embedded - ``name`` -- string (default: ``'a'``); name of the primitive element - - ``prec`` -- integer (default: ``53``). The number of bit of precision + - ``prec`` -- integer (default: 53); the number of bit of precision to guarantee finding real roots OUTPUT: @@ -2934,14 +2931,14 @@ def cmp_elements_with_same_minpoly(a, b, p): INPUT: - - ``a`` and ``b`` -- elements of the algebraic or the real algebraic field + - ``a``, ``b`` -- elements of the algebraic or the real algebraic field with same minimal polynomial - ``p`` -- the minimal polynomial OUTPUT: - `-1`, `0`, `1`, `None` depending on whether `a < b`, `a = b` or `a > b` or + `-1`, `0`, `1`, ``None`` depending on whether `a < b`, `a = b` or `a > b` or the function did not succeed with the given precision of `a` and `b`. EXAMPLES:: @@ -3101,7 +3098,7 @@ def __reduce__(self): def __hash__(self): r""" - Return a hash value for self. This will depend on the order that + Return a hash value for ``self``. This will depend on the order that commands get executed at load time, so we do not test the value that is returned, just that it does not raise an error. @@ -3158,7 +3155,7 @@ def is_complex(self): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -3183,7 +3180,7 @@ def _repr_(self): def root_as_algebraic(self): r""" - Return the root attached to self as an algebraic number. + Return the root attached to ``self`` as an algebraic number. EXAMPLES:: @@ -3209,7 +3206,7 @@ def is_trivial(self): def field(self): r""" - Return the number field attached to self. + Return the number field attached to ``self``. EXAMPLES:: @@ -3429,7 +3426,6 @@ def super_poly(self, super, checked=None): -a^3 + 3*a sage: gen3.super_poly(gen2_3) a^2 - 2 - """ if checked is None: checked = {} @@ -3450,7 +3446,7 @@ def super_poly(self, super, checked=None): def __call__(self, elt): """ - Takes an algebraic number which is represented as either a + Take an algebraic number which is represented as either a rational or a number field element, and which is in a subfield of the field generated by this generator. Lifts the number into the field of this generator, and returns either a @@ -3514,7 +3510,7 @@ def is_simple(self): Check whether this descriptor represents a value with the same algebraic degree as the number field associated with the descriptor. - This returns ``True`` if self is an ``ANRational``, or a minimal + This returns ``True`` if ``self`` is an ``ANRational``, or a minimal ``ANExtensionElement``. EXAMPLES:: @@ -3544,7 +3540,7 @@ def is_simple(self): def neg(self, n): r""" - Negation of self. + Negation of ``self``. EXAMPLES:: @@ -3570,7 +3566,7 @@ def invert(self, n): def abs(self, n): r""" - Absolute value of self. + Absolute value of ``self``. EXAMPLES:: @@ -3583,7 +3579,7 @@ def abs(self, n): def real(self, n): r""" - Real part of self. + Real part of ``self``. EXAMPLES:: @@ -3599,7 +3595,7 @@ def real(self, n): def imag(self, n): r""" - Imaginary part of self. + Imaginary part of ``self``. EXAMPLES:: @@ -3615,7 +3611,7 @@ def imag(self, n): def conjugate(self, n): r""" - Complex conjugate of self. + Complex conjugate of ``self``. EXAMPLES:: @@ -3631,8 +3627,8 @@ def conjugate(self, n): def norm(self, n): r""" - Field norm of self from `\overline{\QQ}` to its real subfield - `\mathbf{A}`, i.e.~the square of the usual complex absolute value. + Field norm of ``self`` from `\overline{\QQ}` to its real subfield + `\mathbf{A}`, i.e. the square of the usual complex absolute value. EXAMPLES:: @@ -4018,7 +4014,6 @@ def __hash__(self): sage: h2 = hash(QQbar(1/2^100)) sage: hash(h1) == hash(h2) True - """ # The only way I can think of to hash algebraic numbers without @@ -4195,7 +4190,7 @@ def is_square(self): (boolean) ``True`` in all cases for elements of ``QQbar``; - ``True`` for non-negative elements of ``AA``; + ``True`` for nonnegative elements of ``AA``; otherwise ``False`` EXAMPLES:: @@ -4233,13 +4228,13 @@ def sqrt(self, all=False, extend=True): INPUT: - - ``extend`` -- bool (default: ``True``); ignored if self is in QQbar, or - positive in AA. If self is negative in AA, do the following: if True, - return a square root of self in QQbar, otherwise raise a ValueError. + - ``extend`` -- boolean (default: ``True``); ignored if ``self`` is in QQbar, or + positive in AA. If ``self`` is negative in AA, do the following: if True, + return a square root of ``self`` in QQbar, otherwise raise a :exc:`ValueError`. - - ``all`` -- bool (default: ``False``); if True, return a list of all square - roots. If False, return just one square root, or raise an ValueError - if self is a negative element of AA and extend=False. + - ``all`` -- boolean (default: ``False``); if ``True``, return a list of all square + roots. If ``False``, return just one square root, or raise an :exc:`ValueError` + if ``self`` is a negative element of AA and extend=False. OUTPUT: @@ -4314,12 +4309,12 @@ def nth_root(self, n, all=False): INPUT: - - ``all`` -- bool (default: ``False``). If ``True``, return a list of - all `n`-th roots as complex algebraic numbers. + - ``all`` -- boolean (default: ``False``); if ``True``, return a list of + all `n`-th roots as complex algebraic numbers .. WARNING:: - Note that for odd `n`, all=`False` and negative real numbers, + Note that for odd `n`, all ``False`` and negative real numbers, ``AlgebraicReal`` and ``AlgebraicNumber`` values give different answers: ``AlgebraicReal`` values prefer real results, and ``AlgebraicNumber`` values return the principal root. @@ -4375,14 +4370,14 @@ def as_number_field_element(self, minimal=False, embedded=False, prec=53): INPUT: - - ``minimal`` -- Boolean (default: ``False``). Whether to minimize the - degree of the extension. + - ``minimal`` -- boolean (default: ``False``); whether to minimize the + degree of the extension - - ``embedded`` -- Boolean (default: ``False``). Whether to make the - NumberField embedded. + - ``embedded`` -- boolean (default: ``False``); whether to make the + NumberField embedded - - ``prec`` -- integer (default: ``53``). The number of bit of precision - to guarantee finding real roots. + - ``prec`` -- integer (default: 53); the number of bit of precision + to guarantee finding real roots This may not return the smallest such number field, unless ``minimal=True`` is specified. @@ -4684,7 +4679,7 @@ def interval_fast(self, field): def interval_diameter(self, diam): """ - Compute an interval representation of self with ``diameter()`` at + Compute an interval representation of ``self`` with ``diameter()`` at most ``diam``. The precision of the returned value is unpredictable. EXAMPLES:: @@ -4709,7 +4704,7 @@ def interval_diameter(self, diam): def interval(self, field): r""" Given an interval (or ball) field (real or complex, as appropriate) of - precision `p`, compute an interval representation of self with + precision `p`, compute an interval representation of ``self`` with ``diameter()`` at most `2^{-p}`; then round that representation into the given field. Here ``diameter()`` is relative diameter for intervals not containing 0, and absolute diameter for @@ -5084,8 +5079,8 @@ def _richcmp_(self, other, op): def _mpfr_(self, field): r""" - Given a ``RealField``, compute a good approximation to self in - that field. Works only if the imaginary component of self is + Given a ``RealField``, compute a good approximation to ``self`` in + that field. Works only if the imaginary component of ``self`` is exactly zero; otherwise it raises a ``ValueError``. EXAMPLES:: @@ -5097,14 +5092,14 @@ def _mpfr_(self, field): sage: QQbar.zeta(3)._mpfr_(RR) Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real """ return AA(self)._mpfr_(field) def __float__(self): r""" - Compute a good float approximation to self. Works only if the - imaginary component of self is exactly zero; otherwise it + Compute a good float approximation to ``self``. Works only if the + imaginary component of ``self`` is exactly zero; otherwise it raises a ``ValueError``. EXAMPLES:: @@ -5116,13 +5111,13 @@ def __float__(self): sage: float(QQbar.zeta(3)) Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real """ return AA(self).__float__() def __complex__(self): r""" - Compute a good complex approximation to self. + Compute a good complex approximation to ``self``. EXAMPLES:: @@ -5135,7 +5130,7 @@ def __complex__(self): def _complex_double_(self, cdf): r""" - Compute a good approximation to self in CDF. + Compute a good approximation to ``self`` in CDF. EXAMPLES:: @@ -5159,7 +5154,7 @@ def _interval_fast(self, prec): def _integer_(self, ZZ=None): """ - Return self as an Integer. + Return ``self`` as an Integer. EXAMPLES:: @@ -5170,7 +5165,7 @@ def _integer_(self, ZZ=None): sage: QQbar.zeta(6)._integer_() Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real sage: # needs sage.symbolic sage: QQbar(sqrt(17))._integer_() @@ -5188,7 +5183,7 @@ def _integer_(self, ZZ=None): def _rational_(self): """ - Return self as a Rational. + Return ``self`` as a Rational. EXAMPLES:: @@ -5199,7 +5194,7 @@ def _rational_(self): sage: (QQbar.zeta(7)^3)._rational_() Traceback (most recent call last): ... - ValueError: Cannot coerce algebraic number with non-zero imaginary part to algebraic real + ValueError: Cannot coerce algebraic number with nonzero imaginary part to algebraic real sage: # needs sage.symbolic sage: QQbar(sqrt(2))._rational_() @@ -5300,7 +5295,7 @@ def interval_exact(self, field): def _complex_mpfr_field_(self, field): r""" - Compute an approximation to self in the given field, which must + Compute an approximation to ``self`` in the given field, which must be a complex field. EXAMPLES:: @@ -5639,7 +5634,7 @@ def _richcmp_(self, other, op): def _integer_(self, Z=None): """ - Return self as an Integer. + Return ``self`` as an Integer. EXAMPLES:: @@ -5775,7 +5770,7 @@ def trunc(self): def _rational_(self): """ - Return self as a Rational. + Return ``self`` as a Rational. EXAMPLES:: @@ -6026,7 +6021,8 @@ def sign(self): def _interval_fast(self, prec): r""" - Compute an approximation to this ``AlgebraicReal`` object in a real interval field of precision prec. + Compute an approximation to this ``AlgebraicReal`` object in a real + interval field of precision ``prec``. EXAMPLES:: @@ -6074,7 +6070,6 @@ def interval_exact(self, field): sage: from sage.rings.qqbar import QQbar_hash_offset sage: len([(r[0] + QQbar_hash_offset).interval_exact(CIF) for r in roots]) 7 - """ for extra in (0, 40): target = RR(1.0) >> (field.prec() + extra) @@ -6163,7 +6158,7 @@ def real_number(self, field): def __float__(self): r""" - Compute a good float approximation to self. + Compute a good float approximation to ``self``. EXAMPLES:: @@ -6295,7 +6290,7 @@ class AlgebraicNumberPowQQAction(Action): - ``G`` -- must be ``QQ`` - - ``S`` -- the parent on which to act, either ``AA`` or ``QQbar``. + - ``S`` -- the parent on which to act, either ``AA`` or ``QQbar`` .. NOTE:: @@ -6460,7 +6455,7 @@ def _act_(self, e, x): if prec is None: # We know that x.real() < 0, since x._value # crosses the negative real line and x._value - # is known to be non-zero. + # is known to be nonzero. isgn = x.imag().sign() val = x._value argument = val.argument() @@ -6549,7 +6544,7 @@ def __reduce__(self): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -6589,7 +6584,8 @@ def handle_sage_input(self, sib, coerce, is_qqbar): def _interval_fast(self, prec): r""" - Return an approximation to self in a real interval field of precision prec. + Return an approximation to ``self`` in a real interval field of + precision ``prec``. EXAMPLES:: @@ -6612,7 +6608,7 @@ def generator(self): def is_complex(self): r""" - Return ``False``, since rational numbers are real + Return ``False``, since rational numbers are real. EXAMPLES:: @@ -6635,7 +6631,7 @@ def exactify(self): def is_simple(self): """ - Checks whether this descriptor represents a value with the same + Check whether this descriptor represents a value with the same algebraic degree as the number field associated with the descriptor. This is always true for rational numbers. @@ -6701,7 +6697,7 @@ def abs(self, n): def rational_argument(self, n): r""" - Return the argument of self divided by `2 \pi`, or ``None`` if this + Return the argument of ``self`` divided by `2 \pi`, or ``None`` if this element is 0. EXAMPLES:: @@ -6907,7 +6903,7 @@ def _sage_input_(self, sib, coerce): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -7097,7 +7093,7 @@ def __reduce__(self): def _repr_(self): r""" - String representation of self. + String representation of ``self``. EXAMPLES:: @@ -7177,7 +7173,7 @@ def handle_sage_input(self, sib, coerce, is_qqbar): def is_complex(self): r""" Whether this is a root in `\overline{\QQ}` (rather than `\mathbf{A}`). - Note that this may return True even if the root is actually real, as + Note that this may return ``True`` even if the root is actually real, as the second example shows; it does *not* trigger exact computation to see if the root is real. @@ -7216,7 +7212,7 @@ def conjugate(self, n): def refine_interval(self, interval, prec): r""" - Takes an interval which is assumed to enclose exactly one root + Take an interval which is assumed to enclose exactly one root of the polynomial (or, with multiplicity=`k`, exactly one root of the `k-1`-st derivative); and a precision, in bits. @@ -7247,7 +7243,7 @@ def refine_interval(self, interval, prec): def _real_refine_interval(self, interval, prec): r""" - Does the calculation for ``refine_interval``. + Do the calculation for ``refine_interval``. EXAMPLES:: @@ -7389,7 +7385,7 @@ def _real_refine_interval(self, interval, prec): def _complex_refine_interval(self, interval, prec): r""" - Takes an interval which is assumed to enclose exactly one root + Take an interval which is assumed to enclose exactly one root of the polynomial (or, with multiplicity=`k`, exactly one root of the `k-1`-st derivative); and a precision, in bits. @@ -7981,8 +7977,8 @@ def simplify(self, n): INPUT: - - ``n`` -- The element of ``AA`` or ``QQbar`` corresponding - to this descriptor. + - ``n`` -- the element of ``AA`` or ``QQbar`` corresponding + to this descriptor EXAMPLES:: @@ -8103,7 +8099,6 @@ def conjugate(self, n): sage: (b.conjugate("random").generator() == c.generator() # needs sage.symbolic ....: and b.conjugate("random").field_element_value() == c.field_element_value()) True - """ if self._exactly_real: return self @@ -8115,7 +8110,7 @@ def conjugate(self, n): def norm(self, n): r""" - Norm of ``self`` (square of complex absolute value) + Norm of ``self`` (square of complex absolute value). EXAMPLES:: @@ -8620,7 +8615,8 @@ def is_complex(self): def _interval_fast(self, prec): r""" - Calculate an approximation to self in an interval field of precision prec. + Calculate an approximation to ``self`` in an interval field of + precision ``prec``. EXAMPLES:: diff --git a/src/sage/rings/quotient_ring_element.py b/src/sage/rings/quotient_ring_element.py index 181f2458390..6699ae9f74b 100644 --- a/src/sage/rings/quotient_ring_element.py +++ b/src/sage/rings/quotient_ring_element.py @@ -37,7 +37,7 @@ class QuotientRingElement(RingElement): - ``rep`` -- a representative of the element in `R`; this is used as the internal representation of the element - - ``reduce`` -- bool (default: ``True``) -- if True, then the + - ``reduce`` -- boolean (default: ``True``); if ``True``, then the internal representation of the element is ``rep`` reduced modulo the ideal `I` @@ -121,7 +121,7 @@ def _reduce_(self): def lift(self): """ - If self is an element of `R/I`, then return self as an + If ``self`` is an element of `R/I`, then return ``self`` as an element of `R`. EXAMPLES:: @@ -137,7 +137,7 @@ def lift(self): def __bool__(self): """ - Return ``True`` if quotient ring element is non-zero in the + Return ``True`` if quotient ring element is nonzero in the quotient ring `R/I`, by determining whether the element is in `I`. @@ -159,7 +159,7 @@ def __bool__(self): def is_unit(self): """ - Return ``True`` if self is a unit in the quotient ring. + Return ``True`` if ``self`` is a unit in the quotient ring. EXAMPLES:: @@ -209,7 +209,6 @@ def _repr_(self): sage: Q = S.quo(I) sage: Q.0 Sq(1) - """ from sage.structure.parent_gens import localvars P = self.parent() @@ -462,7 +461,7 @@ def _im_gens_(self, codomain, im_gens, base_map=None): - ``codomain`` -- a ring - - ``im_gens`` -- a tuple of elements `f(x)` in ``codomain``, + - ``im_gens`` -- tuple of elements `f(x)` in ``codomain``, one for each `x` in ``self.parent().gens()``, that define a homomorphism `f` from ``self.parent()`` to ``codomain`` @@ -493,7 +492,7 @@ def _im_gens_(self, codomain, im_gens, base_map=None): def __int__(self): """ - Try to convert self (an element of `R/I`) to an integer by + Try to convert ``self`` (an element of `R/I`) to an integer by converting its lift in `R` to an integer. Return a TypeError if no such conversion can be found. @@ -725,7 +724,6 @@ def lm(self): sage: (a+3*a*b+b).lm() # needs sage.libs.singular a*b - """ return self.__class__(self.parent(), self.__rep.lm()) @@ -783,7 +781,7 @@ def monomials(self): """ Return the monomials in ``self``. - OUTPUT: a list of monomials + OUTPUT: list of monomials EXAMPLES:: @@ -801,12 +799,11 @@ def monomials(self): def _singular_(self, singular=None): """ - Return Singular representation of self. + Return Singular representation of ``self``. INPUT: - - ``singular`` -- a non-standard interpreter may be - provided + - ``singular`` -- a non-standard interpreter may be provided EXAMPLES:: @@ -849,7 +846,7 @@ def _singular_(self, singular=None): def _magma_init_(self, magma): """ - Returns the Magma representation of this quotient ring element. + Return the Magma representation of this quotient ring element. EXAMPLES:: @@ -941,7 +938,7 @@ def reduce(self, G): INPUT: - - ``G`` -- a list of quotient ring elements + - ``G`` -- list of quotient ring elements .. WARNING:: diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index d0ef9a4bb62..7a7ecfa3724 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -151,7 +151,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): cpdef bint is_exact(self) except -2: """ - Returns ``False``, because doubles are not exact. + Return ``False``, because doubles are not exact. EXAMPLES:: @@ -233,7 +233,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): def construction(self): r""" - Returns the functorial construction of ``self``, namely, completion of + Return the functorial construction of ``self``, namely, completion of the rational numbers with respect to the prime at `\infty`. Also preserves other information that makes this field unique (i.e. @@ -462,7 +462,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): def characteristic(self): """ - Returns 0, since the field of real numbers has characteristic 0. + Return 0, since the field of real numbers has characteristic 0. EXAMPLES:: @@ -523,7 +523,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): def pi(self): r""" - Returns `\pi` to double-precision. + Return `\pi` to double-precision. EXAMPLES:: @@ -760,7 +760,7 @@ cdef class RealDoubleElement(FieldElement): def ulp(self): """ - Returns the unit of least precision of ``self``, which is the + Return the unit of least precision of ``self``, which is the weight of the least significant bit of ``self``. This is always a strictly positive number. It is also the gap between this number and the closest number with larger absolute value that @@ -844,7 +844,6 @@ cdef class RealDoubleElement(FieldElement): sage: x = u * 2^52 # smallest normal number sage: x.ulp() == u True - """ # First, check special values if self._value == 0: @@ -1364,7 +1363,7 @@ cdef class RealDoubleElement(FieldElement): def __neg__(self): """ - Negates ``self``. + Negate ``self``. EXAMPLES:: @@ -1377,7 +1376,7 @@ cdef class RealDoubleElement(FieldElement): def conjugate(self): r""" - Returns the complex conjugate of this real number, which is + Return the complex conjugate of this real number, which is the real number itself. EXAMPLES:: @@ -1389,7 +1388,7 @@ cdef class RealDoubleElement(FieldElement): def __abs__(self): """ - Returns the absolute value of ``self``. + Return the absolute value of ``self``. EXAMPLES:: @@ -1410,7 +1409,7 @@ cdef class RealDoubleElement(FieldElement): cpdef RealDoubleElement abs(RealDoubleElement self): """ - Returns the absolute value of ``self``. + Return the absolute value of ``self``. EXAMPLES:: @@ -1454,7 +1453,7 @@ cdef class RealDoubleElement(FieldElement): def multiplicative_order(self): r""" - Returns `n` such that ``self^n == 1``. + Return `n` such that ``self^n == 1``. Only `\pm 1` have finite multiplicative order. @@ -1475,7 +1474,7 @@ cdef class RealDoubleElement(FieldElement): def sign(self): """ - Returns -1,0, or 1 if ``self`` is negative, zero, or positive; + Return -1, 0, or 1 if ``self`` is negative, zero, or positive; respectively. EXAMPLES:: @@ -1600,7 +1599,7 @@ cdef class RealDoubleElement(FieldElement): def _rpy_(self): """ - Returns ``self.__float__()`` for rpy to convert into the + Return ``self.__float__()`` for rpy to convert into the appropriate R object. EXAMPLES:: @@ -1637,7 +1636,7 @@ cdef class RealDoubleElement(FieldElement): 0.333333333333333 If we coerce to a higher-precision field the extra bits appear - random; they are actually 0's in base 2. + random; they are actually 0s in base 2. :: @@ -1802,12 +1801,12 @@ cdef class RealDoubleElement(FieldElement): INPUT: - - ``extend`` -- bool (default: ``True``); if ``True``, return a - square root in a complex field if necessary if ``self`` is negative; + - ``extend`` -- boolean (default: ``True``); if ``True``, return a + square root in a complex field if necessary if ``self`` is negative; otherwise raise a ``ValueError``. - - ``all`` -- bool (default: ``False``); if ``True``, return a - list of all square roots. + - ``all`` -- boolean (default: ``False``); if ``True``, return a + list of all square roots EXAMPLES:: @@ -1858,7 +1857,7 @@ cdef class RealDoubleElement(FieldElement): """ Return whether or not this number is a square in this field. For the real numbers, this is ``True`` if and only if ``self`` is - non-negative. + nonnegative. EXAMPLES:: @@ -1873,7 +1872,7 @@ cdef class RealDoubleElement(FieldElement): def is_integer(self): """ - Return ``True`` if this number is a integer + Return ``True`` if this number is a integer. EXAMPLES:: diff --git a/src/sage/rings/real_double_element_gsl.pyx b/src/sage/rings/real_double_element_gsl.pyx index cf2be375b78..001564dee37 100644 --- a/src/sage/rings/real_double_element_gsl.pyx +++ b/src/sage/rings/real_double_element_gsl.pyx @@ -17,11 +17,11 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): def nth_root(self, int n): """ - Return the `n^{th}` root of ``self``. + Return the `n`-th root of ``self``. INPUT: - - ``n`` -- an integer + - ``n`` -- integer OUTPUT: @@ -502,7 +502,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): the interval `(-\pi, \pi]`. Specifically, it is the unique `x \in (-\pi, \pi]` such - that ```self`` `= x + 2\pi n` for some `n \in \ZZ`. + that ``self`` `= x + 2\pi n` for some `n \in \ZZ`. EXAMPLES:: @@ -546,7 +546,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): def hypot(self, other): r""" - Computes the value `\sqrt{s^2 + o^2}` where `s` is ``self`` and `o` + Compute the value `\sqrt{s^2 + o^2}` where `s` is ``self`` and `o` is ``other`` in such a way as to avoid overflow. EXAMPLES:: diff --git a/src/sage/rings/real_field.py b/src/sage/rings/real_field.py index 8ec8d2348dc..d0302c47ee5 100644 --- a/src/sage/rings/real_field.py +++ b/src/sage/rings/real_field.py @@ -1,4 +1,4 @@ -def create_RealField(prec=53, type="MPFR", rnd="RNDN", sci_not=0): +def create_RealField(prec=53, type='MPFR', rnd='RNDN', sci_not=0): """ Create a real field with given precision, type, rounding mode and scientific notation. @@ -7,7 +7,7 @@ def create_RealField(prec=53, type="MPFR", rnd="RNDN", sci_not=0): INPUT: - - ``prec`` -- a positive integer + - ``prec`` -- positive integer - ``type`` -- type of real field: diff --git a/src/sage/rings/real_interval_absolute.pyx b/src/sage/rings/real_interval_absolute.pyx index e1c60c049c7..50baf63a0e9 100644 --- a/src/sage/rings/real_interval_absolute.pyx +++ b/src/sage/rings/real_interval_absolute.pyx @@ -212,7 +212,7 @@ cdef class RealIntervalAbsoluteField_class(Field): def absprec(self): """ - Returns the absolute precision of self. + Return the absolute precision of ``self``. EXAMPLES:: diff --git a/src/sage/rings/ring_extension_conversion.pyx b/src/sage/rings/ring_extension_conversion.pyx index eeb6077cd0a..482b74552c8 100644 --- a/src/sage/rings/ring_extension_conversion.pyx +++ b/src/sage/rings/ring_extension_conversion.pyx @@ -243,7 +243,7 @@ cdef _backend_morphism(f): return ring.coerce_map_from(domain) raise NotImplementedError -cpdef backend_morphism(f, forget="all"): +cpdef backend_morphism(f, forget='all'): r""" Return the backend morphism of ``f``. @@ -251,8 +251,8 @@ cpdef backend_morphism(f, forget="all"): - ``f`` -- a map - - ``forget`` -- a string, either ``all`` or ``domain`` or ``codomain`` - (default: ``all``); whether to switch to the backend for the domain, + - ``forget`` -- string; either ``'all'`` or ``'domain'`` or ``'codomain'`` + (default: ``'all'``). Whether to switch to the backend for the domain, the codomain or both of them. EXAMPLES:: @@ -269,13 +269,13 @@ cpdef backend_morphism(f, forget="all"): Ring endomorphism of Finite Field in z3 of size 7^3 Defn: z3 |--> 3*z3^2 + 5*z3 - sage: backend_morphism(f, forget="domain") + sage: backend_morphism(f, forget='domain') Ring morphism: From: Finite Field in z3 of size 7^3 To: Field in a with defining polynomial x^3 + 6*x^2 + 4 over its base Defn: z3 |--> 5*a + 3*a^2 - sage: backend_morphism(f, forget="codomain") + sage: backend_morphism(f, forget='codomain') Ring morphism: From: Field in a with defining polynomial x^3 + 6*x^2 + 4 over its base To: Finite Field in z3 of size 7^3 diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index 729793d3bfa..3cd268cd7d3 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -46,7 +46,6 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: K = GF(5^4).over() # needs sage.rings.finite_rings sage: x = K.random_element() # needs sage.rings.finite_rings sage: TestSuite(x).run() # needs sage.rings.finite_rings - """ def __init__(self, RingExtension_generic parent, x, *args, **kwds): r""" @@ -274,7 +273,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): INPUT: - - ``force`` -- a boolean (default: ``False``); if ``False``, + - ``force`` -- boolean (default: ``False``); if ``False``, raise an error if the backend is not exposed EXAMPLES:: @@ -290,7 +289,6 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): 4*z4^3 + 2*z4^2 + 4*z4 + 4 sage: y.parent() Finite Field in z4 of size 5^4 - """ if force or ((self._parent))._is_backend_exposed: return self._backend @@ -341,7 +339,6 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): sage: x = 4*v^7 + v^6 + 3*v^4 + v^3 + v^2 + 4 sage: x.in_base() u - """ cdef RingExtension_generic parent = self._parent if isinstance(parent, RingExtensionWithGen): @@ -572,7 +569,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): INPUT: - - ``root`` -- a boolean (default: ``False``); if ``True``, + - ``root`` -- boolean (default: ``False``); if ``True``, return also a square root EXAMPLES:: @@ -604,16 +601,16 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): INPUT: - - ``extend`` -- a boolean (default: ``True``); if "True", + - ``extend`` -- boolean (default: ``True``); if "True", return a square root in an extension ring, if necessary. Otherwise, raise a :class:`ValueError` if the root is not in the ring - - ``all`` -- a boolean (default: ``False``); if ``True``, - return all square roots of this element, instead of just one. + - ``all`` -- boolean (default: ``False``); if ``True``, + return all square roots of this element, instead of just one - - ``name`` -- Required when ``extend=True`` and ``self`` is not a - square. This will be the name of the generator extension. + - ``name`` -- required when ``extend=True`` and ``self`` is not a + square; this will be the name of the generator extension .. NOTE:: diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index 7a870e80182..2768bdac81c 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -108,7 +108,7 @@ cdef class RingExtensionHomomorphism(RingMap): the action of this morphism on one of the bases of the domain; if ``None``, a coercion map is used - - ``check`` -- a boolean (default: ``True``); whether to check if + - ``check`` -- boolean (default: ``True``); whether to check if the given data define a valid homomorphism TESTS:: @@ -293,7 +293,6 @@ cdef class RingExtensionHomomorphism(RingMap): Field in b with defining polynomial x^3 + (2 + 2*a)*x - a over its base Defn: b |--> 2 + 2*a*b + (2 - a)*b^2 sage: phi.base_map() # needs sage.rings.finite_rings - """ domain = self.domain() codomain = self.codomain() @@ -634,7 +633,6 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): sage: type(f) sage: TestSuite(f).run() - """ def __init__(self, parent): r""" @@ -717,7 +715,6 @@ cdef class MapFreeModuleToRelativeRing(Map): sage: V, i, j = K.free_module() # needs sage.rings.finite_rings sage: type(i) # needs sage.rings.finite_rings - """ def __init__(self, E, K): r""" @@ -740,7 +737,7 @@ cdef class MapFreeModuleToRelativeRing(Map): """ self._degree = E.degree(K) self._basis = [ (x)._backend for x in E.basis_over(K) ] - self._f = backend_morphism(E.defining_morphism(K), forget="codomain") + self._f = backend_morphism(E.defining_morphism(K), forget='codomain') domain = K ** self._degree parent = domain.Hom(E) Map.__init__(self, parent) @@ -804,7 +801,6 @@ cdef class MapRelativeRingToFreeModule(Map): sage: V, i, j = K.free_module() # needs sage.rings.finite_rings sage: type(j) # needs sage.rings.finite_rings - """ def __init__(self, E, K): r""" @@ -829,7 +825,7 @@ cdef class MapRelativeRingToFreeModule(Map): self._degree = (E)._degree_over(K) self._basis = [ (x)._backend for x in E.basis_over(K) ] - f = backend_morphism(E.defining_morphism(K), forget="codomain") + f = backend_morphism(E.defining_morphism(K), forget='codomain') codomain = K ** self._degree Map.__init__(self, E.Hom(codomain)) diff --git a/src/sage/rings/sum_of_squares.pyx b/src/sage/rings/sum_of_squares.pyx index 5cd916690de..1add125e849 100644 --- a/src/sage/rings/sum_of_squares.pyx +++ b/src/sage/rings/sum_of_squares.pyx @@ -132,7 +132,7 @@ cdef int three_squares_c(uint_fast32_t n, uint_fast32_t res[3]) noexcept: def two_squares_pyx(uint32_t n): r""" - Return a pair of non-negative integers ``(i,j)`` such that `i^2 + j^2 = n`. + Return a pair of nonnegative integers ``(i,j)`` such that `i^2 + j^2 = n`. If ``n`` is not a sum of two squares, a ``ValueError`` is raised. The input must be lesser than `2^{32}=4294967296`, otherwise an ``OverflowError`` is @@ -270,7 +270,7 @@ def three_squares_pyx(uint32_t n): def four_squares_pyx(uint32_t n): r""" - Return a 4-tuple of non-negative integers ``(i,j,k,l)`` such that `i^2 + j^2 + Return a 4-tuple of nonnegative integers ``(i,j,k,l)`` such that `i^2 + j^2 + k^2 + l^2 = n` and `i \leq j \leq k \leq l`. The input must be lesser than `2^{32}=4294967296`, otherwise an diff --git a/src/sage/rings/tate_algebra_element.pyx b/src/sage/rings/tate_algebra_element.pyx index 86b0a4dba52..c0679f9949c 100644 --- a/src/sage/rings/tate_algebra_element.pyx +++ b/src/sage/rings/tate_algebra_element.pyx @@ -44,7 +44,7 @@ def _pushout_family(elements, initial=ZZ): INPUT: - - ``elements`` -- a list of elements + - ``elements`` -- list of elements - ``initial`` -- a parent @@ -59,7 +59,6 @@ def _pushout_family(elements, initial=ZZ): sage: _pushout_family([a, x, 3]) Tate Algebra in x (val >= 0), y (val >= 0) over 2-adic Unramified Extension Field in a defined by x^2 + x + 1 - """ from sage.structure.coerce_exceptions import CoercionException from sage.categories.pushout import pushout @@ -88,7 +87,7 @@ cdef class TateAlgebraTerm(MonoidElement): - ``coeff`` -- an element in the base field - - ``exponent`` -- a tuple of length ``n`` + - ``exponent`` -- tuple of length ``n`` EXAMPLES:: @@ -104,17 +103,16 @@ cdef class TateAlgebraTerm(MonoidElement): Traceback (most recent call last): ... TypeError: a term cannot be zero - """ def __init__(self, parent, coeff, exponent=None): """ - Initialize a Tate algebra term + Initialize a Tate algebra term. INPUT: - ``coeff`` -- an element in the base field - - ``exponent`` -- a tuple + - ``exponent`` -- tuple TESTS:: @@ -124,7 +122,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: t = T(x) sage: TestSuite(t).run() - """ MonoidElement.__init__(self, parent) field = parent.base_ring().fraction_field() @@ -163,7 +160,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: hash(t) == hash((t.coefficient(), t.exponent())) True - """ return hash((self._coeff, self._exponent)) @@ -181,7 +177,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...0000000001*x*y sage: 2*t # indirect doctest ...00000000010*x*y - """ cdef TateAlgebraTerm ans = TateAlgebraTerm.__new__(TateAlgebraTerm) ans._parent = self._parent @@ -198,7 +193,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: t = x.leading_term() sage: loads(dumps(t)) == t # indirect doctest True - """ return TateAlgebraTerm, (self.parent(), self._coeff, self._exponent) @@ -226,7 +220,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: T = A.monoid_of_terms() sage: T(2*x*y) # indirect doctest ...00000000010*x*y - """ parent = self._parent if self._coeff._is_atomic() or (-self._coeff)._is_atomic(): @@ -288,7 +281,6 @@ cdef class TateAlgebraTerm(MonoidElement): (2 + O(2^11))*x*y sage: t.coefficient() 2 + O(2^11) - """ return self._coeff @@ -306,7 +298,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: t = T(2,(1,1)) sage: t.exponent() (1, 1) - """ return self._exponent @@ -329,7 +320,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...0000000011*x^2*y sage: s*t # indirect doctest ...00000000110*x^3*y^2 - """ cdef TateAlgebraTerm ans = self._new_c() ans._exponent = self._exponent.eadd((other)._exponent) @@ -376,7 +366,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: t = T(x*y^3) sage: s > t # indirect doctest True - """ cdef long c = other._valuation_c() - self._valuation_c() if not c: @@ -436,7 +425,6 @@ cdef class TateAlgebraTerm(MonoidElement): True sage: s == ss False - """ if op == Py_EQ: return ((self)._coeff == (other)._coeff @@ -460,7 +448,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...0000000011*x^2*y^2 sage: s.monomial() ...0000000001*x^2*y^2 - """ cdef TateAlgebraTerm ans = self._new_c() ans._coeff = self._parent._field(1) @@ -506,7 +493,6 @@ cdef class TateAlgebraTerm(MonoidElement): 0 sage: s.monomial().valuation() -4 - """ cdef TateAlgebraTerm ans = self._new_c() cdef long v = self._exponent.dotprod(self._parent._log_radii) @@ -537,7 +523,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...000000000100*x^2*y^2 sage: t.valuation() -2 - """ return ZZ(self._valuation_c()) @@ -554,7 +539,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...000000000100*x^2*y^2 sage: t.valuation() # indirect doctest 2 - """ return (self._coeff).valuation_c() - self._exponent.dotprod(self._parent._log_radii) @@ -574,7 +558,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: t = M(x*y) sage: t(0, 1) 0 - """ cdef Element ans = self._coeff cdef ETuple exponent = self._exponent @@ -619,7 +602,6 @@ cdef class TateAlgebraTerm(MonoidElement): Traceback (most recent call last): ... TypeError: cannot coerce all the elements to the same parent - """ parent = self._parent if len(args) != parent._ngens: @@ -685,7 +667,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: To = Ao.monoid_of_terms() sage: To(s).is_coprime_with(To(t)) False - """ for i in range(self._parent.ngens()): if self._exponent[i] > 0 and other.exponent()[i] > 0: @@ -722,7 +703,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...000000000100*x*y^3 sage: s.gcd(t) ...000000000100*x*y^2 - """ return self._gcd_c(other) @@ -759,7 +739,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: T = A.monoid_of_terms() sage: T(x^5).gcd(T(y^5)) ...00000.00001 - """ cdef TateAlgebraTerm ans = self._new_c() cdef long val @@ -792,7 +771,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...000000000100*x*y^3 sage: s.lcm(t) ...0000000001000*x^2*y^3 - """ return self._lcm_c(other) @@ -824,7 +802,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: s.gcd(t) * s.lcm(t) == s * t True - """ cdef TateAlgebraTerm ans = self._new_c() cdef long val @@ -842,7 +819,7 @@ cdef class TateAlgebraTerm(MonoidElement): - ``other`` -- a Tate term - - ``integral`` -- (default: ``False``); if ``True``, test + - ``integral`` -- (default: ``False``) if ``True``, test for divisibility in the ring of integers of the Tate algebra EXAMPLES:: @@ -887,7 +864,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: s.is_divisible_by(to) True - """ return (other)._divides_c(self, integral) @@ -900,7 +876,7 @@ cdef class TateAlgebraTerm(MonoidElement): - ``other`` -- a Tate term - - ``integral`` -- (default: ``False``); if ``True``, test for + - ``integral`` -- (default: ``False``) if ``True``, test for divisibility in the ring of integers of the Tate algebra EXAMPLES:: @@ -945,7 +921,6 @@ cdef class TateAlgebraTerm(MonoidElement): sage: to.divides(s) True - """ return self._divides_c(other, integral) @@ -957,7 +932,7 @@ cdef class TateAlgebraTerm(MonoidElement): - ``other`` -- a Tate term - - ``integral`` -- (default: ``False``) if ``True``, test for + - ``integral`` -- boolean (default: ``False``); if ``True``, test for divisibility in the ring of integers of the Tate algebra EXAMPLES:: @@ -971,7 +946,6 @@ cdef class TateAlgebraTerm(MonoidElement): ...000000000100*x*y^3 sage: t.divides(s) # indirect doctest False - """ parent = self._parent if (integral or not parent.base_ring().is_field()) and self.valuation() > other.valuation(): @@ -1007,7 +981,6 @@ cdef class TateAlgebraTerm(MonoidElement): Traceback (most recent call last): ... ValueError: the division is not exact - """ if not self.is_divisible_by(other): raise ValueError("the division is not exact") @@ -1040,7 +1013,6 @@ cdef class TateAlgebraTerm(MonoidElement): Traceback (most recent call last): ... ValueError: the division is not exact - """ cdef TateAlgebraTerm ans = self._new_c() ans._exponent = self.exponent().esub(other.exponent()) @@ -1062,7 +1034,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...00001 + ...00010*x + O(2^5 * ) sage: A(2*x+1, prec=20) ...0000000001 + ...00000000010*x + O(2^20 * ) - """ def __init__(self, parent, x, prec=None, reduce=True): r""" @@ -1073,7 +1044,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: R = Zp(2, prec=10, print_mode='digits') sage: A. = TateAlgebra(R) sage: TestSuite(x).run() - """ cdef TateAlgebraElement xc CommutativeAlgebraElement.__init__(self, parent) @@ -1131,7 +1101,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: A. = TateAlgebra(R) sage: x + y # indirect doctest ...0000000001*x + ...0000000001*y - """ cdef TateAlgebraElement ans = TateAlgebraElement.__new__(TateAlgebraElement) ans._parent = self._parent @@ -1147,7 +1116,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: A. = TateAlgebra(R) sage: A(78612, prec=3) # indirect doctest ...100 + O(2^3 * ) - """ self._is_normalized = True if self._prec is Infinity: @@ -1193,7 +1161,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: A(x + 2*x^2 + x^3, prec=5) ...00001*x^3 + ...00001*x + ...00010*x^2 + O(2^5 * ) - """ base = self._parent.base_ring() nvars = self._parent.ngens() @@ -1307,7 +1274,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): 5 sage: h.precision_absolute() 5 - """ cdef TateAlgebraElement ans = self._new_c() ans._poly = self._poly + (other)._poly @@ -1327,7 +1293,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x^3 + ...0000000001*x + ...00000000010*x^2 sage: -f # indirect doctest ...1111111111*x^3 + ...1111111111*x + ...11111111110*x^2 - """ cdef TateAlgebraElement ans = self._new_c() cdef Element s = self._parent.base_ring()(-1) @@ -1360,7 +1325,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): 5 sage: h.precision_absolute() 5 - """ cdef TateAlgebraElement ans = self._new_c() ans._poly = self._poly - (other)._poly @@ -1393,7 +1357,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): 5 sage: h.precision_absolute() 6 - """ cdef TateAlgebraElement ans = self._new_c() a = self._prec + (other).valuation() @@ -1418,7 +1381,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: 6*f # indirect doctest ...00000000110*x^3 + ...00000000110*x + ...000000001100*x^2 - """ cdef TateAlgebraElement ans = self._new_c() ans._poly = self._poly.scalar_lmult(right) @@ -1431,7 +1393,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``prec`` -- an integer or ``None`` (default: ``None``); + - ``prec`` -- integer or ``None`` (default: ``None``); the precision at which the result is computed, if ``None``, the result is truncated according to the cap of the parent @@ -1462,7 +1424,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ValueError: this series in not invertible - """ cdef TateAlgebraTerm t cdef long v, curprec @@ -1519,7 +1480,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: Ao = A.integer_ring() sage: Ao(f).is_unit() False - """ if self.is_zero(): return False @@ -1544,7 +1504,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(3, prec=4, print_mode="digits") + sage: R = Zp(3, prec=4, print_mode='digits') sage: A. = TateAlgebra(R) sage: (x + y)^3 ...0001*x^3 + ...0001*y^3 + ...0010*x^2*y + ...0010*x*y^2 @@ -1556,7 +1516,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0001 + ...2210*x^2 + ...1100*x^4 + ...2200*y^2 + ...1000*x^6 + ...1000*x^2*y^2 + O(3^4 * ) - or a square root (or more generally a nth root):: + or a square root (or more generally an n-th root):: sage: g = f^(1/2); g ...0001 + ...0010*x^2 + ...1100*x^4 + ...1200*y^2 + ...2000*x^6 @@ -1591,7 +1551,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): True sage: f^(x*y) == (f^y)^x True - """ cdef TateAlgebraElement temp cdef long p, v, e @@ -1630,13 +1589,13 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``prec`` -- an integer or ``None`` (default: ``None``); + - ``prec`` -- integer or ``None`` (default: ``None``); the precision at which the result is computed, if ``None``, the result is truncated according to the cap of the parent EXAMPLES:: - sage: R = Zp(3, prec=10, print_mode="digits") + sage: R = Zp(3, prec=10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 6*x^2 + 9*y^2 sage: g = f.sqrt(); g @@ -1660,7 +1619,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ValueError: not in the domain of convergence - """ return self.nth_root(2, prec) @@ -1671,13 +1629,13 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``prec`` -- an integer or ``None`` (default: ``None``); + - ``prec`` -- integer or ``None`` (default: ``None``); the precision at which the result is computed, if ``None``, the result is truncated according to the cap of the parent EXAMPLES:: - sage: R = Zp(3, prec=10, print_mode="digits") + sage: R = Zp(3, prec=10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 6*x^2 + 9*y^2 sage: g = f.sqrt(); g @@ -1701,30 +1659,29 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ValueError: not in the domain of convergence - """ return self.nth_root(2, prec) def nth_root(self, n=2, prec=None): r""" - Return the ``n``-th root of this series. + Return the `n`-th root of this series. INPUT: - - ``n`` -- an integer (default: ``2``) + - ``n`` -- integer (default: `2`) - - ``prec`` -- an integer or ``None`` (default: ``None``); + - ``prec`` -- integer or ``None`` (default: ``None``); the precision at which the result is computed, if ``None``, the result is truncated according to the cap of the parent .. NOTE:: - The ``n``-th root is computed as `\exp(\frac 1 n \log(f))`. + The `n`-th root is computed as `\exp(\frac 1 n \log(f))`. EXAMPLES:: - sage: R = Zp(3, prec=10, print_mode="digits") + sage: R = Zp(3, prec=10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 9*x^2 + 9*y^2 sage: g = f.nth_root(3, prec=3); g @@ -1745,7 +1702,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ValueError: not in the domain of convergence - """ if n not in ZZ or n == 0: raise ValueError("n must be a nonzero integer") @@ -1835,7 +1791,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): False sage: f == g - 2 True - """ diff = self - other c = None @@ -1907,7 +1862,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f(pi, v) (pi^2 + O(pi^42)) + (1 + O(pi^40))*v^2 - """ cdef TateAlgebraTerm t parent = self._parent @@ -1945,7 +1899,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x^4 + ...0000000001 + ...000000000100*x*y sage: t*f # indirect doctest ...0000000011*x^6 + ...0000000011*x^2 + ...000000001100*x^3*y - """ cdef TateAlgebraElement ans = self._new_c() ans._poly = self._poly.term_lmult(term._exponent, term._coeff) @@ -1959,7 +1912,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- a non-negative integer + - ``n`` -- nonnegative integer EXAMPLES:: @@ -1969,7 +1922,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x^3 + ...0000000001*x + ...00000000010*x^2 sage: f << 2 # indirect doctest ...000000000100*x^3 + ...000000000100*x + ...0000000001000*x^2 - """ cdef dict coeffs = { } cdef ETuple e @@ -1988,7 +1940,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -2003,7 +1955,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...00001*x^3 + ...00001*x + ...00010*x^2 + O(2^5 * ) sage: g << 2 ...0000100*x^3 + ...0000100*x + ...0001000*x^2 + O(2^7 * ) - """ cdef dict coeffs = { } cdef ETuple e @@ -2032,7 +1983,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -2053,7 +2004,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: Ao = A.integer_ring() sage: Ao(f) << -1 ...0000000001*x^2 + ...000000000*x^3 + ...000000000*x - """ return (self)._lshift_c(n) @@ -2064,7 +2014,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -2084,7 +2034,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: Ao = A.integer_ring() sage: Ao(f) << -1 ...0000000001*x^2 + ...000000000*x^3 + ...000000000*x - """ return (self)._lshift_c(-n) @@ -2111,7 +2060,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``prec`` -- an integer or ``None`` (default: ``None``), + - ``prec`` -- integer or ``None`` (default: ``None``), the precision at which the series should be compared to zero EXAMPLES:: @@ -2131,7 +2080,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): False sage: g.is_zero(4) True - """ cdef list terms = self._terms_c(include_zero=False) if prec is None: @@ -2146,7 +2094,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``log_radii`` -- an integer or a tuple; the log-radii of + - ``log_radii`` -- integer or a tuple; the log-radii of convergence of the smaller domain (see :class:`TateAlgebra` for more details) @@ -2167,7 +2115,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f.restriction([-1,-2]) ...00000000010*x + ...0000000001*y^2 - """ parent = self._parent from sage.rings.tate_algebra import TateAlgebra @@ -2193,7 +2140,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = 2*x^2 + x sage: f.terms() [...0000000001*x, ...00000000010*x^2] - """ if not self._is_normalized: self._normalize() @@ -2206,8 +2152,8 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``include_zero`` -- a boolean (default: ``True``); if ``True``, - include terms which are indistinguishable from zero. + - ``include_zero`` -- boolean (default: ``True``); if ``True``, + include terms which are indistinguishable from zero EXAMPLES:: @@ -2216,7 +2162,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = 2*x^2 + x sage: f.terms() # indirect doctest [...0000000001*x, ...00000000010*x^2] - """ cdef pAdicGenericElement c cdef ETuple e @@ -2248,7 +2193,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = 2*x^2 + x sage: f.monomials() # indirect doctest [...0000000001*x, ...0000000001*x^2] - """ return [ t.monomial() for t in self.terms() ] @@ -2264,18 +2208,17 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = 2*x^2 + x sage: f.dict() {(1, 0): ...0000000001, (2, 0): ...00000000010} - """ self._normalize() return dict(self._poly.__repn) def coefficient(self, exponent): r""" - Return the coefficient corresponding to the given exponent + Return the coefficient corresponding to the given exponent. INPUT: - - ``exponent`` -- a tuple of integers + - ``exponent`` -- tuple of integers EXAMPLES:: @@ -2313,11 +2256,11 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): def __getitem__(self, exponent): r""" - Return the coefficient corresponding to the given exponent + Return the coefficient corresponding to the given exponent. INPUT: - - ``exponent`` -- a tuple of integers + - ``exponent`` -- tuple of integers TESTS:: @@ -2348,7 +2291,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = x + 2*x^2 sage: f.coefficients() [...0000000001, ...00000000010] - """ return [ t.coefficient() for t in self.terms() ] @@ -2358,7 +2300,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -2373,7 +2315,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...100000*x + O(2^6 * ) sage: g.precision_absolute() 6 - """ return self._parent(self, prec=n) @@ -2383,7 +2324,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``prec`` -- an integer or ``None`` (default: ``None``); if + - ``prec`` -- integer or ``None`` (default: ``None``); if ``None``, the cap of the parent is used if it is higher than the current precision @@ -2417,7 +2358,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: g.lift_to_precision(20) (1 + O(2^10))*x*y + (1 + O(2^10))*x + (1 + O(2^10))*y + O(2^20 * ) - """ cdef TateAlgebraElement ans = self._new_c() # Hmm, shouldn't we add a keyword argument to lift_to_precision() @@ -2459,7 +2399,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x + ...00000000010*x^2 + O(2^20 * ) sage: g.precision_absolute() 20 - """ return self._prec @@ -2499,7 +2438,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f = x^4 + 4*x*y + 1 sage: f.valuation() -4 - """ cdef TateAlgebraTerm t cdef list terms = self._terms_c() @@ -2549,13 +2487,13 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - `prec` -- an integer or ``None`` (default: ``None``); the + - ``prec`` -- integer or ``None`` (default: ``None``); the absolute precision at which the result is computed, if ``None`` the cap of the Tate algebra is used EXAMPLES:: - sage: R = Zp(3, 10, print_mode="digits") + sage: R = Zp(3, 10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 3*x + 9*y^2 sage: f.log() @@ -2606,7 +2544,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: logf.exp() == f True - """ # This code is mostly copied from sage.rings.padics.padic_generic_element # (should we find a way to share it?) @@ -2711,13 +2648,13 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - `prec` -- an integer or ``None`` (default: ``None``); the + - ``prec`` -- integer or ``None`` (default: ``None``); the absolute precision at which the result is computed, if ``None`` the cap of the Tate algebra is used EXAMPLES:: - sage: R = Zp(3, 10, print_mode="digits") + sage: R = Zp(3, 10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 3*x^2 + 9*y sage: f.exp() @@ -2765,7 +2702,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: expf.log() == f # long time True - """ # This code is mostly copied from sage.rings.padics.padic_generic_element # (should we find a way to share it?) @@ -2815,10 +2751,10 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``secure`` -- a boolean (default: ``False``); if ``True``, + - ``secure`` -- boolean (default: ``False``); if ``True``, raises an error if the leading term cannot be determined due to the existence of terms which are indistinguishable - from zero; if ``False``, discard silently these terms + from zero. If ``False``, discard silently these terms. EXAMPLES:: @@ -2867,7 +2803,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): .. SEEALSO:: :meth:`leading_coefficient`, :meth:`leading_monomial` - """ cdef list terms cdef TateAlgebraTerm term @@ -2896,14 +2831,14 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``secure`` -- a boolean (default: ``False``); if ``True``, + - ``secure`` -- boolean (default: ``False``); if ``True``, raises an error if the leading term cannot be determined due to the existence of terms which are indistinguishable - from zero; if ``False``, discard silently these terms + from zero. If ``False``, discard silently these terms. EXAMPLES:: - sage: R = Zp(2, prec=10, print_mode="terse") + sage: R = Zp(2, prec=10, print_mode='terse') sage: A. = TateAlgebra(R) sage: f = x^4 + 3*x*y + 1; f (1 + O(2^10))*x^4 + (3 + O(2^10))*x*y + (1 + O(2^10)) @@ -2918,7 +2853,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): .. SEEALSO:: :meth:`leading_term`, :meth:`leading_monomial` - """ return self.leading_term(secure=secure).coefficient() @@ -2932,10 +2866,10 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``secure`` -- a boolean (default: ``False``); if ``True``, + - ``secure`` -- boolean (default: ``False``); if ``True``, raises an error if the leading term cannot be determined due to the existence of terms which are indistinguishable - from zero; if ``False``, discard silently these terms + from zero. If ``False``, discard silently these terms. EXAMPLES:: @@ -2954,7 +2888,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): .. SEEALSO:: :meth:`leading_term`, :meth:`leading_coefficient` - """ return self.leading_term(secure=secure).monomial() @@ -2991,7 +2924,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ZeroDivisionError: rational division by zero - """ cdef TateAlgebraElement ans = self._new_c() cdef TateAlgebraTerm t @@ -3026,7 +2958,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...00000000010 + ...0000000001*x*y sage: g.is_monic() False - """ if self.valuation() != 0: return False @@ -3053,7 +2984,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x*y + ...0000000001*y + ...00000000010*x^4 sage: f.weierstrass_degree() 2 - """ v = self.valuation() return self.residue(v+1).degree() @@ -3075,7 +3005,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x*y + ...0000000001*y + ...00000000010*x^4 sage: f.degree() 2 - """ return self.weierstrass_degree() @@ -3096,7 +3025,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x^2 + ...0000000001*y^2 + ...0000000001*y + ...00000000010*x^3 sage: f.weierstrass_degrees() (2, 2) - """ v = self.valuation() return self.residue(v+1).degrees() @@ -3118,7 +3046,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...0000000001*x^2 + ...0000000001*y^2 + ...0000000001*y + ...00000000010*x^3 sage: f.degrees() (2, 2) - """ return self.weierstrass_degrees() @@ -3130,7 +3057,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): INPUT: - - ``n`` -- an integer (default: ``1``) + - ``n`` -- integer (default: `1`) EXAMPLES:: @@ -3147,14 +3074,14 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: f.residue(2).parent() Multivariate Polynomial Ring in x, y over Ring of integers modulo 4 - The residue can only be computed for series with non-negative valuation. + The residue can only be computed for series with nonnegative valuation. sage: g = f >> 2; g ...00000000.01*x^2 + ...00000000.01*y^2 + ...00000000.11*y + ...000000001.1*x^3 sage: g.residue() Traceback (most recent call last): ... - ValueError: element must have non-negative valuation in order to compute residue + ValueError: element must have nonnegative valuation in order to compute residue The residue is not implemented for series with convergence radius different from 1. @@ -3164,7 +3091,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... NotImplementedError: residues are only implemented for radius 1 - """ for r in self._parent.log_radii(): if r != 0: @@ -3175,7 +3101,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): try: Rn = self.base_ring().residue_ring(n) except (AttributeError, NotImplementedError): - Rn = self.base_ring().change(field=False, type="fixed-mod", prec=n) + Rn = self.base_ring().change(field=False, type='fixed-mod', prec=n) poly = self._parent._polynomial_ring(self._poly) return poly.change_ring(Rn) @@ -3187,13 +3113,13 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): - ``divisors`` -- the list of divisors - - ``quo`` -- a boolean, whether we should compute the quotients + - ``quo`` -- boolean; whether we should compute the quotients - - ``rem`` -- a boolean, whether we should compute the remainder + - ``rem`` -- boolean; whether we should compute the remainder TESTS:: - sage: R = Zp(2, 5, print_mode="digits") + sage: R = Zp(2, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 2*x*y + 3*x^2*y + 4*x*y^2 sage: g = x^2 @@ -3202,7 +3128,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...00011*y sage: r ...00001 + ...00010*x*y + ...00100*x*y^2 + O(2^5 * ) - """ cdef dict coeffs = { } cdef TateAlgebraElement f @@ -3260,9 +3185,9 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): - ``divisors`` -- the list of divisors - - ``quo`` -- a boolean, whether we should compute the quotients + - ``quo`` -- boolean; whether we should compute the quotients - - ``rem`` -- a boolean, whether we should compute the remainder + - ``rem`` -- boolean; whether we should compute the remainder TESTS:: @@ -3300,7 +3225,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... TypeError: cannot coerce all the elements to the same parent - """ parent = self.parent() if self.precision_absolute() is Infinity: @@ -3344,7 +3268,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(2, 5, print_mode="digits") + sage: R = Zp(2, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 2*x*y + 3*x^2*y + 4*x*y^2 sage: g = x^2 @@ -3367,7 +3291,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ...00001 + ...01100*x + O(2^5 * ) sage: f == g0*q[0] + g1*q[1] + r True - """ return (self)._quo_rem_check(divisors, True, True) @@ -3382,7 +3305,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(2, 5, print_mode="digits") + sage: R = Zp(2, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 2*x*y + 3*x^2*y + 4*x*y^2 sage: g = x^2 @@ -3395,7 +3318,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: g1 = x*y + 2*x sage: f % [g0, g1] ...00001 + ...01100*x + O(2^5 * ) - """ return (self)._quo_rem_check(divisors, False, True) @@ -3410,7 +3332,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(2, 5, print_mode="digits") + sage: R = Zp(2, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 1 + 2*x*y + 3*x^2*y + 4*x*y^2 sage: g = x^2 @@ -3423,7 +3345,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: g1 = x*y + 2*x sage: f // [g0, g1] [...00011*y, ...11010 + ...00100*y] - """ return (self)._quo_rem_check(divisors, True, False) @@ -3435,7 +3356,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(3, prec=10, print_mode="digits") + sage: R = Zp(3, prec=10, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = 3*x^2 + 5*x*y^2 sage: g = 5*x^2*y + 3 @@ -3456,7 +3377,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): sage: h = A.random_element() sage: (h + s).reduce(I) == h.reduce(I) True - """ return self % I.groebner_basis() @@ -3485,7 +3405,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): EXAMPLES:: - sage: R = Zp(2, 5, print_mode="digits") + sage: R = Zp(2, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = x^3*y + 2*x*y + 4*x^2 sage: g = 2*x*y^2 + 2*x @@ -3501,7 +3421,6 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): Traceback (most recent call last): ... ValueError: the S-polynomial of zero is not defined - """ try: return self._Spoly_c(other) @@ -3520,13 +3439,12 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): We check that the S-polynomial of two monomials vanishes:: - sage: R = Zp(3, 5, print_mode="digits") + sage: R = Zp(3, 5, print_mode='digits') sage: A. = TateAlgebra(R) sage: f = x^3*y^2 sage: g = x^2*y^3 sage: f.Spoly(g) 0 - """ cdef TateAlgebraTerm st = self._terms_c()[0] cdef TateAlgebraTerm ot = other._terms_c()[0] diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 1185e683603..8a481a2b959 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -1177,7 +1177,7 @@ def gp(self): class Fibonacci(Benchmark): def __init__(self, n): self.__n = n - self.repr_str = "Compute the %`s`-th Fibonacci number" % self.__n + self.repr_str = "Compute the %s-th Fibonacci number" % self.__n def sage(self): """ diff --git a/src/sage/topology/cell_complex.py b/src/sage/topology/cell_complex.py index a8cfed7b7c0..38caf541192 100644 --- a/src/sage/topology/cell_complex.py +++ b/src/sage/topology/cell_complex.py @@ -242,7 +242,7 @@ def _n_cells_sorted(self, n, subcomplex=None): def f_vector(self): """ - The `f`-vector of this cell complex: a list whose n-th + The `f`-vector of this cell complex: a list whose `n`-th item is the number of `(n-1)`-cells. Note that, like all lists in Sage, this is indexed starting at 0: the 0th element in this list is the number of `(-1)`-cells (which is 1: the