# Polynomial Ring bug?

I would like to ask, why following code ends with error:

R = PolynomialRing(GF(3),'x3,x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x0, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)

because when I remove x0 from the generators, it works fine.

R = PolynomialRing(GF(3),'x3,x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)

Thanks for the answer, but there is still an open question. I have been working with this for a few days, and up untill this case, I had no trouble getting the same polynomial in a ring with fewer genarators, if the original polynomial contained only those. I tried and the followng code works fine, and it also fits your last case which according to you should raise an error, because U has more generators than R.

R = PolynomialRing(GF(3),'x5,x4,x7,x6')

U = PolynomialRing(GF(3), 'x2, x5, x4, x1, x6')

f = U.gens()[1] + U.gens()[2]

g = R(f)