Opened 7 weeks ago
Last modified 4 weeks ago
#28420 new enhancement
No order for univariate polynomial rings
Reported by: | bruno | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.9 |
Component: | algebra | Keywords: | polynomial, order |
Cc: | tmonteil | Merged in: | |
Authors: | Bruno Grenet | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/bruno/univariate_polyring_order | Commit: | |
Dependencies: | Stopgaps: |
Description (last modified by )
This ticket add an error message for the constructor of polynomial ring when trying to build a univariate polynomial ring with a term order. Currently, order = ...
is silently ignored for univariate polynomial rings and this leads to confusions for some users, cf this Ask question¹.
Before:
sage: PolynomialRing(QQ, 'x', order = TermOrder('wdegrevlex', (2,))) Univariate Polynomial Ring in x over Rational Field
After:
sage: PolynomialRing(QQ, 'x', order = TermOrder('wdegrevlex', (2,))) Traceback (most recent call last): ... TypeError: univariate polynomial rings do not accept an order. Use a 1-variable multivariate polynomial ring instead.
¹ The Ask question uncovers two distinct problems, the second one is fixed in #28421.
Change History (4)
comment:1 Changed 7 weeks ago by
- Branch set to u/bruno/univariate_polyring_order
- Description modified (diff)
- Keywords order added
- Summary changed from Error messages for polynomial ring constructor to No order for univariate polynomial rings
comment:2 Changed 7 weeks ago by
- Description modified (diff)
comment:3 Changed 7 weeks ago by
- Cc tmonteil added
comment:4 Changed 4 weeks ago by
Would it be hard to check if the term order is weighted, and return a multivariate ring in a single variable or a univariate ring depending on that?
Note: See
TracTickets for help on using
tickets.
Actually, I've trouble with my proposed solution. I actually tried two possibilities, but with difficulties in both cases:
order
in paramater throws an Exception;PolynomialRing(R, 'x', order = ...)
behave likePolynomialRing(R, 1, 'x', order = ...)
, that is return a 1-variable multivariate polynomial ring.In the first case I have a lot of doctests failing, I've not investigated all of them yet. The second solution has much less failed doctests. Though I have mainly one, that actually also occurs with the first solution.
The problem is as follows: To discover that there is a coercion from
R['x,y']
toFrac(R['x'])['y']
, the algorithm checks whether there is a coercion fromR['x,y'].remove_var('y')
toFrac(R['x'])
. A problem occurs in the two solutions, becauseR['x,y'].remove_var('y')
attempts to build the polynomial ringR['x']
but passes theorder
parameter.R['x']
to the fraction field of the univariateR['x']
.The simplest(?) workaround I've in mind is to keep with the second solution and to add the missing coercion (note: I don't know how to do that!). But I am not sure that this is the right thing to do. In particular, this implies that
remove_var
now returns a 1-variable multivariate polynomial ring instead of a univariate polynomial ring.R['x,y'].remove_var('y')
not to return a (truly) univariate ring.