1 | initial version |
Especially if you are concerned about performance you should never create univariate polynomial rings over univariate polynomial rings. Directly using multivariate polynomial rings will be much faster.
Bonus: its then easy to substitute other variables since all variables are treated at the same level, for example:
sage: S1.<x1,y1> = ZZ[]
sage: S2.<y2,x2> = ZZ[]
sage: p1 = y1*x1 + y1
sage: p1(y2,x2)
y2*x2 + x2