# Revision history [back]

It's better to use the equality sign with subs: f.subs(x*y==u) or a dictionary:

sage: P.<x, y> = PolynomialRing(Zmod(5))
sage: f = x*y + x^2*y^2 + x*y^2
sage: f.subs({x*y:u})
u^2*y^2 + u*y^2 + u*y


Note this different from

sage: x,y = var('x,y')
sage: f = x*y + x^2*y^2 + x*y^2
sage: f.subs({x*y:u})
x^2*y^2 + x*y^2 + u


because of the ring. But certainly, we would want u+u^2+u*y as result and Sage cannot do that at the moment. I've opened a ticket for it: http://trac.sagemath.org/ticket/17879