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

Added option to return explicit polynomial in .in_subalgebra #39555

Merged
merged 5 commits into from
Feb 28, 2025

Conversation

pyrusbrawler64
Copy link
Contributor

Fixes #39225.

Previously the function in_subalgebra in src/sage/rins/polynomial/multi_polynomial_libsingular.pyx returned True or False, depending on whether the polynomial was present in the provided subalgebra. When the parameter 'algorithm' was set to 'groebner' it would do this by generating a polynomial, but this polynomial would not be made available to the user.

This function was enhanced by adding a key-word only argument 'certificate' to the function which defaults to False. When the value provided for this argument evaluates to False the function behaves as before. When the value provided evaluates to True and the Groebner algorithm is used the function returns the polynomial generated by the algorithm when it would have otherwise returned True, and returns None when it would have otherwise returned False.

Additionally, if the value provided for the 'certificate' argument is a string which evaluates to True then that string will be used to name the variables in the generated polynomial.

The existing example for this function has been modified to test this new functionality.

📝 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

Copy link

github-actions bot commented Feb 21, 2025

Documentation preview for this PR (built with commit d0845dd; 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.

Some minor details trying to improve the doc and code formatting.

@tscrim tscrim self-requested a review February 21, 2025 07:56
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.

Thank you. LGTM.

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 24, 2025
sagemathgh-39555: Added option to return explicit polynomial in .in_subalgebra
    
<!-- ^ 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". -->

Fixes sagemath#39225.

Previously the function in_subalgebra in
src/sage/rins/polynomial/multi_polynomial_libsingular.pyx returned True
or False, depending on whether the polynomial was present in the
provided subalgebra. When the parameter 'algorithm' was set to
'groebner' it would do this by generating a polynomial, but this
polynomial would not be made available to the user.

This function was enhanced by adding a key-word only argument
'certificate' to the function which defaults to False. When the value
provided for this argument evaluates to False the function behaves as
before. When the value provided evaluates to True and the Groebner
algorithm is used the function returns the polynomial generated by the
algorithm when it would have otherwise returned True, and returns None
when it would have otherwise returned False.

Additionally, if the value provided for the 'certificate' argument is a
string which evaluates to True then that string will be used to name the
variables in the generated polynomial.

The existing example for this function has been modified to test this
new functionality.

### 📝 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.

### ⌛ 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#39555
Reported by: Caleb Van't Land
Reviewer(s): Caleb Van't Land, Travis Scrimshaw
@vbraun vbraun merged commit a6c8806 into sagemath:develop Feb 28, 2025
22 of 23 checks passed
@user202729
Copy link
Contributor

Oops, already merged. This part of the documentation is misformatted because of a missing space before ​`​`True`​`​ in the source code.

image

@tscrim
Copy link
Collaborator

tscrim commented Mar 1, 2025

Easy enough to fix on a followup PR.

@user202729 user202729 mentioned this pull request Mar 3, 2025
5 tasks
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 9, 2025
sagemathgh-39623: Fix spacing for documentation
    
Partially discussed in sagemath#39555.
Meanwhile I find a few more.

### 📝 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.
- [ ] 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#39623
Reported by: user202729
Reviewer(s): Frédéric Chapoton
vbraun pushed a commit to vbraun/sage that referenced this pull request Mar 9, 2025
sagemathgh-39623: Fix spacing for documentation
    
Partially discussed in sagemath#39555.
Meanwhile I find a few more.

### 📝 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.
- [ ] 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#39623
Reported by: user202729
Reviewer(s): Frédéric Chapoton
@pyrusbrawler64 pyrusbrawler64 deleted the 39225_in_subalgebra branch March 9, 2025 19:28
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.

Return explicit polynomial in .in_subalgebra
4 participants