1 | initial version |
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)