#11307: L rel. number field, E/L ell. curve, P in E(L), 'P in E.base_ring()' ->
AttributeError
-------------------------------+--------------------------------------------
Reporter: pbruin | Owner: cremona
Type: defect | Status: new
Priority: minor | Milestone: sage-4.7.1
Component: elliptic curves | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-------------------------------+--------------------------------------------
Old description:
> The following code gives an AttributeError where it should probably
> return False.
>
> {{{
> K = QuadraticField(2, 't')
> L = K.extension(x^2 + x + 1, 'u')
> E = EllipticCurve([1,0]).base_extend(L)
> E([0,0]) in E.base_ring()
> }}}
>
> This gives the following output:
>
> {{{
> AttributeError Traceback (most recent call
> last)
>
> <ipython console> in <module>()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__contains__
> (sage/structure/parent.c:6635)()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6462)()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so
> in sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3118)()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so
> in sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3021)()
>
> sage-4.6/local/lib/python2.6/site-
> packages/sage/rings/number_field/number_field.pyc in
> _element_constructor_(self, x)
> 1106 result += x[i]*self.gen(0)**i
> 1107 return result
> -> 1108 return self._coerce_non_number_field_element_in(x)
> 1109
> 1110 def _coerce_from_str(self, x):
>
> sage-4.6/local/lib/python2.6/site-
> packages/sage/rings/number_field/number_field_rel.pyc in
> _coerce_non_number_field_element_in(self, x)
> 964 return self._element_class(self,
> f(self.gen()).polynomial() )
> 965 else:
> --> 966 return self._element_class(self, x._rational_())
> 967
> 968 def _coerce_map_from_(self, R):
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/element.so in
> sage.structure.element.Element.__getattr__
> (sage/structure/element.c:2666)()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
> sage.structure.parent.getattr_from_other_class
> (sage/structure/parent.c:2840)()
>
> sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
> sage.structure.parent.raise_attribute_error
> (sage/structure/parent.c:2638)()
>
> AttributeError: 'EllipticCurvePoint_number_field' object has no attribute
> '_rational_'
> }}}
>
> The same code, but with base_extend(K) instead of base_extend(L), simply
> returns False, as expected.
New description:
The following code gives an `AttributeError` where it should probably
return False.
{{{
K = QuadraticField(2, 't')
L = K.extension(x^2 + x + 1, 'u')
E = EllipticCurve([1,0]).base_extend(L)
E([0,0]) in E.base_ring()
}}}
This gives the following output:
{{{
AttributeError Traceback (most recent call
last)
<ipython console> in <module>()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
sage.structure.parent.Parent.__contains__ (sage/structure/parent.c:6635)()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6462)()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so
in sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3118)()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/coerce_maps.so
in sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3021)()
sage-4.6/local/lib/python2.6/site-
packages/sage/rings/number_field/number_field.pyc in
_element_constructor_(self, x)
1106 result += x[i]*self.gen(0)**i
1107 return result
-> 1108 return self._coerce_non_number_field_element_in(x)
1109
1110 def _coerce_from_str(self, x):
sage-4.6/local/lib/python2.6/site-
packages/sage/rings/number_field/number_field_rel.pyc in
_coerce_non_number_field_element_in(self, x)
964 return self._element_class(self,
f(self.gen()).polynomial() )
965 else:
--> 966 return self._element_class(self, x._rational_())
967
968 def _coerce_map_from_(self, R):
sage-4.6/local/lib/python2.6/site-packages/sage/structure/element.so in
sage.structure.element.Element.__getattr__
(sage/structure/element.c:2666)()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
sage.structure.parent.getattr_from_other_class
(sage/structure/parent.c:2840)()
sage-4.6/local/lib/python2.6/site-packages/sage/structure/parent.so in
sage.structure.parent.raise_attribute_error
(sage/structure/parent.c:2638)()
AttributeError: 'EllipticCurvePoint_number_field' object has no attribute
'_rational_'
}}}
The same code, but with base_extend(K) instead of base_extend(L), simply
returns False, as expected.
--
Comment(by fwclarke):
This is nothing specifically to do with elliptic curves. For example
{{{
sage: K.<t> = QuadraticField(2)
sage: L.<u> = K.extension(x^2 + x + 1)
sage: K in K
False
sage: K in L
Traceback (most recent call last):
...
AttributeError: 'NumberField_quadratic_with_category' object has no
attribute '_rational_'
}}}
The difference is that while for an absolute number field `K` a
`TypeError` is raised by `K(z)` for an object `z` which cannot be
converted into an element of `K`, an `AttributeError` is raised by `L(z)`.
However `sage.structure.parent.Parent.__contains__` filters out (returning
`False`) only `TypeError` and `ValueError`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11307#comment:1>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.