diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py index add2d6c2b5e..0564856ef32 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal.py +++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py @@ -307,45 +307,6 @@ def __call__(self, *args, **kwds): require_field = RequireField -def is_MPolynomialIdeal(x) -> bool: - """ - Return ``True`` if the provided argument ``x`` is an ideal in a - multivariate polynomial ring. - - INPUT: - - - ``x`` -- an arbitrary object - - EXAMPLES:: - - sage: from sage.rings.polynomial.multi_polynomial_ideal import is_MPolynomialIdeal - sage: P. = PolynomialRing(QQ) - sage: I = [x + 2*y + 2*z - 1, x^2 + 2*y^2 + 2*z^2 - x, 2*x*y + 2*y*z - y] - - Sage distinguishes between a list of generators for an ideal and - the ideal itself. This distinction is inconsistent with Singular - but matches Magma's behavior. :: - - sage: is_MPolynomialIdeal(I) - doctest:warning... - DeprecationWarning: The function is_MPolynomialIdeal is deprecated; - use 'isinstance(..., MPolynomialIdeal)' instead. - See https://github.com/sagemath/sage/issues/38266 for details. - False - - :: - - sage: I = Ideal(I) - sage: is_MPolynomialIdeal(I) - True - """ - from sage.misc.superseded import deprecation - deprecation(38266, - "The function is_MPolynomialIdeal is deprecated; " - "use 'isinstance(..., MPolynomialIdeal)' instead.") - return isinstance(x, MPolynomialIdeal) - - class MPolynomialIdeal_magma_repr: def _magma_init_(self, magma): """ diff --git a/src/sage/rings/polynomial/multi_polynomial_ring.py b/src/sage/rings/polynomial/multi_polynomial_ring.py index a08c7a025d1..8783aa4e447 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring.py +++ b/src/sage/rings/polynomial/multi_polynomial_ring.py @@ -62,7 +62,7 @@ import sage.rings.fraction_field_element as fraction_field_element -from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base, is_MPolynomialRing +from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base from sage.rings.polynomial.polynomial_singular_interface import PolynomialRing_singular_repr from sage.rings.polynomial.polydict import PolyDict, ETuple from sage.rings.polynomial.term_order import TermOrder diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index e2a766b8e3a..b3804b5c8ab 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -29,14 +29,6 @@ from sage.rings.polynomial.polynomial_ring_constructor import (PolynomialRing, from sage.rings.polynomial.polydict cimport ETuple -def is_MPolynomialRing(x): - from sage.misc.superseded import deprecation_cython - deprecation_cython(38266, - "The function is_MPolynomialRing is deprecated; " - "use 'isinstance(..., MPolynomialRing_base)' instead.") - return isinstance(x, MPolynomialRing_base) - - cdef class MPolynomialRing_base(CommutativeRing): def __init__(self, base_ring, n, names, order): """ diff --git a/src/sage/rings/polynomial/multi_polynomial_sequence.py b/src/sage/rings/polynomial/multi_polynomial_sequence.py index 6c90ceb7557..314b08d835d 100644 --- a/src/sage/rings/polynomial/multi_polynomial_sequence.py +++ b/src/sage/rings/polynomial/multi_polynomial_sequence.py @@ -185,32 +185,6 @@ singular_gb_standard_options = libsingular_gb_standard_options = MethodDecorator -def is_PolynomialSequence(F): - """ - Return ``True`` if ``F`` is a ``PolynomialSequence``. - - INPUT: - - - ``F`` -- anything - - EXAMPLES:: - - sage: P. = PolynomialRing(QQ) - sage: I = [[x^2 + y^2], [x^2 - y^2]] - sage: F = Sequence(I, P); F - [x^2 + y^2, x^2 - y^2] - - sage: from sage.rings.polynomial.multi_polynomial_sequence import PolynomialSequence_generic - sage: isinstance(F, PolynomialSequence_generic) - True - """ - from sage.misc.superseded import deprecation - deprecation(38266, - "The function is_PolynomialSequence is deprecated; " - "use 'isinstance(..., PolynomialSequence_generic)' instead.") - return isinstance(F, PolynomialSequence_generic) - - def PolynomialSequence(arg1, arg2=None, immutable=False, cr=False, cr_str=None): """ Construct a new polynomial sequence object. @@ -790,71 +764,6 @@ def coefficients_monomials(self, order=None, sparse=True): raise ValueError("order argument does not contain all monomials") return A, vector(v) - def coefficient_matrix(self, sparse=True): - """ - Return tuple ``(A,v)`` where ``A`` is the coefficient matrix - of this system and ``v`` the matching monomial vector. - - Thus value of ``A[i,j]`` corresponds the coefficient of the - monomial ``v[j]`` in the ``i``-th polynomial in this system. - - Monomials are order w.r.t. the term ordering of - ``self.ring()`` in reverse order, i.e. such that the smallest - entry comes last. - - INPUT: - - - ``sparse`` -- construct a sparse matrix (default: ``True``) - - EXAMPLES:: - - sage: # needs sage.libs.singular - sage: P. = PolynomialRing(GF(127), 4) - sage: I = sage.rings.ideal.Katsura(P) - sage: I.gens() - [a + 2*b + 2*c + 2*d - 1, - a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a, - 2*a*b + 2*b*c + 2*c*d - b, - b^2 + 2*a*c + 2*b*d - c] - sage: F = Sequence(I) - sage: A,v = F.coefficient_matrix() - doctest:warning... - DeprecationWarning: the function coefficient_matrix is deprecated; use coefficients_monomials instead - See https://github.com/sagemath/sage/issues/37035 for details. - sage: A - [ 0 0 0 0 0 0 0 0 0 1 2 2 2 126] - [ 1 0 2 0 0 2 0 0 2 126 0 0 0 0] - [ 0 2 0 0 2 0 0 2 0 0 126 0 0 0] - [ 0 0 1 2 0 0 2 0 0 0 0 126 0 0] - sage: v - [a^2] - [a*b] - [b^2] - [a*c] - [b*c] - [c^2] - [b*d] - [c*d] - [d^2] - [ a] - [ b] - [ c] - [ d] - [ 1] - sage: A*v - [ a + 2*b + 2*c + 2*d - 1] - [a^2 + 2*b^2 + 2*c^2 + 2*d^2 - a] - [ 2*a*b + 2*b*c + 2*c*d - b] - [ b^2 + 2*a*c + 2*b*d - c] - """ - from sage.matrix.constructor import matrix - from sage.misc.superseded import deprecation - deprecation(37035, "the function coefficient_matrix is deprecated; use coefficients_monomials instead") - - R = self.ring() - A, v = self.coefficients_monomials(sparse=sparse) - return A, matrix(R, len(v), 1, v) - def macaulay_matrix(self, degree, homogeneous=False, variables=None, diff --git a/src/sage/rings/polynomial/polydict.pyx b/src/sage/rings/polynomial/polydict.pyx index 6f1ded17e35..605a2fb9424 100644 --- a/src/sage/rings/polynomial/polydict.pyx +++ b/src/sage/rings/polynomial/polydict.pyx @@ -97,7 +97,7 @@ cdef class PolyDict: r""" Data structure for multivariate polynomials. - A PolyDict holds a dictionary all of whose keys are :class:`ETuple` and + A ``PolyDict`` holds a dictionary all of whose keys are :class:`ETuple` and whose values are coefficients on which it is implicitly assumed that arithmetic operations can be performed. @@ -107,23 +107,13 @@ cdef class PolyDict: can use the method :meth:`remove_zeros` which can be parametrized by a zero test. """ - def __init__(self, pdict, zero=None, remove_zero=None, - force_int_exponents=None, force_etuples=None, - bint check=True) -> None: + def __init__(self, pdict, bint check=True) -> None: """ INPUT: - ``pdict`` -- dictionary or list, which represents a multi-variable polynomial with the distribute representation (a copy is made) - - ``zero`` -- deprecated - - - ``remove_zero`` -- deprecated - - - ``force_int_exponents`` -- deprecated - - - ``force_etuples`` -- deprecated - - ``check`` -- if set to ``False`` then assumes that the exponents are all valid ``ETuple``; in that case the construction is a bit faster @@ -145,23 +135,7 @@ cdef class PolyDict: sage: f = PolyDict({(2, 3): 2, (1, 2): 3, (2, 1): 4}) sage: len(f) 3 - sage: f = PolyDict({}, zero=3, force_int_exponents=True, force_etuples=True) - doctest:warning - ... - DeprecationWarning: the arguments "zero", "forced_int_exponents" - and "forced_etuples" of PolyDict constructor are deprecated - See https://github.com/sagemath/sage/issues/34000 for details. - sage: f = PolyDict({}, remove_zero=False) - doctest:warning - ... - DeprecationWarning: the argument "remove_zero" of PolyDict - constructor is deprecated; call the method remove_zeros - See https://github.com/sagemath/sage/issues/34000 for details. """ - if zero is not None or force_int_exponents is not None or force_etuples is not None: - from sage.misc.superseded import deprecation - deprecation(34000, 'the arguments "zero", "forced_int_exponents" and "forced_etuples" of PolyDict constructor are deprecated') - self.__repn = {} cdef bint has_only_etuple = True if isinstance(pdict, (tuple, list)): @@ -186,12 +160,6 @@ cdef class PolyDict: else: raise TypeError("pdict must be a dict or a list of pairs (coeff, exponent)") - if remove_zero is not None: - from sage.misc.superseded import deprecation - deprecation(34000, 'the argument "remove_zero" of PolyDict constructor is deprecated; call the method remove_zeros') - if remove_zero: - self.remove_zeros() - cdef PolyDict _new(self, dict pdict): cdef PolyDict ans = PolyDict.__new__(PolyDict) ans.__repn = pdict @@ -276,28 +244,6 @@ cdef class PolyDict: for k, v in self.__repn.items(): self.__repn[k] = f(v) - def coerce_coefficients(self, A): - r""" - Coerce the coefficients in the parent ``A``. - - EXAMPLES:: - - sage: from sage.rings.polynomial.polydict import PolyDict - sage: f = PolyDict({(2, 3): 0}) - sage: f - PolyDict with representation {(2, 3): 0} - sage: f.coerce_coefficients(QQ) - doctest:warning - ... - DeprecationWarning: coerce_cefficients is deprecated; use apply_map instead - See https://github.com/sagemath/sage/issues/34000 for details. - sage: f - PolyDict with representation {(2, 3): 0} - """ - from sage.misc.superseded import deprecation - deprecation(34000, 'coerce_cefficients is deprecated; use apply_map instead') - self.apply_map(A.coerce) - def __hash__(self) -> int: """ Return the hash. @@ -582,32 +528,6 @@ cdef class PolyDict: else: return max(( e).weighted_degree(w) for e in self.__repn) - def monomial_coefficient(self, mon): - """ - Return the coefficient of the monomial ``mon``. - - INPUT: - - - ``mon`` -- a PolyDict with a single key - - EXAMPLES:: - - sage: from sage.rings.polynomial.polydict import PolyDict - sage: f = PolyDict({(2,3):2, (1,2):3, (2,1):4}) - sage: f.monomial_coefficient(PolyDict({(2,1):1}).dict()) - doctest:warning - ... - DeprecationWarning: PolyDict.monomial_coefficient is deprecated; use PolyDict.get instead - See https://github.com/sagemath/sage/issues/34000 for details. - 4 - """ - from sage.misc.superseded import deprecation - deprecation(34000, 'PolyDict.monomial_coefficient is deprecated; use PolyDict.get instead') - K, = mon.keys() - if K not in self.__repn: - return 0 - return self.__repn[K] - def polynomial_coefficient(self, degrees): """ Return a polydict that defines the coefficient in the current diff --git a/src/sage/rings/polynomial/polynomial_element.pxd b/src/sage/rings/polynomial/polynomial_element.pxd index 45e64ce6744..2ae5c528ced 100644 --- a/src/sage/rings/polynomial/polynomial_element.pxd +++ b/src/sage/rings/polynomial/polynomial_element.pxd @@ -56,7 +56,6 @@ cdef class Polynomial_generic_dense(Polynomial): cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): pass -cpdef is_Polynomial(f) cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec) cpdef list _dict_to_list(dict x, zero) diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index d040cc19858..c84342f5cbc 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -128,55 +128,9 @@ from sage.misc.cachefunc import cached_function from sage.categories.map cimport Map from sage.categories.morphism cimport Morphism -from sage.misc.superseded import deprecation_cython as deprecation, deprecated_function_alias +from sage.misc.superseded import deprecation_cython as deprecation from sage.misc.cachefunc import cached_method -cpdef is_Polynomial(f): - """ - Return ``True`` if ``f`` is of type univariate polynomial. - - This function is deprecated. - - INPUT: - - - ``f`` -- an object - - EXAMPLES:: - - sage: from sage.rings.polynomial.polynomial_element import is_Polynomial - sage: R. = ZZ[] - sage: is_Polynomial(x^3 + x + 1) - doctest:...: DeprecationWarning: the function is_Polynomial is deprecated; - use isinstance(x, sage.rings.polynomial.polynomial_element.Polynomial) instead - See https://github.com/sagemath/sage/issues/32709 for details. - True - sage: S. = R[] - sage: f = y^3 + x*y - 3*x; f - y^3 + x*y - 3*x - sage: is_Polynomial(f) - True - - However this function does not return ``True`` for genuine multivariate - polynomial type objects or symbolic polynomials, since those are - not of the same data type as univariate polynomials:: - - sage: R. = QQ[] - sage: f = y^3 + x*y - 3*x; f - y^3 + x*y - 3*x - sage: is_Polynomial(f) - False - - sage: # needs sage.symbolic - sage: var('x,y') - (x, y) - sage: f = y^3 + x*y - 3*x; f - y^3 + x*y - 3*x - sage: is_Polynomial(f) - False - """ - deprecation(32709, "the function is_Polynomial is deprecated; use isinstance(x, sage.rings.polynomial.polynomial_element.Polynomial) instead") - - return isinstance(f, Polynomial) from sage.rings.polynomial.polynomial_compiled cimport CompiledPolynomialFunction @@ -7903,8 +7857,6 @@ cdef class Polynomial(CommutativePolynomial): R = R.monic() return R - adams_operator = deprecated_function_alias(36396, adams_operator_on_roots) - def symmetric_power(self, k, monic=False): r""" Return the polynomial whose roots are products of `k`-th distinct diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py index 85bd455ff6f..1edd3aa016a 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py @@ -258,14 +258,6 @@ def create_object(self, version, key): PolynomialQuotientRing = PolynomialQuotientRingFactory("PolynomialQuotientRing") -def is_PolynomialQuotientRing(x): - from sage.misc.superseded import deprecation - deprecation(38266, - "The function is_PolynomialQuotientRing is deprecated; " - "use 'isinstance(..., PolynomialQuotientRing_generic)' instead.") - return isinstance(x, PolynomialQuotientRing_generic) - - class PolynomialQuotientRing_generic(QuotientRing_generic): """ Quotient of a univariate polynomial ring by an ideal. diff --git a/src/sage/rings/polynomial/polynomial_ring.py b/src/sage/rings/polynomial/polynomial_ring.py index 0da5acc6908..b32f54840e5 100644 --- a/src/sage/rings/polynomial/polynomial_ring.py +++ b/src/sage/rings/polynomial/polynomial_ring.py @@ -181,62 +181,7 @@ import sage.interfaces.abc -def is_PolynomialRing(x): - """ - Return ``True`` if ``x`` is a *univariate* polynomial ring (and not a - sparse multivariate polynomial ring in one variable). - - EXAMPLES:: - - sage: from sage.rings.polynomial.polynomial_ring import is_PolynomialRing - sage: from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing - sage: is_PolynomialRing(2) - doctest:warning... - DeprecationWarning: The function is_PolynomialRing is deprecated; - use 'isinstance(..., PolynomialRing_generic)' instead. - See https://github.com/sagemath/sage/issues/38266 for details. - False - - This polynomial ring is not univariate. - - :: - - sage: is_PolynomialRing(ZZ['x,y,z']) - False - sage: is_MPolynomialRing(ZZ['x,y,z']) - doctest:warning... - DeprecationWarning: The function is_MPolynomialRing is deprecated; - use 'isinstance(..., MPolynomialRing_base)' instead. - See https://github.com/sagemath/sage/issues/38266 for details. - True - - :: - - sage: is_PolynomialRing(ZZ['w']) - True - - Univariate means not only in one variable, but is a specific data - type. There is a multivariate (sparse) polynomial ring data type, - which supports a single variable as a special case. - - :: - - sage: # needs sage.libs.singular - sage: R. = PolynomialRing(ZZ, implementation='singular'); R - Multivariate Polynomial Ring in w over Integer Ring - sage: is_PolynomialRing(R) - False - sage: type(R) - - """ - deprecation(38266, - "The function is_PolynomialRing is deprecated; " - "use 'isinstance(..., PolynomialRing_generic)' instead.") - return isinstance(x, PolynomialRing_generic) - - -######################################################################################### - +########################################################### class PolynomialRing_generic(Ring): """ Univariate polynomial ring over a ring.