On Thursday, October 1, 2015 at 11:57:45 AM UTC-7, Travis Scrimshaw wrote: > > Hey, > You need to make sure the order of the variables agrees: > > sage: A = QQ['t'] > sage: B = A['x','y'] > sage: C = QQ['t', 'x','y'] > sage: C.coerce(B.0) > x >
That's a bug in sage. It's completely canonical in sage where names should be coerced, and it goes by name. Not by index number. The variable order in C should not matter in whether sage can figure out the coercion. > The reason the order is important is say you have QQ['x,y'] and QQ['y,x'], > should the coercion be index to index or name to name? > Sage firmly defines this: the coercion is by name. sage: U=QQ['x,y'] sage: V=QQ['y,x'] sage: U.0+V.1 2*x sage: parent(U.0+V.1) Multivariate Polynomial Ring in x, y over Rational Field sage: parent(V.1+U.0) Multivariate Polynomial Ring in y, x over Rational Field (as you can see, in this case there are coercions in both directions which is a little unfortunate) (Although I'd advocate for multivariate polynomial rings to sort their > generators upon creation so that QQ['x,y'] is QQ['y,x'] in the sense of > python.) > That's a bad idea: names have mathematical significance in sage as far as coercion is concerned. If you can't rely on the order of the names, then you don't know the mathematical meaning of R.0 as far as coercions to other rings are concerned. Another reason to preserve given order in variable names is that the order of the variables matters for monomial orderings: If you want to get elimination orders in place, it's nice to know that the order of the names of your variables is determined by what you type in. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.