Ask Your Question

Revision history [back]

The method class_number gives you the answer, there is no need for further methods

sage: QuadraticField(2).class_number()
1
sage: QuadraticField(-5).class_number()
2

For a number field, the fractional ideals form a group under multiplication. The class number is the number of elements in the quotient of this ring by the principal ideals. Hence, the class number is 1 if and only if the number field is a PID.

see also: http://en.wikipedia.org/wiki/Ideal_class_group

The method class_number gives you the answer, there is no need for further methods

sage: QuadraticField(2).class_number()
1
sage: QuadraticField(-5).class_number()
2

For a number field, field K, the fractional ideals form a group under multiplication. The class number of K is the number of elements in the quotient of this ring by the principal ideals. Hence, In particular, the class number is 1 if and only if the number field ring of integers of K is a PID.

see also: http://en.wikipedia.org/wiki/Ideal_class_group