Opened 4 years ago

Closed 4 years ago

#18467 closed defect (fixed)

PolynomialRealDense.quo_rem() returns zero polynomials with wrong degree

Reported by: pbruin Owned by:
Priority: major Milestone: sage-6.8
Component: basic arithmetic Keywords: polynomial degree quo_rem
Cc: Merged in:
Authors: Peter Bruin Reviewers: Bruno Grenet
Report Upstream: N/A Work issues:
Branch: 9dc90cc (Commits) Commit: 9dc90cc9367a016745c85326d7a8abfabe2e3d53
Dependencies: Stopgaps:

Description

In Sage 6.7, the following is correct:

sage: R.<x> = QQ[]
sage: z = R.zero()
sage: z.degree()
-1
sage: q, r = z.quo_rem(x)
sage: q.degree()
-1

The following (QQ -> RR) is not:

sage: S.<x> = RR[]
sage: z = S.zero()
sage: z.degree()
-1
sage: q, r = z.quo_rem(x)
sage: q.degree()
-2

The last result should be -1; the given answer implies for example

sage: q == z
False

which is nonsense since q and z are both the zero polynomial.

Change History (5)

comment:1 Changed 4 years ago by pbruin

  • Authors set to Peter Bruin
  • Branch set to u/pbruin/18467-quo_rem
  • Commit set to 9dc90cc9367a016745c85326d7a8abfabe2e3d53
  • Status changed from new to needs_review

comment:2 follow-up: Changed 4 years ago by bruno

  • Reviewers set to Bruno Grenet

Looks fine to me! A minor comment: It seems that people prefer not referring to `self` in the documentation, so you could replace the documentation of this function by

Return the quotient with remainder of this polynomial by ``other``.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 4 years ago by pbruin

Replying to bruno:

Looks fine to me! A minor comment: It seems that people prefer not referring to `self` in the documentation

If you really insist I can change it, but I personally prefer self over this polynomial (see comment:5:ticket:13442).

There was some recent discussion on a related question, namely whether self should be documented in INPUT sections of methods. On that question I agree with most people that it should not.

comment:4 in reply to: ↑ 3 Changed 4 years ago by bruno

  • Status changed from needs_review to positive_review

Replying to pbruin:

Replying to bruno:

Looks fine to me! A minor comment: It seems that people prefer not referring to `self` in the documentation

If you really insist I can change it, but I personally prefer self over this polynomial (see comment:5:ticket:13442).

There was some recent discussion on a related question, namely whether self should be documented in INPUT sections of methods. On that question I agree with most people that it should not.

Actually, I was referring to (the beginning of) this discussion. Yet there does not seem to be a consensus. And I do not have a strong opinion on this... so I do not insist!

comment:5 Changed 4 years ago by vbraun

  • Branch changed from u/pbruin/18467-quo_rem to 9dc90cc9367a016745c85326d7a8abfabe2e3d53
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.