-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weird bug creating fractional ideal in relative number field #1367
Comments
comment:2
This might well be fixed by the patches posted for #1946. Unfortunately I do not seem to be able to test that, owing to my complete incompetence in applying patches, even my own. It would be a good idea if #1946 was cross-referenced to this one. In case this seems crazy: fixing #1946 by adding lots of doctests to the code for Tate's algorithm over number fields revealed some minor bugs in its implementation, and fixing those revealed some bugs in the code for ideals and fractional ideals in number fields. I fixed that (in late January, partly jointly with William) and at the same time -- I seem to remember -- fixed this thing about ideals in relative extensions. Both the patches attached to #1946 are waiting review.... |
comment:3
This is still broken in sage-3.0. |
comment:4
The problem is triggered at line 89 of
In the case above , Rather than trying to resolve the general problem with this coercion, it's easy to rewrite the above line 89, as in
|
Attachment: sage-1367.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:5
Hi Francis, I changed the title slightly so our various sql queries pick it up. Cheers, Michael |
comment:6
Hi, Two things. First, the patch needs at least one doctest. Second, something very fishy is going on. After applying this patch, I try out the example at the top of the definition of
If
which is not +1 or -1. |
comment:7
Continuing the calculation, we have
and The problem is with lines 90–92 of
which seem totally wrong-headed. In the case in question There must be a much simpler way to achieve the object of ensuring that the generator is an element of the relative field. |
comment:8
Oh look, the patch is probably fine, but I go completely nuts every time I delve into any of the algebraic number theory stuff in Sage. I mean, why on earth is I suggest that you (1) report the above as a separate ticket, (2) add a doctest to your patch to at least illustrate the corrected behaviour, (3) "correct" the doctest under the WARNING so at least it doesn't fail when doctests are run, (4) do a full run of doctests to see what else "breaks", (5) replace "Willia Stein" by "William Stein" in the authors at the top of the file, and (6) find someone else game enough to review this patch. |
comment:9
I spent several evening 6 months ago on this chunk of code, trying to see how it was supposed to work and fixing what didn't. It was not a very happy experience -- not helped by the fact that this was just about the first ever Sage development which I did. On the other hand, I was helped a lot at the time by William. Th eonly reason I got into that code at all was that I decided to add doctests to Anyway, while I cannot guarantee to have time to review this properly soon, I'll do what I can. |
comment:10
The more I look at
(1) The generator of the absolute field is always called 'a'; it would be much better if the user could choose the name, and, even better, was also able to get the absolute ideal via something like I've come to the conclusion that a more serious rewrite (with some more testing doctests) is needed, for which I'm unlikely to have much time in the next few weeks. My one-line patch was really only meant to point out where the defect lay. |
comment:11
I have made a new ticket #3680 to cover my general gripes about the algebraic number theory framework. But I don't have time to work on it now. |
comment:12
This relies on #5066. Apply that first. This DOES NOT address every issue with relative number fields, but it does help in the creation and coercion. Significantly. Plenty of doctests, but tons of work left to be done. The important part is that one can now create relative number field elements from relative polynomials self.base_ring()['x'] or from stacked polynomials QQ['base']['ext']. Fixes all sorts of things. |
Attachment: trac_1367.patch.gz |
comment:13
Do not apply There may be doctests missing on some functions, but I can't fix this, document a ton of stuff, and doctest every untested function in one go. This is very much a work in progress patch. |
comment:14
There are a few things I want to discuss (probably at lunch). The first is that I'm not completely convinced that the following example is the behavior we want: sage: K. = NumberField(ZZ['x'].0^5 + 2, 'a') sage: L(u5) I guess if we're going to convert at all this makes the most sense, but I want to think about it a bit more. I'm even less convinced of the following: sage: W. = t.parent()[] The second issue is a naming one. The function coerce_non_number_field_element_in should probably be a convert function rather than a coerce one. Overall, though, it looks quite good. |
comment:15
The patch explains why the first behaviour is correct. Do you want
or
I think the first is much more desirable. Your second issue is a good point. I should make sure you're either giving QQ['x'] (or something isomorphic) or QQ['base']['ext'] or base['ext']. But that's hard at this time. As for naming: make it a new ticket. It's not worth shuffing a rename in with a reorganization in my opinion. |
comment:16
Nick, David: any chance to see some movement on this? I would like to get this in before it rots and potential issues can be addressed via followup tickets. Thoughts? Cheers, Michael |
This comment has been minimized.
This comment has been minimized.
comment:17
I think this should be applied and more tickets opened for any additional issues.
|
comment:18
Replying to @ncalexan:
Thanks Nick. Please open followup tickets and chance it to a positive review. I will then merge this ticket and its dependencies. Cheers, Michael |
This comment has been minimized.
This comment has been minimized.
comment:20
Ok, to make this patch apply I need to do two things:
due to
This changes
to
but doctests do pass. Cheers, Michael |
This comment has been minimized.
This comment has been minimized.
This is Nick's patch with cannonical -> canonical fixed |
Attachment: trac_1367.2.patch.gz This patch is required due to #5069 to make Nick's patch apply |
comment:21
Attachment: trac_1367-prebase.patch.gz Merged trac_1367-prebase.patch and trac_1367.2.patch in Sage 3.3.alpha3. Cheers, Michael |
I noticed this bug when thinking about implementing factorization of integers
in a general relative number field (via the absolute field corresponding
to it). If this bug were fixed, then general factorization would be
trivial to implement, as suggested by the example below.
Component: number theory
Issue created by migration from https://trac.sagemath.org/ticket/1367
The text was updated successfully, but these errors were encountered: