# Revision history [back]

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=A_m=F[x_0,x_1,\dots,x_m]$$ and $$B=B_n=F[y_0,y_1,\dots,y_n]$$ and a map from $A$ to $B$ given formally by $$x_k\to f_k(y_0, y_1,\dots,y_n)\ .$$ Here $f_k$ is a homogenous polynomial of degree $d$. So the map $f$ (say) $$A_m\to B_n$$ induces a map $${\mathbb P}_F^m\leftarrow {\mathbb P}_F^n\ .$$ (And we will never see the projective spaces again.) Let us now work in the ring $$C = F[\ x_0,x_1,\dots,x_m\ ;\ y_0,y_1,\dots,y_n\ ]\ /\ J$$ where $J$ is the ideal generated by the weighted homogenous polynomials $$y_k - f_k(x_0,x_1,\dots,x_m)\ .$$ We want and only need now to eliminate the $x$-variables.

Code example:

We use instead of $x_0,x_1,x_2$ the variables a,b,c.

And instead of $y_0, y_1,y_2,y_3,y_4,y_5,y_6$ 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