# Group of units of number field mod ideal

I am wondering whether Sage has a built-in function that takes an ideal $\mathfrak{a}$ of a number field and returns the unit group of the quotient ring $(\mathcal{O}_K / \mathfrak{a})^{\times}.$

More specifically the problem is to iterate through the characters of $(\mathcal{O}_K / \mathfrak{a})^{\times}$ (essentially Hecke characters) and apply them to a given element of $\mathcal{O}_K$. I am at a bit of a loss as to how to do this in Sage.

edit retag close merge delete

Sort by » oldest newest most voted

To construct $(O_K / A)^\times$, use the method ìdealstar.

Following the documentation.

Define a number field $K$ and an ideal $A$.

sage: K.<a> = NumberField(x^3 - 11)
sage: A = K.ideal(5)


The method idealstar gives you $(O_K / A)^\times$.

sage: G = A.idealstar(); G
Multiplicative Abelian group isomorphic to C24 x C4
sage: G.gens()
(f0, f1)


Using the optional argument flag=2, the generators of $(O_K / A)^\times$ are computed as elements in $K$.

sage: G = A.idealstar(flag=2)
sage: G.gens()
(f0, f1)
sage: G.gens_values()
(2*a^2 + a - 2, 2*a^2 + 2*a - 2)


To work with characters, use the method dual_group.

See the documentation here: http://doc.sagemath.org/html/en/reference/groups/sage/groups/abelian_gps/dual_abelian_group.html.

more