Opened 3 years ago
Last modified 3 years ago
#26970 new defect
improve conversions from polynomial rings to the base ring
Reported by: | mantepse | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | coercion | Keywords: | |
Cc: | nbruin | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
This ticket is a follow up on #26929. As pointed out there, conversions from univariate quotient rings to subrings of the base ring should be harmonized with those of multivariate quotient rings.
For example, we currently have the following:
sage: R.<x,y> = QQ[]; S.<a,b> = R.quo(x^2 + y^2); sage: ZZ.coerce_map_from(S) is None True sage: ZZ.convert_map_from(S) Conversion via _integer_ method map: From: Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2) To: Integer Ring
In the univariate case another map gets picked up; one that apparently always fails.
sage: R.<x>=QQ[]; S.<a>=R.quo(x^2+1) sage: m=ZZ.convert_map_from(S); m Conversion map: From: Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^2 + 1 To: Integer Ring
This map simply ends up calling ZZ._element_constructor_(<argument>)
, which fails.
So the difference seems to be whether an _integer_
method is available on the elements.
(not sure whether this belongs to coercion or categories, or neither.)
Change History (4)
comment:1 Changed 3 years ago by
comment:2 Changed 3 years ago by
- Milestone changed from sage-8.6 to sage-8.7
Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.
comment:3 Changed 3 years ago by
- Milestone changed from sage-8.7 to sage-8.8
Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)
comment:4 Changed 3 years ago by
- Milestone sage-8.8 deleted
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).
Maybe the following is part of the problem:
I don't know yet how (and where) this should be fixed.