Opened 5 years ago
Closed 5 years ago
#25022 closed defect (fixed)
change_ring broken on polynomials
Reported by:  Vincent Delecroix  Owned by:  

Priority:  major  Milestone:  sage8.2 
Component:  commutative algebra  Keywords:  
Cc:  Ralf Stephan  Merged in:  
Authors:  Vincent Delecroix  Reviewers:  Julian Rüth 
Report Upstream:  N/A  Work issues:  
Branch:  319bb43 (Commits, GitHub, GitLab)  Commit:  319bb43a70dd8ddfd9637cbc310230579a643fe6 
Dependencies:  Stopgaps: 
Description
If the polynomial can be coerced in the new base ring, the result of change_ring
is a constant
sage: p = ZZ['x']([1,2,3]) sage: p.change_ring(QQ['x']).degree() 0 sage: p.change_ring(SR).degree() 0
Change History (8)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
I think that change_ring
on elements should uniformly be
def change_ring(self, R): return self.parent().change_ring(R)(list(self))
I don't plan to change anything to the _element_constructor_
which is definitely allowed to behave differently.
comment:3 Changed 5 years ago by
Authors:  → Vincent Delecroix 

Branch:  → u/vdelecroix/25022 
Commit:  → 319bb43a70dd8ddfd9637cbc310230579a643fe6 
Status:  new → needs_review 
New commits:
319bb43  fix change_ring for polynomials

comment:4 Changed 5 years ago by
Reviewers:  → Julian Rüth 

Changes look good to me. nbruin, do you agree?
comment:7 Changed 5 years ago by
Status:  needs_review → positive_review 

Since nbruin has not reacted, let's assume that he does at least not strongly disagree…
comment:8 Changed 5 years ago by
Branch:  u/vdelecroix/25022 → 319bb43a70dd8ddfd9637cbc310230579a643fe6 

Resolution:  → fixed 
Status:  positive_review → closed 
Note: See
TracTickets for help on using
tickets.
Note that
change_ring
is supposed to change the base ring. For instance, we have:In your case, you basically end up with
and as it goes with coercion, the
x
ofp
coerces as low in the tower as possible.Perhaps you'd prefer the result
There's some work to be done, though:
which does match
but doesn't seem to fit the pattern of "coerce 'x' as low as possible. But then, following that rule consistently might not be such a good idea.