Opened 6 years ago

Closed 6 years ago

#18518 closed defect (fixed)

Fix Polynomial.denominator() for high-degree polynomials

Reported by: bruno Owned by:
Priority: major Milestone: sage-6.8
Component: commutative algebra Keywords: polynomial
Cc: Merged in:
Authors: Bruno Grenet Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: ccf004e (Commits, GitHub, GitLab) Commit: ccf004e2de5dff7a317ad87b8eed86955cdbfad9
Dependencies: Stopgaps:

Status badges

Description (last modified by bruno)

Currently, the method Polynomial.denominator does not work with very high-degree (sparse) polynomial:

sage: R.<x> = PolynomialRing(QQ, sparse=True)
sage: p = x^(2^100) - 1/2
sage: p.denominator()
Traceback (most recent call last):
...
OverflowError: cannot fit 'long' into an index-sized integer

This comes from the method using self.list() instead of self.coefficients(). I correct this and obtain:

sage: R.<x> = PolynomialRing(QQ, sparse=True)
sage: p = x^(2^100) - 1/2
sage: p.denominator()
2

Change History (8)

comment:1 Changed 6 years ago by bruno

  • Branch set to u/bruno/denominator

comment:2 Changed 6 years ago by bruno

  • Commit set to 74ae1f63ceb1b4934c9325c10aa48fbf70fbc081
  • Description modified (diff)
  • Status changed from new to needs_review

comment:3 follow-up: Changed 6 years ago by chapoton

  • Status changed from needs_review to needs_work

doc does not build, see patchbot report :

OSError: [polynomia] docstring of sage.rings.polynomial.polynomial_element.Polynomial.denominator:70: WARNING: Literal block expected; none found.

comment:4 Changed 6 years ago by git

  • Commit changed from 74ae1f63ceb1b4934c9325c10aa48fbf70fbc081 to ccf004e2de5dff7a317ad87b8eed86955cdbfad9

Branch pushed to git repo; I updated commit sha1. New commits:

ccf004eCorrect documentation

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

  • Status changed from needs_work to needs_review

Replying to chapoton:

doc does not build, see patchbot report :

OSError: [polynomia] docstring of sage.rings.polynomial.polynomial_element.Polynomial.denominator:70: WARNING: Literal block expected; none found.

Works now!

comment:6 Changed 6 years ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:7 Changed 6 years ago by bruno

Merci Marc !

comment:8 Changed 6 years ago by vbraun

  • Branch changed from u/bruno/denominator to ccf004e2de5dff7a317ad87b8eed86955cdbfad9
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.