Skip to content

Conversation

EigenVector22
Copy link
Contributor

Fixes #38802
When sqrt(Mod(a,n), all=True) is called for a non-square a with the default extend=True, the resulting NotImplementedError was very generic.

Improved the error message to suggest trying extend=False to find roots only within the base ring Zmod(n), as discussed in the issue.

Included doctest .

📝 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

When sqrt(Mod(a,n), all=True) is called for a non-square 'a' with the default extend=True, the resulting NotImplementedError was very generic.

Improved the error message to suggest trying extend=False to find roots only within the base ring Zmod(n), as discussed in the issue.

Included a doctest .
@EigenVector22 EigenVector22 force-pushed the ticket/38802-sqrt-mod-error-msg branch from 616133e to ed69335 Compare April 3, 2025 13:58
@EigenVector22
Copy link
Contributor Author

@maxale hello, can you review this and give feedback for the change made,
Thankss,

@maxale
Copy link
Contributor

maxale commented Apr 3, 2025

@maxale hello, can you review this and give feedback for the change made, Thankss,

It looks fine to me, but I'm not a reviewer here.

@EigenVector22
Copy link
Contributor Author

@user202729 can you please review this and give feedback,
thanks,

Copy link

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

vbraun pushed a commit to vbraun/sage that referenced this pull request Apr 21, 2025
sagemathgh-39856: Improve NotImplementedError for sqrt(Mod(a,n), all=True)
    
Fixes sagemath#38802
When `sqrt(Mod(a,n), all=True)` is called for a non-square `a` with the
default extend=True, the resulting `NotImplementedError` was very
generic.

Improved the error message to suggest trying extend=False to find roots
only within the base ring Zmod(n), as discussed in the issue.

Included doctest .

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->



### 📝 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.
- [ ] 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#39856
Reported by: Ashutosh Rajora
Reviewer(s):
@vbraun vbraun merged commit 06d1fde into sagemath:develop Apr 29, 2025
15 of 21 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.

sqrt(Mod(,),all=True) should raise more informative NotImplmentedError
4 participants