Ask Your Question

Kernel for maps into iterated PolynomialRings

asked 2023-03-10 16:39:33 +0200

It's often convenient to construct quotient rings in an iterated fashion, e.g. when localizing a polynomial ring:


However, Sage complains when I am trying to calculate a kernel of a homomorphism into such an iteratively constructed ring:


Here, Sage treats B as the base ring for C and QQ as the base ring for A and kernel() is not implemented for different base rings. I know, that I could simply construct C as


to overcome the problem, but in practice B might be the argument of a method and it would be convenient to extend the ring B instead of having to unpick its construction and create a new ring from scratch.

Is there a way to make this work? E.g. by "flattening" such an iterated construction in an automated fashion?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-03-17 15:13:23 +0200

Max Alekseyev gravatar image

Would the following 'flatten' function do the job?

def flatten(R):
    v = []
    while True:
        g = R.gens()
        if g[0].is_unit():
        R = R.base_ring()
    return PolynomialRing(R,v)
edit flag offensive delete link more


Technically this answers my question. Although I was hoping for some built-in solution, which also works when B is not just a PolynomialRing, but a quotient of a PolynomialRing (or a localization). I guess, I will have to unpick these constructions by hand and construct a new ring as in your answer.

hendrikS gravatar imagehendrikS ( 2023-03-28 08:37:13 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2023-03-10 16:35:15 +0200

Seen: 78 times

Last updated: Mar 17