Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Coercions between polynomial rings and term orders

The line

PolynomialRing(QQ, ['x', 'y', 'z'], order=TermOrder('lex', [1, 1, 1]))('x') + PolynomialRing(QQ, 'y')('y')

produces an error in Sage, while the line

PolynomialRing(QQ, ['x', 'y', 'z'])('x') + PolynomialRing(QQ, 'y')('y')

does not and returns x+y.

I do not quite understand how the details work. I have two questions: 1) Is the above line indeed supposed to trigger an exception, or is this a bug? 2) I need to work with a polynomial ring and the subring generated by one of the variables, as above. If I do not specify a term order, then all goes well, but as soon as I specify the term order I want (typically the above one), I run into problems when I combine elements from the bigger ring with elements from the smaller one (unless I explicitly coerce from the smaller ring to the bigger one). How am I supposed to proceed if I do want to use a term order and do not want to have to add explicit coercions?