# substitute x*y by u

Hi there!

I have a polynomial $f(x,y) = x*y + x^2*y^2 + x*y^2$

I want to substitute $x*y$ instances by a new unknown $u$ (s.t. $u = x * y$)

This is how I proceeded:

```
# this is the default code
P.<x, y> = PolynomialRing(Zmod(5))
f = x*y + x^2*y^2 + x*y^2
# now I want to introduce the substitution so I have a f(x,y,u)
new_ring.<x,y,u> = PolynomialRing(ZZ)
ff = f.sub(x*y = u)
```

Of course this code doesn't work... Any idea what I could do?

It doesn't look like there's support for substituting products. Instead you can do

What exactly do you want to replace? Do you want x^2 y^3 -> u^2 y and x^3 y^2 -> x u^2?

yes @vdelecroix

Maybe with wildcards?