Suppose I have
R.<x,y,z>=QQ[]
K.<u,v>=QQ[]
f=R.hom([u*v,u^2,v^2-u^2])
then for any even degree p in K one can compute
a preimage under f (e.g. u^4-u*v goes to y^2+x, etc)
I think the general way (which should be pretty performant for such a nice example) is to do it via reduction wrt. the graph ideal:sage: R.<u,v,x,y,z>=PolynomialRing(QQ,order="degrevlex(2),degrevlex(3)")
sage: I=R.ideal([x-u^2,y-u*v,z-v^2])
sage: inv=lambda f:QQ['x,y,z']((I.reduce(f)))
sage: inv(u^2)
xObviously, the term order chosen will dictate what representative you get back, if the map isn't injective. You should of course choose an elimination order.