Ticket #9902 (needs_info defect)
base_extend() not implemented in MPolynomialRing
| Reported by: | vbraun | Owned by: | malb |
|---|---|---|---|
| Priority: | major | Milestone: | sage-5.10 |
| Component: | commutative algebra | Keywords: | |
| Cc: | novoselt, niles | Work issues: | |
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Volker Braun | Merged in: | |
| Dependencies: | Stopgaps: |
Description
The base class Ring defines base_extend(), but the implementation needs to be overridden in the derived class MPolynomialRing:
sage: sage: P.<x,y,z> = PolynomialRing(QQ,'x, y, z'); P Multivariate Polynomial Ring in x, y, z over Rational Field sage: P.base_extend(CC) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/vbraun/opt/sage-4.5.3/devel/sage-main/<ipython console> in <module>() /home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/rings/ring.so in sage.rings.ring.Ring.base_extend (sage/rings/ring.c:3190)() TypeError: no base extension defined
The patch implements the override and adds documentation.
Attachments
Change History
Changed 3 years ago by vbraun
-
attachment
trax_9902_fix_base_extension.patch
added
comment:2 Changed 2 years ago by vbraun
- Cc novoselt, niles added
Andrey, I wrote this patch a while a go to be able to extend the base field of the toric coordinate ring. It might be useful...
comment:3 Changed 2 years ago by novoselt
- Status changed from needs_review to needs_info
I am not quite sure it is the right approach. It seems to me that we have two methods: change_ring that constructs "the same object but over different ring" and base_extend which does the same, but only if there is a natural coercion. Given this description, it seems to me that there should be only one implementation of base_extend in the base class:
def base_extend(self, R):
if R.has_coerce_map(self.base_ring()):
return self.change_ring(R)
else:
raise TypeError("%s cannot be extened to %s!" % (self.base_ring(), R))
and then each derived class should implement change_ring only. (If the detailed error message breaks a lot of doctests I am fine with keeping the current one.) Thoughts?
There is also discrepancy between actual argument names and their description in documentation (base_ring vs. R).

Initial patch