# Canonical maps between iterated polynomial rings

I have a very basic question, but I'm hoping to learn the "right" way to handle things before getting too far into a project.

I'm considering the following spaces.

R = PolynomialRing(QQ,2,'s')
P2 = ProjectiveSpace(2,R,'x')
TotalSpace = ProductProjectiveSpaces([2,1],QQ,names=['x','s'])


The coordinate ring of P2 is: "Multivariate Polynomial Ring in x0, x1, x2 over Multivariate Polynomial Ring in s0, s1 over Rational Field", whereas the coordinate ring of TotalSpace is "Multivariate Polynomial Ring in x0, x1, x2, s0, s1 over Rational Field". There is an obvious map P2.coordinate_ring() -> TotalSpace.coordinate_ring() (which is a map of QQ-algebras, but not R-algebras). How do I get my hands on this thing in Sage? The problem is that P2.coordinate_ring().gens() has only three elements (the xi's), and I'm not sure how to specify the images of the si's.

In general, is it correct to declare multiple rings like this, with the same names for the generators, if I would like the generators to be identified with each other? Or do I need to start with one and get the rest by adjoining things to that? How do I handle the "inject_variables()" commands in this situation?

edit retag close merge delete

Sort by » oldest newest most voted

Here is one possible way to proceed

sage: R_P2 = P2.coordinate_ring()
sage: R_TotalSpace = TotalSpace.coordinate_ring()
sage: H = Homset(R_P2, R_TotalSpace, category=Algebras(QQ))
sage: def f(p): return R_TotalSpace(str(p))
sage: phi = H(f)
sage: x0,x1,x2 = R_P2.gens()
sage: s0,s1 = R_P2.base_ring().gens()
sage: p = (x0 + 1) * (x1 + 1) * (x2 + 1) * (s0 + 1) * (s1 + 1)
sage: p
(s0*s1 + s0 + s1 + 1)*x0*x1*x2 + (s0*s1 + s0 + s1 + 1)*x0*x1 + (s0*s1 + s0 + s1 + 1)*x0*x2 + (s0*s1 + s0 + s1 + 1)*x1*x2 + (s0*s1 + s0 + s1 + 1)*x0 + (s0*s1 + s0 + s1 + 1)*x1 + (s0*s1 + s0 + s1 + 1)*x2 + s0*s1 + s0 + s1 + 1
sage: phi(p)
x0*x1*x2*s0*s1 + x0*x1*x2*s0 + x0*x1*x2*s1 + x0*x1*s0*s1 + x0*x2*s0*s1 + x1*x2*s0*s1 + x0*x1*x2 + x0*x1*s0 + x0*x2*s0 + x1*x2*s0 + x0*x1*s1 + x0*x2*s1 + x1*x2*s1 + x0*s0*s1 + x1*s0*s1 + x2*s0*s1 + x0*x1 + x0*x2 + x1*x2 + x0*s0 + x1*s0 + x2*s0 + x0*s1 + x1*s1 + x2*s1 + s0*s1 + x0 + x1 + x2 + s0 + s1 + 1


(of course it is not very efficient since it goes through the string representation)

more