Opened 5 years ago

Closed 5 years ago

#21998 closed defect (fixed)

any_root() sometimes fails over finite fields

Reported by: saraedum Owned by:
Priority: major Milestone: sage-7.5
Component: finite rings Keywords:
Cc: roed Merged in:
Authors: Julian Rüth Reviewers: David Roe
Report Upstream: N/A Work issues:
Branch: e5bcffa (Commits, GitHub, GitLab) Commit: e5bcffa16cfa1a4c5e6e24c0892bc78beabc5920
Dependencies: Stopgaps:

Status badges

Description (last modified by saraedum)

sage: K.<a> = GF(2^4)
sage: R.<x> = K[]
sage: f = x^2 + x + a^2 + a
sage: f.any_root()
ValueError
sage: f.any_root()
a

The algorithm is randomized. It sometimes fails because of a typo.

Change History (10)

comment:1 Changed 5 years ago by saraedum

  • Description modified (diff)

comment:2 Changed 5 years ago by saraedum

  • Branch set to u/saraedum/any_root___sometimes_fails_over_finite_fields

comment:3 Changed 5 years ago by saraedum

  • Commit set to ec1b78b8f1df1cd19d1ef7cb6c656dce23967933
  • Status changed from new to needs_review

New commits:

ec1b78bfix typo in any_root()

comment:4 Changed 5 years ago by roed

  • Reviewers set to David Roe
  • Status changed from needs_review to positive_review

Oops. Looks good.

comment:5 Changed 5 years ago by vbraun

  • Status changed from positive_review to needs_work

I'm getting

6082sage -t --long src/sage/rings/polynomial/polynomial_element.pyx
6083**********************************************************************
6084File "src/sage/rings/polynomial/polynomial_element.pyx", line 1777, in sage.rings.polynomial.polynomial_element.Polynomial.any_root
6085Failed example:
6086    (x**2+x+1).any_root() # used to loop
6087Expected:
6088    Traceback (most recent call last):
6089    ...
6090    ValueError: no roots A 1
6091Got:
6092    a^7 + a^6 + a^4 + a^2 + a + 1
6093**********************************************************************
6094File "src/sage/rings/polynomial/polynomial_element.pyx", line 1810, in sage.rings.polynomial.polynomial_element.Polynomial.any_root
6095Failed example:
6096    f.any_root()
6097Expected:
6098    a
6099Got:
6100    a + 1
6101**********************************************************************
61021 item had failures:
6103   2 of  34 in sage.rings.polynomial.polynomial_element.Polynomial.any_root
6104    [2127 tests, 2 failures, 54.92 s]

comment:6 Changed 5 years ago by saraedum

  • Status changed from needs_work to needs_review

comment:7 Changed 5 years ago by git

  • Commit changed from ec1b78b8f1df1cd19d1ef7cb6c656dce23967933 to e5bcffa16cfa1a4c5e6e24c0892bc78beabc5920

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

1c38d17Fix any_root() doctest
e5bcffaFix doctest

comment:8 Changed 5 years ago by roed

If the patchbot gives it a thumbs up, you can go ahead and set it to positive review.

comment:9 Changed 5 years ago by saraedum

  • Status changed from needs_review to positive_review

comment:10 Changed 5 years ago by vbraun

  • Branch changed from u/saraedum/any_root___sometimes_fails_over_finite_fields to e5bcffa16cfa1a4c5e6e24c0892bc78beabc5920
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.