Opened 3 years ago

Last modified 3 years ago

#23593 new defect

absolute_norm not implemented for ideals over ZZ or QQ

Reported by: edgarcosta Owned by:
Priority: minor Milestone: sage-8.1
Component: number fields Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Trying

ZZ.ideal(2).absolute_norm()

raises a NotImplementedError.

However,

NumberField(var('y'),"a").ring_of_integers().ideal(2).absolute_norm()

works fine.

This should be an easy fix, but I'm not sure where is the right place to do it.

Change History (5)

comment:1 Changed 3 years ago by roed

Interesting. In sage.rings.ideal.Ideal_generic, norm() returns self while absolute_norm raises a NotImplementedError. Maybe just update that function to return self?

comment:2 follow-up: Changed 3 years ago by edgarcosta

That could be a solution, but somewhat, to me seems that norm() should also raise a NotImplementedError.

I'm leaning more towards returning self.gen().norm() and self.gen(). absolute_norm() for ideals in a PID.

What do you think?

comment:3 Changed 3 years ago by edgarcosta

  • Summary changed from absolute_norm not implemented for ZZ or QQ to absolute_norm not implemented for ideals over ZZ or QQ

comment:4 in reply to: ↑ 2 Changed 3 years ago by roed

Replying to edgarcosta:

That could be a solution, but somewhat, to me seems that norm() should also raise a NotImplementedError.

I'm leaning more towards returning self.gen().norm() and self.gen(). absolute_norm() for ideals in a PID.

What do you think?

That sounds reasonable to me. Do you also want to define relative_norm to return self?

comment:5 Changed 3 years ago by edgarcosta

Most likely...

Alternatively, we could create a new class for ZZ ideals and QQ fractional ideals, see #23595.

Note: See TracTickets for help on using tickets.