The missing key word is elimination, the sage method is elimination_ideal
:
There will be no (projective) Spec in this answer, hope, i am translating correctly the question into the affine (homogenos) setting. Let us fix a (ring R, or maybe first a) field F. We consider the two polynomial rings A=Am=F[x0,x1,…,xm] and B=Bn=F[y0,y1,…,yn] and a map from A to B given formally by xk→fk(y0,y1,…,yn) . Here fk is a homogenous polynomial of degree d. So the map f (say) Am→Bn induces a map PmF←PnF . (And we will never see the projective spaces again.) Let us now work in the ring C=F[ x0,x1,…,xm ; y0,y1,…,yn ] / J where J is the ideal generated by the weighted homogenous polynomials yk−fk(x0,x1,…,xm) . We want and only need now to eliminate the x-variables.
Code example:
We use instead of x0,x1,x2 the variables a,b,c
.
And instead of y0,y1,y2,y3,y4,y5,y6 the variables
s,t,u,v,w,x,y,z
.
We work over rationals and consider the map of degree d=4 corresponding to:
R.<a,b,c,s,t,u,v,w,x,y,z> = PolynomialRing( QQ )
J = R.ideal( [ s - ( a^4 + b^4 + c^4 ),
t - ( a^2 + b^2 + c^2 )^2,
u - ( a+b+c )*(a^3 + b^3 + c^3),
v - a*b*c*(a+b+c),
w - ( a^2*b^2 + a^2*c^2 + b^2*c^2 ),
x - ( a*b + a*c + b*c )^2,
y - ( a + b + c )^4,
z - ( a^3*b + a*b^3 + a^3*c + a*c^3 + b^3*c + b*c^3 ) ] )
K = J.elimination_ideal( [ a,b,c ] )
for g in K.gens():
print g
This gives:
2*v + w - x
u + 6*x - y + 3*z
t - 2*w + 6*x - y + 4*z
s + 6*x - y + 4*z
w^2 - 10*w*x + 25*x^2 - 4*x*y - 4*w*z + 20*x*z + 4*z^2