Skip to content

Commit

Permalink
Adding a slightly more complicated doctest and other small tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Aug 11, 2022
1 parent 3da6b3d commit 8798139
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/sage/rings/polynomial/laurent_polynomial.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial):

@coerce_binop
def quo_rem(self, other):
"""
r"""
Divide ``self`` by ``other`` and return a quotient ``q``
and a remainder ``r`` such that ``self == q * other + r``.
Expand All @@ -1352,7 +1352,8 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial):
sage: (t^-2 + 3 + t).quo_rem(t^-4)
(t^2 + 3*t^4 + t^5, 0)
sage: num, den = t^-2 + t, t^-2 + 1
sage: num = t^-2 + t
sage: den = t^-2 + 1
sage: q, r = num.quo_rem(den)
sage: num == q * den + r
True
Expand All @@ -1361,11 +1362,18 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial):
Check that :trac:`34330` is fixed::
sage: num, den = t^-2 + 3 + t, t^-4 + t
sage: num = t^-2 + 3 + t
sage: den = t^-4 + t
sage: q, r = num.quo_rem(den); q, r
(0, t^-2 + 3 + t)
sage: num == q * den + r
True
sage: num = 2*t^-4 + t^-3 + t^-2 + 2*t + 2*t^2
sage: q, r = num.quo_rem(den); q, r
(2 + 2*t, -t^-3 + t^-2)
sage: num == q * den + r
True
"""
cdef LaurentPolynomial_univariate right = <LaurentPolynomial_univariate> other
q, r = self.__u.quo_rem(right.__u)
Expand Down

0 comments on commit 8798139

Please sign in to comment.