In the ring $\mathbb{Z}[x,y]$ , I want to add the new variable z:=xy, and show it in the polynomial $p=(ex+y)^2$ so that $p=(ex)^2+2z+y^2$. My attempt is to define the rings and the polynomial $p$
S.<e>=ZZ['e'];
R.<x,y,z>=S['x, y, z'];
p=(e*x+y)^2
and to set $xy=z$, we define the ideal $I=(xy-z)R $ and the quotient $Q=R/I$
I=(x*y-z)*R; Q=R.quo(I)
to reduce the polynomial $p$ modulo the ideal $I$ we use
q=Q(p)
So far, I have a problem such that sagemath outputs an error ' Can only reduce polynomials over fields.' I want to know where is the problem ??