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
composite_fields does not play nice with QuadraticFields #7643
Comments
Author: Francis Clarke |
comment:1
When fields are constructed using
In the case of the two quadratic fields, Worse still is the following example:
Here
In the first case (which ought to be rejected since it is incompatible with the given embeddings), Clearly this test is not up to the job. There is a simple way to rewrite the code, because when embeddings of both fields are specified there is always only one compositum. Thus we can simply pick the field for which The patch implements this idea. Another change is to only compute the maps into the composite when they are required. In additiion various checks have been omitted, since pari should have already done the necessary work. I have also allowed the fields into which the two fields are embedded to be different as long as they have a common ambient field, so that, for example, the following now works:
Another problem with the present code is that when no embeddings are specified it yields, in general, too many fields (because there are duplicates). The following fields provide a good example: at present
The patch includes code which removes duplicates. As a result of these changes, many changes have had to be made to the doctests, which contained some misleading examples. Also in the patch is code to deal with relative number fields, and, in the case where a single field is returned, a minor change to the way that its variable name is generated, |
Attachment: trac_7643.patch.gz based on 4.3.rc0 |
comment:2
Review: The code looks excellent. It deals with the problem originally given and does a lot more besides, is well-written and very well documented. Applied fine to 4.3 and all tests pass (in the two files changed and also in totallyreal_rel.py where the function is used). Quick question: in cases where we compute K.composite_fields(L) where there is an embedding of K into L or K into K, would it not be nice to return L (resp K) rather than some new field? Surely that would not be expensive to test for. For example:
while we could have used one of these:
If this can be done easily then I would vote for it, otherwise I'll give this a positive review. |
Reviewer: John Cremona |
comment:3
Replying to @JohnCremona:
This is an excellent idea. In principle it's easy to implement, because we only have to see if the degrees are equal. In practice it all becomes quite complicated when embeddings, maps and relative fields are taken into account, and I fear the the code in the replacement patch which I attach is even more convoluted than before. One of the complications was that I needed to obtain the inverse of an isomorphism between distinct fields. At present one can only take the inverse of an automorphism of a field. So the patch includes some minor tweaks to |
replaces earlier patch, based on 4.3 |
comment:4
Attachment: trac_7643_revised.patch.gz Sorry to have given your more work to do ;) I'll take a look! |
comment:5
Many apologies for having totally forgotten about this: you should have reminded me! The good news is that the new patch (we only apply the second one) applies absolutely fine to 4.4.rc0, and all tests in sage/rings/number_field pass, and the example I gave above now works perfectly as requested! Positive review for the second patch. |
Merged: 4.4.1.alpha2 |
Changed merged from 4.4.1.alpha2 to sage-4.4.1.alpha2 |
CC: @ncalexan
Component: number fields
Author: Francis Clarke
Reviewer: John Cremona
Merged: sage-4.4.1.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/7643
The text was updated successfully, but these errors were encountered: