# How can I find the elements in a factor ring?

Let $K=\mathbb{Q}(\sqrt{2})$ and $\mathfrak{a}=(3)=3\mathcal{O}_K$ an ideal in $K$. How can I find the elements in $\mathcal{O}_K/\mathfrak{a}$ using sage?

edit retag close merge delete

Sort by » oldest newest most voted

Here is a possibility...

sage: K.<a> = QuadraticField(2)
sage: OK = K.OK()

sage: OK.gens()
(1, a)    sage: J = OK.ideal(3)

sage: Q = OK.quotient(J, names='abar')
sage: Q
Quotient of Maximal Order in Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095? by the ideal (3)
sage: Q.is_field()
True
sage: Q.is_prime_field()
False
sage: Q.inject_variables()
Defining abar0, abar1
sage: abar0
1
sage: abar1
a


But do not expect too much functionality from this construction. Instead, why not construct "with bare hands" the ring last listed in the following chain of isomorphisms. (We know that $\mathcal O_K$ is generated by $1$ and $a=(x\text{ mod }(3))$.) $$\mathcal O_K/(3) =(\Bbb Z[x]/(x^2-2))/3 =\Bbb Z[x]/(x^2-2,\ 3) =(\Bbb Z[x]/3)/(x^2-2) =\Bbb F_3[x]/(x^2-2) \ .$$ Which is:

R.<x> = PolynomialRing(GF(3))
F.<a> = GF(9, modulus=x^2-2)


Of course, knowing the purpose for the needed code snippet may change the situation.

more