Skip to content

Return explicit polynomial in .in_subalgebra #39225

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

Closed
1 task done
schcs opened this issue Dec 29, 2024 · 1 comment · Fixed by #39555
Closed
1 task done

Return explicit polynomial in .in_subalgebra #39225

schcs opened this issue Dec 29, 2024 · 1 comment · Fixed by #39555
Assignees

Comments

@schcs
Copy link

schcs commented Dec 29, 2024

Problem Description

Given a polynomial f∈𝔽[x1,…,xn] which is an element of the subalgebra generated by f1,…,fk, calling f.in_subalgebra([f1,...,fk]) should returnh(t1,…,tk)such that f=h(f1,…,fk). I believe that this would be a useful feature.

Proposed Solution

The method is implemented in sage/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx. When algorithm = "groebner" is chosen, the polynomial z should be returned together with True. In case of False, 0 can be returned.

Alternatives Considered

I'm not sure about feasible alternatives.

Additional Information

No response

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
@user202729
Copy link
Contributor

user202729 commented Dec 30, 2024

This is already possible as follows

sage: R.<x> = QQ[]
sage: S.<y> = QQ[]
sage: S.hom([x^2]).inverse_image(x^4)
y^2

(performance improvement might be possible)

On an unrelated note, for some reason the following is not implemented

x^4 in S.hom([x^2]).image()

@fchapoton fchapoton changed the title <title>Return explicit polynomial in .in_subalgebra</title> Return explicit polynomial in .in_subalgebra Dec 30, 2024
@pyrusbrawler64 pyrusbrawler64 self-assigned this Feb 20, 2025
vbraun pushed a commit to vbraun/sage that referenced this issue 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 pushed a commit to vbraun/sage that referenced this issue Feb 27, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants