1 | initial version |
From your data, you can get the list of indeterminates and make a new polynomial ring from them:
sage: R = PolynomialRing(QQ, P.gens()+S.gens())
sage: R(poly)
c0*t0
sage: R(poly).parent()
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field
If you want to only use S
, you can replace P.gens()
with S.base_ring().gens()
2 | No.2 Revision |
From your data, you can get the list of indeterminates and make a new polynomial ring from them:
sage: R = PolynomialRing(QQ, P.gens()+S.gens())
sage: R(poly)
c0*t0
sage: R(poly).parent()
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field
If you want to only use S
, you can replace recover P.gens()Pwith from
, and get the desired flattening:S.base_ring().gens()S.base_ring()
sage: PolynomialRing(QQ, S.base_ring().gens()+S.gens())
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field
3 | No.3 Revision |
From your data, you can get the list of indeterminates and make a new polynomial ring from them:
sage: R = PolynomialRing(QQ, P.gens()+S.gens())
sage: R(poly)
c0*t0
sage: R(poly).parent()
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field
If you want to only use S
, you can recover P
from S.base_ring()
, and get the desired flattening:
sage: PolynomialRing(QQ, S.base_ring().gens()+S.gens())
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field
If you want to directly build a polynomial ring from a list of strings with two prefixes, you can also do:
sage: PolynomialRing(QQ,["c{}".format(i) for i in range(6)]+["t{}".format(i) for i in range(6)])
Multivariate Polynomial Ring in c0, c1, c2, c3, c4, c5, t0, t1, t2, t3, t4, t5 over Rational Field