Ticket #12026 (closed defect: fixed)

Opened 18 months ago

Last modified 18 months ago

root finding misses a root over QQbar

Reported by: was Owned by: AlexGhitza
Priority: critical Milestone: sage-4.8
Component: algebra Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Keshav Kini
Authors: William Stein Merged in: sage-4.8.alpha2
Dependencies: Stopgaps:

Description (last modified by kini) (diff)

sage: A = matrix(QQ, 8, lambda i, j: 1/(i + j + 1))
sage: f = A.charpoly()
sage: f.degree()
8
sage: f.is_squarefree()   # so f must have 8 roots over the algebraic closure.
True
sage: len(f.roots(QQbar))      # VERY BAD
7

At least the roots that are found are really roots:

sage: [f(a[0])==0 for a in f.roots(QQbar)]
[True, True, True, True, True, True, True]

Apply:

  1. trac_12026.patch Download
  2. trac_12026.reviewer.patch Download

Attachments

trac_12026.patch Download (1.7 KB) - added by was 18 months ago.
trac_12026.reviewer.patch Download (632 bytes) - added by kini 18 months ago.
apply to $SAGE_ROOT/devel/sage

Change History

comment:1 Changed 18 months ago by dsm

See also trac #10803.

Changed 18 months ago by was

comment:2 Changed 18 months ago by was

  • Status changed from new to needs_review

comment:3 Changed 18 months ago by kini

  • Status changed from needs_review to positive_review
  • Reviewers set to Keshav Kini
  • Authors set to William Stein

Patch looks good. make ptestlong passes on sage.math. Positive review from me.

comment:4 follow-up: ↓ 5 Changed 18 months ago by jdemeyer

  • Status changed from positive_review to needs_work

William, correct syntax is

TESTS:

Verify that trac 12026 is fixed:: 

Note the single colon after TESTS because it is not followed by Sage commands but by a textual comment.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 8 Changed 18 months ago by was

  • Status changed from needs_work to needs_review

Replying to jdemeyer:

William, correct syntax is

TESTS:

Verify that trac 12026 is fixed:: 

Note the single colon after TESTS because it is not followed by Sage commands but by a textual comment.

I prefer to put two colons for several reasons: (1) consistency, (2) if somebody adds a new example above mine with just an example (and no text) it will just work, and (3) it works just fine as I did it -- see  http://wstein.org/home/wstein/tmp/a.png

comment:6 Changed 18 months ago by kini

Jeroen has a good point - this is technically incorrect ReST:

fs@zhenghe /tmp $ cat test.rst
Check out this literal block::

Ha, gotcha
fs@zhenghe /tmp $ python -c "from docutils.core import publish_string ; print publish_string(open('test.rst').read())"
<string>:3: (WARNING/2) Literal block expected; none found.
<document source="<string>">
    <paragraph>
        Check out this literal block:
    <system_message level="2" line="3" source="<string>" type="WARNING">
        <paragraph>
            Literal block expected; none found.
    <paragraph>
        Ha, gotcha

fs@zhenghe /tmp $ 

This brings (3) into question. I don't see what you mean by (1). (2) is certainly true but that's not a good reason to use incorrect syntax, IMO. I'll attach a reviewer patch.

Changed 18 months ago by kini

apply to $SAGE_ROOT/devel/sage

comment:7 Changed 18 months ago by kini

  • Status changed from needs_review to positive_review
  • Description modified (diff)

comment:8 in reply to: ↑ 5 Changed 18 months ago by jdemeyer

Replying to was:

(3) it works just fine as I did it -- see  http://wstein.org/home/wstein/tmp/a.png

kini is right, this is not correct syntax. I agree that Sphinx only gives a WARNING (not an ERROR) but I reject all such patches.

comment:9 Changed 18 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.8.alpha2
Note: See TracTickets for help on using tickets.