Skip to content

Commit e9d6212

Browse files
author
Release Manager
committed
Trac #34557: Fix a doctest error in quo_rem of polynomials
Modify a doctest to fix this failure {{{ sage -t --long --warn-long 162.9 --random-seed=106591066711905509746265618740333072762 src/sage/rings/polynomial/polynomial_element.pyx ********************************************************************** File "src/sage/rings/polynomial/polynomial_element.pyx", line 11653, in sage.rings.polynomial.polynomial_element.Polynomial_generic_dense.quo_re m Failed example: f.quo_rem(g) Expected: Traceback (most recent call last): ... ArithmeticError: division non exact (consider coercing to polynomials over the fraction field) Got: (-7*y^5 + 1/4*y^2 + (-1/2*x + 1/2)*y, 11/2*y^4 + (-x^2 - 1/3*x + 2/3)*y^3 - 1/3*y^2 - y - 1) ********************************************************************** }}} first reported in https://groups.google.com/g/sage-release/c/lolm_ybMtx8/m/4hcocx_EAAAJ URL: https://trac.sagemath.org/34557 Reported by: klee Ticket author(s): Kwankyu Lee Reviewer(s): Matthias Koeppe
2 parents a10ea11 + 04a80af commit e9d6212

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,50 @@
11
# coding: utf-8
22
"""
3-
Univariate Polynomial Base Class
3+
Univariate polynomial base class
4+
5+
TESTS::
6+
7+
sage: R.<x> = ZZ[]
8+
sage: f = x^5 + 2*x^2 + (-1)
9+
sage: f == loads(dumps(f))
10+
True
11+
12+
sage: PolynomialRing(ZZ,'x').objgen()
13+
(Univariate Polynomial Ring in x over Integer Ring, x)
414
515
AUTHORS:
616
7-
- William Stein: first version.
17+
- William Stein: first version
818
9-
- Martin Albrecht: Added singular coercion.
19+
- Martin Albrecht: added singular coercion
1020
11-
- Robert Bradshaw: Move Polynomial_generic_dense to Cython.
21+
- Robert Bradshaw: moved Polynomial_generic_dense to Cython
1222
13-
- Miguel Marco: Implemented resultant in the case where PARI fails.
23+
- Miguel Marco: implemented resultant in the case where PARI fails
1424
15-
- Simon King: Use a faster way of conversion from the base ring.
25+
- Simon King: used a faster way of conversion from the base ring
1626
17-
- Julian Rueth (2012-05-25,2014-05-09): Fixed is_squarefree() for imperfect
18-
fields, fixed division without remainder over QQbar; added ``_cache_key``
19-
for polynomials with unhashable coefficients
27+
- Kwankyu Lee (2013-06-02): enhanced :meth:`quo_rem`
2028
21-
- Simon King (2013-10): Implement copying of :class:`PolynomialBaseringInjection`.
29+
- Julian Rueth (2012-05-25,2014-05-09): fixed is_squarefree() for imperfect
30+
fields, fixed division without remainder over QQbar; added ``_cache_key``
31+
for polynomials with unhashable coefficients
2232
23-
- Kiran Kedlaya (2016-03): Added root counting.
33+
- Simon King (2013-10): implemented copying of :class:`PolynomialBaseringInjection`
2434
25-
- Edgar Costa (2017-07): Added rational reconstruction.
35+
- Bruno Grenet (2014-07-13): enhanced :meth:`quo_rem`
2636
27-
- Kiran Kedlaya (2017-09): Added reciprocal transform, trace polynomial.
37+
- Kiran Kedlaya (2016-03): added root counting
2838
29-
- David Zureick-Brown (2017-09): Added is_weil_polynomial.
39+
- Edgar Costa (2017-07): added rational reconstruction
3040
31-
- Sebastian Oehms (2018-10): made :meth:`roots` and :meth:`factor` work over more
32-
cases of proper integral domains (see :trac:`26421`)
41+
- Kiran Kedlaya (2017-09): added reciprocal transform, trace polynomial
3342
34-
TESTS::
43+
- David Zureick-Brown (2017-09): added is_weil_polynomial
3544
36-
sage: R.<x> = ZZ[]
37-
sage: f = x^5 + 2*x^2 + (-1)
38-
sage: f == loads(dumps(f))
39-
True
45+
- Sebastian Oehms (2018-10): made :meth:`roots` and :meth:`factor` work over more
46+
cases of proper integral domains (see :trac:`26421`)
4047
41-
sage: PolynomialRing(ZZ,'x').objgen()
42-
(Univariate Polynomial Ring in x over Integer Ring, x)
4348
"""
4449

4550
# ****************************************************************************
@@ -11336,7 +11341,7 @@ cdef class Polynomial_generic_dense(Polynomial):
1133611341
sage: class BrokenRational(Rational):
1133711342
....: def __bool__(self):
1133811343
....: raise NotImplementedError("cannot check whether number is non-zero")
11339-
....:
11344+
....:
1134011345
sage: z = BrokenRational()
1134111346
sage: R.<x> = QQ[]
1134211347
sage: from sage.rings.polynomial.polynomial_element import Polynomial_generic_dense
@@ -11636,18 +11641,12 @@ cdef class Polynomial_generic_dense(Polynomial):
1163611641
Raises a ``ZerodivisionError`` if ``other`` is zero. Raises an
1163711642
``ArithmeticError`` if the division is not exact.
1163811643
11639-
AUTHORS:
11640-
11641-
- Kwankyu Lee (2013-06-02)
11642-
11643-
- Bruno Grenet (2014-07-13)
11644-
1164511644
EXAMPLES::
1164611645
1164711646
sage: P.<x> = QQ[]
1164811647
sage: R.<y> = P[]
11649-
sage: f = R.random_element(10)
11650-
sage: g = y^5+R.random_element(4)
11648+
sage: f = y^10 + R.random_element(9)
11649+
sage: g = y^5 + R.random_element(4)
1165111650
sage: q,r = f.quo_rem(g)
1165211651
sage: f == q*g + r
1165311652
True

0 commit comments

Comments
 (0)