Opened 4 years ago

Last modified 4 years ago

#22526 new enhancement

Change string representation of fractional ideals of number fields

Reported by: mmasdeu Owned by:
Priority: major Milestone: sage-7.6
Component: number fields Keywords: ideals, number fields
Cc: vdelecroix, roed, davidloeffler, tmonteil, simonking Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Fractional ideals are elements (of a monoid) but currently they print as verbosely as if they were parents:

sage: F.<r> = NumberField(x^2-10)
sage: F.ideal(3,r+1)
Fractional ideal (3, r + 1)

The problem gets worse for ideals of ZZ:

sage: ZZ.ideal(3)
Principal ideal (3) of Integer Ring

I propose that the _repr_ method is changed so the two previous outputs read, for example:

sage: F.ideal(3,r+1)
((3, r+1))
sage: ZZ.ideal(3)
((3))

Another option would be

sage: F.ideal(3,r+1)
(3, r+1)*Z_F
sage: ZZ.ideal(3)
(3)*ZZ

but the first one seems informative enough. One can easily get all the other information from available methods of the ideal.

Change History (1)

comment:1 Changed 4 years ago by roed

I'm fine with changing the printing somehow. The double parenthesis notation isn't standard for ideals, but I agree that just using single parenthesis probably isn't distinct enough from other expressions. Z_F doesn't work since the element has no access to a variable name referring to the parent (in fact, there may be such multiple variables). So, I'm in favor of the ((3, r+1)) notation unless someone has a better idea.

Note: See TracTickets for help on using tickets.