Skip to content

Commit

Permalink
polys: drop Poly.slice()
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Apr 3, 2023
1 parent 5f71b06 commit 3e19d1c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 29 deletions.
2 changes: 1 addition & 1 deletion diofant/integrals/risch.py
Expand Up @@ -743,7 +743,7 @@ def as_poly_1t(p, t, z):
# a bug.
raise PolynomialError(f'{p} is not an element of K[{t}, 1/{t}].')
d = pd.degree(t)
one_t_part = pa.slice(0, d + 1)
one_t_part = pa % t**(d + 1)
r = pd.degree() - pa.degree()
t_part = pa - one_t_part
t_part = t_part.to_field().exquo(pd)
Expand Down
12 changes: 0 additions & 12 deletions diofant/polys/polytools.py
Expand Up @@ -631,18 +631,6 @@ def retract(self, field=None):
extension=not self.domain.is_ExpressionDomain)
return self.from_dict(rep, *self.gens, domain=dom)

def slice(self, x, m, n=None):
"""Take a continuous subsequence of terms of ``self``."""
if n is None:
j, m, n = 0, x, m
else:
j = self._gen_to_level(x)

m, n = int(m), int(n)

result = self.rep.slice(m, n, j)
return self.per(result)

def coeffs(self, order=None):
"""
Returns all non-zero coefficients from ``self`` in lex order.
Expand Down
16 changes: 0 additions & 16 deletions diofant/tests/polys/test_polytools.py
Expand Up @@ -864,22 +864,6 @@ def test_Poly_retract():
assert Integer(0).as_poly(x, y).retract() == Integer(0).as_poly(x, y)


def test_Poly_slice():
f = (x**3 + 2*x**2 + 3*x + 4).as_poly()

assert f.slice(0, 0) == Integer(0).as_poly(x)
assert f.slice(0, 1) == Integer(4).as_poly(x)
assert f.slice(0, 2) == (3*x + 4).as_poly()
assert f.slice(0, 3) == (2*x**2 + 3*x + 4).as_poly()
assert f.slice(0, 4) == (x**3 + 2*x**2 + 3*x + 4).as_poly()

assert f.slice(x, 0, 0) == Integer(0).as_poly(x)
assert f.slice(x, 0, 1) == Integer(4).as_poly(x)
assert f.slice(x, 0, 2) == (3*x + 4).as_poly()
assert f.slice(x, 0, 3) == (2*x**2 + 3*x + 4).as_poly()
assert f.slice(x, 0, 4) == (x**3 + 2*x**2 + 3*x + 4).as_poly()


def test_Poly_coeffs():
assert Integer(0).as_poly(x).coeffs() == []
assert Integer(1).as_poly(x).coeffs() == [1]
Expand Down
1 change: 1 addition & 0 deletions docs/release/notes-0.14.rst
Expand Up @@ -32,6 +32,7 @@ Compatibility breaks
* Removed unused ``prefixes``, ``postfixes``, ``capture`` and ``variations`` functions, see :pull:`1282` and :pull:`1290`.
* Drop support for multivariate :class:`~diofant.calculus.order.Order` notion, see :pull:`1296`.
* Removed ``Add.extract_leading_order`` method, see :pull:`1292`.
* Removed unused ``slice()`` method of the :class:`~diofant.polys.polytools.Poly`, see :pull:`1318`.

Minor changes
=============
Expand Down

0 comments on commit 3e19d1c

Please sign in to comment.