1 | initial version |
Define your number field $\mathbb{Q}(\alpha), \alpha = \sqrt{2} + i$ .
K.<a> = NumberField(definingPolynomial)
In your particular case
Z.<x> = ZZ[] #Makes x lives in Z[x]
K.<a> = NumberField( minpoly(sqrt(2)+i, x))
I = K.ideal(2)
factor(I)
#(Fractional ideal (1/12*a^3 - 1/4*a^2 - 5/12*a + 5/4))^4
#Even fancier
latex(factor(I))
#(\left(\frac{1}{12} a^{3} - \frac{1}{4} a^{2} - \frac{5}{12} a + \frac{5}{4}\right))^{4}