On Sun, Aug 16, 2026 at 4:03 PM Dima Pasechnik <
dim...@gmail.com> wrote:
>
> types are the same, parents are a bit different:
>
> sage: P.parent()
> Monoid of ideals of Maximal Order generated by [1/3*a^2 + 1/3*a + 1/3,
> a] in Number Field in a with defining polynomial x^3 - 37
> sage: OK.parent()
> <class 'sage.rings.number_field.order.Order_absolute_with_category'>
> <class 'sage.rings.number_field.order_ideal.NumberFieldOrderIdeal_generic'>
> sage: type(OK)
> <class 'sage.rings.number_field.order.Order_absolute_with_category'>
> sage:
>
> What is the output here:
>
> sage: P.factor??
>
> (here ?? is what we use to print the source code).
>
sage: P.factor??
Source:
def factor(self):
"""
Factorization of this ideal in terms of prime ideals.
EXAMPLES::
sage: x = polygen(ZZ)
sage: K.<a> = NumberField(x^4 + 23); K
Number Field in a with defining polynomial x^4 + 23
sage: I = K.ideal(19); I
Fractional ideal (19)
sage: F = I.factor(); F
(Fractional ideal (19, 1/2*a^2 + a - 17/2))
* (Fractional ideal (19, 1/2*a^2 - a - 17/2))
sage: type(F)
<class 'sage.structure.factorization.Factorization'>
sage: list(F)
[(Fractional ideal (19, 1/2*a^2 + a - 17/2), 1),
(Fractional ideal (19, 1/2*a^2 - a - 17/2), 1)]
sage: F.prod()
Fractional ideal (19)
TESTS:
Number fields defined by non-monic and non-integral
polynomials are supported (:issue:`252`);
the representation depends on the PARI version::
sage: F.<a> = NumberField(2*x^3 + x + 1)
sage: fact = F.factor(2)
sage: (fact[0][1], fact[1][1])
(2, 1)
sage: fact[0][0] == F.ideal(2*a^2 + 1)
True
sage: fact[1][0] == F.ideal(-2*a^2)
True
sage: [p[0].norm() for p in fact]
[2, 2]
"""
try:
return self.__factorization
except AttributeError:
K = self.number_field()
F = K.pari_nf().idealfactor(self.pari_hnf())
A = []
for j in range(0, len(F[0])):
I = K.ideal(F[j,0])
A.append((I,ZZ(F[j,1])))
self.__factorization = Factorization(A)
return self.__factorization
File: /private/var/tmp/sage-10.4-current/local/var/lib/sage/venv-python3.12.4/lib/python3.12/site-packages/sage/rings/number_field/number_field_ideal.py
Type: method
> To view this discussion visit
https://groups.google.com/d/msgid/sage-support/CAAWYfq0rh0NNuKNd5HQByqOpXkfvNA8po6fPta4AVv4F%2Bh%2BP5w%40mail.gmail.com.