Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following dialog worked for me...

sage: K.<a> = QuadraticField(5)                                                                                               
sage: OK = K.ring_of_integers()                                                                                               
sage: OK.gens()                                                                                                               
(1/2*a + 1/2, a)
sage: g = 1 + 7*(1+a)/2    # can be obviously expressed in terms of OK.gens()                                                 
sage: g in OK                                                                                                                 
True
sage: J = OK.ideal(g)    # works                                                                                              
sage: J                                                                                                                       
Fractional ideal (7/2*a + 9/2)

It was possible to initialize J, since its generator(s) $\in \mathcal O_K$. But if we try "the same" with some $h$ which is not integral...

sage: h = a/3                                                                                                                 
sage: h in OK                                                                                                                 
False
sage: H = OK.ideal(h)                                                                                                         
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)