ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 14 Jul 2017 00:37:00 +0200Canonical maps between iterated polynomial ringshttps://ask.sagemath.org/question/37435/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?Thu, 27 Apr 2017 06:00:42 +0200https://ask.sagemath.org/question/37435/canonical-maps-between-iterated-polynomial-rings/Answer by vdelecroix for <p>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.</p>
<p>I'm considering the following spaces.</p>
<pre><code>R = PolynomialRing(QQ,2,'s')
P2 = ProjectiveSpace(2,R,'x')
TotalSpace = ProductProjectiveSpaces([2,1],QQ,names=['x','s'])
</code></pre>
<p>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.</p>
<p>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?</p>
https://ask.sagemath.org/question/37435/canonical-maps-between-iterated-polynomial-rings/?answer=38247#post-id-38247Here 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)Fri, 14 Jul 2017 00:37:00 +0200https://ask.sagemath.org/question/37435/canonical-maps-between-iterated-polynomial-rings/?answer=38247#post-id-38247