#14366: Zero does not belong to zero ideal of a number field
-----------------------------+----------------------------------------------
Reporter: olitb | Owner: davidloeffler
Type: defect | Status: new
Priority: major | Milestone: sage-5.9
Component: number fields | Keywords:
Work issues: | Report Upstream: N/A
Reviewers: | Authors:
Merged in: | Dependencies:
Stopgaps: |
-----------------------------+----------------------------------------------
The following is mathematically wrong:
{{{
sage: 0 in CyclotomicField(3).ideal(0)
False
}}}
It comes from the function _contains_(self, x) in the class
NumberFieldIdeal (file sage/rings/number_field/number_field_ideal.py),
which tries to compute the coordinates of the element in a basis (over ZZ)
of the ideal. The function coordinates(self, x) fails for the zero ideal,
raising a TypeError (in fact when _contains_ is called directly, a
TypeError is raised).
A workaround is to replace
{{{
def _contains_(self, x):
return self.coordinates(self.number_field()(x)).denominator() == 1
}}}
with
{{{
def _contains_(self, x):
return x==0 or self.coordinates(self.number_field()(x)).denominator()
== 1
}}}
but I am not sure if it is the "right" way to do it.
Is it desirable to have the _contains_ function in sage/rings/ideal.py
catch the TypeError (silently)?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14366>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.