Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6396 closed defect (fixed)

[with patch, positive review] primes_of_degree_one is broken for relative extensions

Reported by: davidloeffler Owned by: was
Priority: major Milestone: sage-4.1.1
Component: number theory Keywords:
Cc: ncalexan Merged in: sage-4.1.1.alpha0
Authors: David Loeffler Reviewers: Nick Alexander, Minh Van Nguyen
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

This is kind of irritating:

sage: N.<a,b> = NumberField([x^2 + 1, x^2 - 5])
sage: N.primes_of_degree_one_list(10)
[Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1),
 Fractional ideal (1)]

Attachments (2)

trac_6396-deg1primes.patch (9.7 KB) - added by davidloeffler 10 years ago.
trac_6396-reviewer.patch (3.7 KB) - added by mvngu 10 years ago.
reviewer patch; fix minor docstring formatting

Download all attachments as: .zip

Change History (15)

comment:1 Changed 10 years ago by davidloeffler

  • Cc ncalexan added

Here's a patch. Turns out that the bug was due to using the wrong generator. I've set it to use absolute_generator rather than gen, and patched absolute number fields so absolute_generator is an alias for gen in that case. The patch also ReSTifies small_primes_of_degree_one.py and adds it to the reference manual.

(Nick, since he wrote the original code.)

David

comment:2 Changed 10 years ago by ncalexan

  • Summary changed from primes_of_degree_one is broken for relative extensions to [with path, positive review] primes_of_degree_one is broken for relative extensions

This looks good to me, and I am cautiously optimistic that the method will select the same generator on all architectures. Apply.

comment:3 Changed 10 years ago by ncalexan

  • Authors set to David Loeffler
  • Milestone set to sage-4.1
  • Reviewers set to Nick Alexander

comment:4 Changed 10 years ago by davidloeffler

  • Summary changed from [with path, positive review] primes_of_degree_one is broken for relative extensions to [with patch, positive review] primes_of_degree_one is broken for relative extensions

comment:5 Changed 10 years ago by boothby

  • Summary changed from [with patch, positive review] primes_of_degree_one is broken for relative extensions to [with patch, needs work] primes_of_degree_one is broken for relative extensions

Doctest failures when applied to 4.1.alpha1

sage -t -long devel/sage/sage/rings/number_field/small_primes_of_degree_one.py
**********************************************************************
File "/space/boothby/sage-4.1.alpha1/devel/sage-main/sage/rings/number_field/small_primes_of_degree_one.py", line 204:
    sage: N.primes_of_degree_one_list(10)
Expected:
    [Fractional ideal ((-1/2*b + 1/2)*a + 2),
     Fractional ideal (-b*a + 1/2*b + 1/2),
     Fractional ideal ((1/2*b + 3/2)*a - b),
     Fractional ideal ((-1/2*b - 3/2)*a + b - 1),
     Fractional ideal (-b*a - b + 1),
     Fractional ideal (3*a + 1/2*b - 1/2),
     Fractional ideal ((-3/2*b + 1/2)*a + 1/2*b - 1/2),
     Fractional ideal ((-1/2*b - 5/2)*a - b + 1),
     Fractional ideal (2*a - 3/2*b - 1/2),
     Fractional ideal (3*a + 1/2*b + 5/2)]
Got:
    [Fractional ideal (2*a + 1/2*b - 1/2), Fractional ideal ((-1/2*b - 1/2)*a - b), Fractional ideal (b*a + 1/2*b + 3/2), Fractional ideal ((-1/2*b - 3/2)*a + b - 1), Fractional ideal ((-b + 1)*a + b), Fractional ideal (3*a + 1/2*b - 1/2), Fractional ideal ((1/2*b - 1/2)*a + 3/2*b - 1/2), Fractional ideal ((-1/2*b - 5/2)*a - b + 1), Fractional ideal (2*a - 3/2*b - 1/2), Fractional ideal (3*a + 1/2*b + 5/2)]
**********************************************************************
1 items had failures:
   1 of   8 in __main__.example_5
***Test Failed*** 1 failures.
For whitespace errors, see the file /space/boothby/sage-4.1.alpha1/tmp/.doctest_small_primes_of_degree_one.py
         [3.2 s]

comment:6 Changed 10 years ago by davidloeffler

Aargh! Every damn thing we do with ideals seems to return different answers on different platforms -- I've never understood why this is and it's fantastically annoying. The ideals are the same ones, of course, but their string representations are different because Pari picks generators in a totally unpredictable way.

I'll fix this when I get around to it (probably after SD16 is over)

David

Changed 10 years ago by davidloeffler

comment:7 Changed 10 years ago by davidloeffler

Can you try this new patch and see if it works better for you? It works on my machine, but then so did the last one, and there is no sage.math binary of 4.0.2 available AFAIK.

comment:8 Changed 10 years ago by davidloeffler

  • Summary changed from [with patch, needs work] primes_of_degree_one is broken for relative extensions to [with new patch, needs review] primes_of_degree_one is broken for relative extensions

comment:9 Changed 10 years ago by davidloeffler

BTW: having built myself a 4.1.alpha1 on sage.math overnight, I've checked that it passes doctests there too. Can I just reinstate the positive review now, or does it need to be re-reviewed?

comment:10 Changed 10 years ago by davidloeffler

  • Summary changed from [with new patch, needs review] primes_of_degree_one is broken for relative extensions to [with new patch, positive review] primes_of_degree_one is broken for relative extensions

Hello? I'm marking this as "positive review" so it comes to the attention of the release managers for 4.1.1, who can decide as they see fit what to do given the slightly ambiguous status. All that's needed is for someone to check that the doctests pass on both 64-bit and 32-bit.

(I really would prefer it if this patch didn't hang around bitrotting forever -- this is necessary for a major project I'm working on, which seems to have exposed a remarkable number of bugs; see also #6457, #6458, #6462 and #6463.)

Changed 10 years ago by mvngu

reviewer patch; fix minor docstring formatting

comment:11 Changed 10 years ago by mvngu

  • Reviewers changed from Nick Alexander to Nick Alexander, Minh Van Nguyen
  • Summary changed from [with new patch, positive review] primes_of_degree_one is broken for relative extensions to [with patch, positive review] primes_of_degree_one is broken for relative extensions

The patch trac_6396-reviewer.patch makes some adjustment to the docstring introduced by trac_6396-deg1primes.patch, and fixes some typos therein. All tests passed on sage.math (a 64-bit machine) and on my 32-bit Debian Lenny machine. Just to let people know, both patches have been merged in sage-4.1.1-alpha0. I can't close this ticket because I don't have the privilege to do so. Sorry, folks :-(

comment:12 Changed 10 years ago by mvngu

  • Merged in set to sage-4.1.1.alpha0
  • Resolution set to fixed
  • Status changed from new to closed

comment:13 Changed 10 years ago by mvngu

See #6806 for a follow up to this ticket.

Note: See TracTickets for help on using tickets.