Dear Supporters,

the following works:
 sage: R=PolynomialRing(QQ,['a','x1','y1'])
 sage: S=PolynomialRing(QQ,['x1','y1','z'])
 sage: R('x1+a')+S('x1+z')
 a + 2*x1 + z

The following does not work:
 sage: R=PolynomialRing(QQ,['a','x','y1'])
 sage: S=PolynomialRing(QQ,['x1','y1','z'])
 sage: R('x+a')+S('x1+z')
 Traceback (most recent call last):
 TypeError: unsupported operand parent(s) for '+': 'Multivariate
Polynomial Ring in a, x, y1 over Rational Field' and 'Multivariate
Polynomial Ring in x1, y1, z over Rational Field'

Why?

In both cases, the polynomial rings have some variable names in
common, some not. In the first case, we have a successful coercion to
a common parent:
 sage: R=PolynomialRing(QQ,['a','x1','y1'])
 sage: S=PolynomialRing(QQ,['x1','y1','z'])
 sage: (R('x1+a')*S('x1+z')).parent()
 Multivariate Polynomial Ring in a, x1, y1, z over Rational Field

So, why is the corresponding operation not done in the second example?

Second (related) question: If R and S are polynomial rings over the
same base ring, how can I form the polynomial ring (over the same base
ring) whose variables are the union of the variables of R and of S? Is
this an easy (speed wise) operation?

Cheers,
      Simon

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to