1 | initial version |
Would the following 'flatten' function do the job?
def flatten(R):
v = []
while True:
g = R.gens()
if g[0].is_unit():
break
v.extend(g)
R = R.base_ring()
return PolynomialRing(R,v)