Skip to content

Fix AlgebraicNumberPowQQAction corner case#40739

Merged
vbraun merged 2 commits intosagemath:developfrom
user202729:fix-qqbar-pow-rational
Feb 11, 2026
Merged

Fix AlgebraicNumberPowQQAction corner case#40739
vbraun merged 2 commits intosagemath:developfrom
user202729:fix-qqbar-pow-rational

Conversation

@user202729
Copy link
Copy Markdown
Contributor

@user202729 user202729 commented Aug 31, 2025

Fixes #40733.

The cause of the linked issue is that crosses_log_branch_cut() == False does not imply it's safe to compute argument(), since a line crossing zero does not cross the log branch cut, yet its argument is indeterminate.

Whether this is the correct definition of the log branch cut is debatable (zero should be included in the branch cut too), but anyway there's another subtle bug in the other branch (just because val crosses the branch cut and we know x is nonzero (because of the if not x: check at the very start) doesn't mean x is in fact negative). I just rewrote the logic entirely.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 31, 2025

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

@user202729 user202729 force-pushed the fix-qqbar-pow-rational branch from 6d046a2 to aa5c925 Compare August 31, 2025 10:44
@cxzhong
Copy link
Copy Markdown
Contributor

cxzhong commented Oct 29, 2025

Looks good. Can you merge the newest develop branch? Thank you

@cxzhong cxzhong requested a review from dimpase December 6, 2025 14:18
@dimpase
Copy link
Copy Markdown
Member

dimpase commented Dec 6, 2025

this should be reviewed by number theorists:
@nbruin @JohnCremona @fredrik-johansson

@cxzhong
Copy link
Copy Markdown
Contributor

cxzhong commented Dec 6, 2025

I left this to others. I do not have some comments now.

@cxzhong cxzhong requested a review from nbruin December 13, 2025 07:08
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 5, 2026
sagemathgh-40739: Fix AlgebraicNumberPowQQAction corner case
    
Fixes sagemath#40733.

The cause of the linked issue is that `crosses_log_branch_cut() ==
False` does not imply it's safe to compute `argument()`, since a line
crossing zero does not cross the log branch cut, yet its argument is
indeterminate.

Whether this is the correct definition of the log branch cut is
debatable (zero should be included in the branch cut too), but anyway
there's another subtle bug in the other branch (just because `val`
crosses the branch cut and we know `x` is nonzero (because of the `if
not x:` check at the very start) doesn't mean `x` is in fact negative).
I just rewrote the logic entirely.

### 📝 Checklist

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

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40739
Reported by: user202729
Reviewer(s): Chenxin Zhong
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 7, 2026
sagemathgh-40739: Fix AlgebraicNumberPowQQAction corner case
    
Fixes sagemath#40733.

The cause of the linked issue is that `crosses_log_branch_cut() ==
False` does not imply it's safe to compute `argument()`, since a line
crossing zero does not cross the log branch cut, yet its argument is
indeterminate.

Whether this is the correct definition of the log branch cut is
debatable (zero should be included in the branch cut too), but anyway
there's another subtle bug in the other branch (just because `val`
crosses the branch cut and we know `x` is nonzero (because of the `if
not x:` check at the very start) doesn't mean `x` is in fact negative).
I just rewrote the logic entirely.

### 📝 Checklist

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

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40739
Reported by: user202729
Reviewer(s): Chenxin Zhong
@vbraun vbraun merged commit b91b632 into sagemath:develop Feb 11, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QR decomposition fails for qqbar matrix

4 participants