Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions src/sage/rings/polynomial/multi_polynomial_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.<x,y,z> = 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):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/multi_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
91 changes: 0 additions & 91 deletions src/sage/rings/polynomial/multi_polynomial_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.<x,y> = 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.
Expand Down Expand Up @@ -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.<a,b,c,d> = 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,
Expand Down
84 changes: 2 additions & 82 deletions src/sage/rings/polynomial/polydict.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -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)):
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -582,32 +528,6 @@ cdef class PolyDict:
else:
return max((<ETuple> 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
Expand Down
1 change: 0 additions & 1 deletion src/sage/rings/polynomial/polynomial_element.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
50 changes: 1 addition & 49 deletions src/sage/rings/polynomial/polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -128,55 +128,9 @@
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.<x> = 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.<y> = 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.<x,y> = 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

Expand Down Expand Up @@ -2617,7 +2571,7 @@
sage: x = polygen(K)
sage: pol = x^1000000 + x + a
sage: from sage.doctest.util import ensure_interruptible_after
sage: with ensure_interruptible_after(0.5): pol.any_root()

Check failure on line 2574 in src/sage/rings/polynomial/polynomial_element.pyx

View workflow job for this annotation

GitHub Actions / test-long (src/sage/[p-z]*)

Timed out

/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/cysignals/signals.cpython-312-x86_64-linux-gnu.so(+0x96c4)[0x7fcdd5c586c4] /sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/cysignals/signals.cpython-312-x86_64-linux-gnu.so(+0x9786)[0x7fcdd5c58786] /sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/cysignals/signals.cpython-312-x86_64-linux-gnu.so(+0x9b05)[0x7fcdd5c58b05] /lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x7fcdd61f3330] /lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x7fcdd6246d71] /lib/x86_64-linux-gnu/libc.so.6(+0xa4fb8)[0x7fcdd6252fb8] python3(PyThread_acquire_lock_timed+0xd5)[0x60fec5] python3[0x64d0fa] python3[0x551238] python3(PyObject_Vectorcall+0x35)[0x549825] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3[0x54c9d2] python3[0x549bf7] python3(PyObject_CallFunctionObjArgs+0xa2)[0x549972] /sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/coverage/tracer.cpython-312-x86_64-linux-gnu.so(+0x35f1)[0x7fcdd5ce05f1] python3[0x602683] python3[0x600ff9] python3[0x60188f] python3[0x69c267] python3[0x497283] python3[0x55582f] python3[0x66bac6] python3[0x551742] python3(PyObject_Vectorcall+0x35)[0x549825] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3[0x54ca34] python3(PyObject_Vectorcall+0x35)[0x549825] python3(_PyEval_EvalFrameDefault+0x7c44)[0x5de394] python3(PyEval_EvalCode+0x15b)[0x5d571b] python3[0x5d32ac] python3(_PyEval_EvalFrameDefault+0x3f6c)[0x5da6bc] python3(_PyObject_Call_Prepend+0x18a)[0x54a73a] python3[0x5a3398] python3(_PyObject_MakeTpCall+0x13e)[0x548eee] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3(_PyObject_Call_Prepend+0xc2)[0x54a672] python3[0x59de1f] python3[0x5998f3] python3(_PyObject_MakeTpCall+0x75)[0x548e25] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3(PyEval_EvalCode+0x15b)[0x5d571b] python3[0x5d32ac] python3[0x581ccd] python3(PyObject_Vectorcall+0x35)[0x549825] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3(PyEval_EvalCode+0x15b)[0x5d571b] python3[0x5d32ac] python3[0x581ccd] python3(PyObject_Vectorcall+0x35)[0x549825] python3(_PyEval_EvalFrameDefault+0xa89)[0x5d71d9] python3[0x6bc342] python3(Py_RunMain+0x232)[0x6bbf72] python3(Py_BytesMain+0x2d)[0x6bbbdd] /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7fcdd61d81ca] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7fcdd61d828b] python3(_start+0x25)[0x657005] ------------------------------------------------------------------------ Attaching gdb to process id 5623. Cannot find gdb installed GDB is not installed. Install gdb for enhanced tracebacks. ------------------------------------------------------------------------

Check root computation over large finite fields::

Expand Down Expand Up @@ -7903,8 +7857,6 @@
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
Expand Down
8 changes: 0 additions & 8 deletions src/sage/rings/polynomial/polynomial_quotient_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading
Loading