-
-
Couldn't load subscription status.
- Fork 680
provide monomial_coefficients for polynomials and allow single argument for MPolynomialRing_base.monomial #38729
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
provide monomial_coefficients for polynomials and allow single argument for MPolynomialRing_base.monomial #38729
Conversation
…nt for MPolynomialRing_base.monomial
|
Documentation preview for this PR (built with commit 92c4646; changes) is ready! 🎉 |
|
The failure in |
|
fixed, silly thinko. |
|
I cannot reproduce the test failure in |
|
I thought that ETuples would be tuples, but that is not the case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
I made another mistake, sorry. There are several places where |
|
I think it would actually be good to deprecate the |
|
The plural failure should be unrelated, see #38737 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your dict redirect methods need a doctest though.
Yes. But my goal is to see whether we can make the functionality category-specified, and eventually deprecate dict. |
I probably would not do that since that method is about the return type of the data for the object rather than something mathematical. I would rather let each implementation handle it as it sees fit. |
Yes, I agree. |
|
Putting polynomials into a graded category is not desired, if I recall correctly? There is no comment in the code though. |
I might have misunderstood your intent. Perhaps I should also clarify that I am not in favor of deprecating |
By default, yes, because the morphisms would become too restrictive for most users. What we should do is add an input to specify the grading to each variable, in which case it is clear the user wanted a graded object. (The is what the free algebra does.) |
I'm very sorry, my question was wrong. It should have been: "Puting polynomials into the category of algebras with basis is not desired, if I recall correctly?" |
That I don't recall, and I can't see why. They are already implemented as such effectively... |
|
Oh, that's good news! I'll try to add diff --git a/src/sage/rings/polynomial/polynomial_ring_constructor.py b/src/sage/rings/polynomial/polynomial_ring_constructor.py
index a135fe8de6c..12cceaf4c05 100644
--- a/src/sage/rings/polynomial/polynomial_ring_constructor.py
+++ b/src/sage/rings/polynomial/polynomial_ring_constructor.py
@@ -932,7 +932,7 @@ def polynomial_default_category(base_ring_category, n_variables):
sage: QQ['s']['t'].category() is UniqueFactorizationDomains() & CommutativeAlgebras(QQ['s'].category()).Infinite()
True
"""
- category = Algebras(base_ring_category)
+ category = Algebras(base_ring_category).WithBasis()
if n_variables:
# here we assume the base ring to be nonzero |
|
In principle, the |
| """ | ||
| cdef dict d = self._poly.dict() | ||
| cdef dict d = self._poly.monomial_coefficients() | ||
| yield from d.iteritems() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I do
| yield from d.iteritems() | |
| yield from d.items() |
throughout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed since it was part of the Python3 transition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM.
|
Thank you :-) |
|
Hm, can I set this to "positive review"? |
|
Ah, sorry, I thought I did that. |
sagemathgh-38729: provide monomial_coefficients for polynomials and allow single argument for MPolynomialRing_base.monomial The goal of this pull request is to allow generic programming with instances of `CombinatorialFreeModule` and polynomial rings. In particular, we provide an alias `monomial_coefficients` for the existing method `dict` of polynomial rings, and we allow to specify the exponents in `monomial` of multivariate polynomial rings as a single tuple. URL: sagemath#38729 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
sagemathgh-38767: polynomials/fix category We put polynomials (and friends) into the category of algebras with basis. Dependencies: sagemath#38729 URL: sagemath#38767 Reported by: Martin Rubey Reviewer(s): Travis Scrimshaw
sagemathgh-38108: Implicit function solver for lazy series This pull request provides a method `define_implicitly` for lazy rings that allows to produce lazy power series solutions for systems of functional equations, in relatively great generality, superseding sagemath#37033. We use a special action to make sure that coercion between `CoefficientRing` and its base ring works as desired. However, it is a local change, if the current approach eventually shows its shortcomings. (Alternative approach previously considered: Using a special functor to control the pushout behaviors. The action approach was chosen as a way to prevent potential conflicts with other construction functors that may appear in the future.) Dependencies: sagemath#38729 URL: sagemath#38108 Reported by: Martin Rubey Reviewer(s): Martin Rubey, Travis Scrimshaw
sagemathgh-38108: Implicit function solver for lazy series This pull request provides a method `define_implicitly` for lazy rings that allows to produce lazy power series solutions for systems of functional equations, in relatively great generality, superseding sagemath#37033. We use a special action to make sure that coercion between `CoefficientRing` and its base ring works as desired. However, it is a local change, if the current approach eventually shows its shortcomings. (Alternative approach previously considered: Using a special functor to control the pushout behaviors. The action approach was chosen as a way to prevent potential conflicts with other construction functors that may appear in the future.) Dependencies: sagemath#38729 URL: sagemath#38108 Reported by: Martin Rubey Reviewer(s): Martin Rubey, Travis Scrimshaw
The goal of this pull request is to allow generic programming with instances of
CombinatorialFreeModuleand polynomial rings.In particular, we provide an alias
monomial_coefficientsfor the existing methoddictof polynomial rings, and we allow to specify the exponents inmonomialof multivariate polynomial rings as a single tuple.