Skip to content
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

number_field_elements_from_algebraics: Fix CyclotomicField embedding when embedding=False #38441

Merged
merged 4 commits into from
Nov 16, 2024

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Jul 28, 2024

Fixes #38440.

Uses .coerce_embedding() to determine the existence of the embedding and modify the field accordingly, instead of doing what the code does currently (assume the field is unembedded by default).

Note that there's a behavior change --- now when embedding=False it will return a NumberField instead of CyclotomicField (even though it is technically possible to create a CyclotomicField(5, embedding=None)). I don't think this matters.

📝 Checklist

Copy link

github-actions bot commented Jul 28, 2024

Documentation preview for this PR (built with commit 6c56c15; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo some details.

cc-ing some people who might have thoughts about this PR: @tornaria, @saraedum @roed314 @pjbruin

src/sage/rings/qqbar.py Outdated Show resolved Hide resolved
src/sage/rings/qqbar.py Outdated Show resolved Hide resolved
@roed314
Copy link
Contributor

roed314 commented Nov 8, 2024

Something strange got merged into this PR: there are 3036 files changed with 80k+ lines of changes....

@user202729
Copy link
Contributor Author

Looks like the merge commit go wrong. Should be fixed now.

(the . has been changed to ; in some other upstream commit, so I change the suggested ; to , instead)

From: Number Field in zeta6 with defining polynomial x^2 - x + 1
To: Algebraic Field
Defn: zeta6 |--> 0.500000000000000? + 0.866025403784439?*I)
sage: _[0].coerce_embedding()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that the underscore would work here. Even if it does, I think it's clearer to give the return value explicit names.

@roed314
Copy link
Contributor

roed314 commented Nov 8, 2024

Looks good to me, other than the underscore comment.

src/sage/rings/qqbar.py Outdated Show resolved Hide resolved
@user202729 user202729 marked this pull request as draft November 8, 2024 02:33
@user202729 user202729 marked this pull request as ready for review November 8, 2024 03:24
@roed314
Copy link
Contributor

roed314 commented Nov 8, 2024

Looks good to me.

vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 9, 2024
…icField embedding when embedding=False

    
Fixes sagemath#38440.

Uses `.coerce_embedding()` to determine the existence of the embedding
and modify the field accordingly, instead of doing what the code does
currently (assume the field is unembedded by default).

Note that there's a behavior change --- now when `embedding=False` it
will return a `NumberField` instead of `CyclotomicField` (even though it
is technically possible to create a `CyclotomicField(5,
embedding=None)`). I don't think this matters.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview. (only part that change is https://doc-pr-38441--sagemath.netlif
y.app/html/en/reference/number_fields/sage/rings/qqbar.html#sage.rings.q
qbar.number_field_elements_from_algebraics )
    
URL: sagemath#38441
Reported by: user202729
Reviewer(s): roed314, Travis Scrimshaw, user202729
vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 13, 2024
…icField embedding when embedding=False

    
Fixes sagemath#38440.

Uses `.coerce_embedding()` to determine the existence of the embedding
and modify the field accordingly, instead of doing what the code does
currently (assume the field is unembedded by default).

Note that there's a behavior change --- now when `embedding=False` it
will return a `NumberField` instead of `CyclotomicField` (even though it
is technically possible to create a `CyclotomicField(5,
embedding=None)`). I don't think this matters.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview. (only part that change is https://doc-pr-38441--sagemath.netlif
y.app/html/en/reference/number_fields/sage/rings/qqbar.html#sage.rings.q
qbar.number_field_elements_from_algebraics )
    
URL: sagemath#38441
Reported by: user202729
Reviewer(s): roed314, Travis Scrimshaw, user202729
@vbraun vbraun merged commit 980cab1 into sagemath:develop Nov 16, 2024
23 of 24 checks passed
@user202729 user202729 deleted the patch-5 branch November 16, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

number_field_elements_from_algebraics returns embedded CyclotomicField even with embedded=False specified
5 participants