First time here? Check out the FAQ!
answered 2 years ago
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)