Opened 11 years ago

Last modified 3 months ago

#7596 needs_review defect

QQ.number_field() does not behave like any other NumberField

Reported by: rlm Owned by: davidloeffler
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: number fields Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

Several examples:

sage: K.<a> = NumberField(x)
sage: K.ideal(5)
Fractional ideal (5)
sage: QQ.ideal(5)
Principal ideal (1) of Rational Field
sage: QQ.number_field().ideal(5)
Principal ideal (1) of Rational Field
K = QQ
I = K.ideal(7)

This creates ideal that does not have the functions I.denominator, I.numerator, I.prime_ideals() ... which a fractional ideal in a number field should have

K.<a> = NumberField(x^2+2)
I = K.ideal(7)

Similarly, QQ.places() is not implemented; it should return the one infinite place for Q. Although there seems to be QQ.embeddings().

QQ.places()

Attachments (2)

trac_7596_places_for_QQ.patch (3.3 KB) - added by chapoton 8 years ago.
trac_7596_number_fields_are_quotient_fields.patch (2.2 KB) - added by chapoton 8 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 10 years ago by mderickx

  • Milestone changed from sage-4.6.2 to sage-duplicate/invalid/wontfix

comment:2 Changed 10 years ago by mderickx

  • Milestone changed from sage-duplicate/invalid/wontfix to sage-4.6.2

comment:3 Changed 10 years ago by mderickx

sorry modified the wrong ticket, i meant to edit #9414 which is a duplicate of this one

comment:4 Changed 10 years ago by jdemeyer

  • Description modified (diff)

Changed 8 years ago by chapoton

comment:5 Changed 8 years ago by chapoton

here is already a ticket for the easy part : a method "places" for QQ

comment:6 Changed 8 years ago by chapoton

I have imported a patch trying to have QQ and number fields in the same categories:

sage: K.<phi> = NumberField(x**2-x-1)
sage: K.categories() == QQ.categories()
True

but this breaks the lcm and gcd in a bad way..

comment:7 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:8 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:9 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:10 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:11 Changed 3 months ago by cremona

As of 9.3.beta3, certainly QQ.places() does work. What I usually do is, when I find a method which QQ does not have but a general number field does have, in the course of implementing something, I just add an aimplementation for QQ. I think this is more efficient than trying to make QQ work like a number field. There will be a large number of users who get to see QQ who never use more general number fields. For such people it does not matter at all to have methods like QQ.places() whose use they may not know. There were many arguments about what QQ.ideal(5) should return, since the pedantic aswer (as for any field, with a nonzero generator) is that it has to be "Principal ideal (1) of ...". Number theorists are quite happy to have K.ideal(...) meaning K.fractional_ideal(...).

Is there any reason not to mark this as invalid/won't fix?

comment:12 Changed 3 months ago by cremona

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

comment:13 Changed 3 months ago by gh-DaveWitteMorris

-1 for closing. I think comment:11 discloses a serious problem, though not exactly what is emphasized in the ticket description. Number fields are rings:

sage: K.<a> = NumberField(x)
sage: isinstance(K, Ring)
True

Thus, the ideal method of a number field needs to return an ideal of self (not an ideal of some subring of self), because that is what is expected by the ideal method of a Ring. Otherwise, well-written code involving rings will be buggy.

I think that if number theorists are not willing to accept this, then NumberField should not inherit from Ring. But I think it would be better to introduce a new method (maybe integer_ideal) to the NumberField class, or add a keyword flag to the ideal method.

comment:14 Changed 3 months ago by cremona

We have had this discussion many times over the years. I think I first had it in Jan 2008. There are correct term for these: "integral ideals" and "fractional ideals". Calling them "ideals" is an abuse of language (agreed), just a common one. There is no reason at all not to use "fractional_ideal" as the method name -- the class name is already NumberFieldFractionalIdeal. But it would break a lot of users' code (including mine) so it is not a high priority for me.

This ticket has been open for 11 years...

Note: See TracTickets for help on using tickets.