Opened 14 years ago

Closed 14 years ago

#5214 closed defect (fixed)

[fixed by #5508] coercion to orders in relative number fields is not implemented

Reported by: ncalexan Owned by: William Stein
Priority: minor Milestone: sage-3.4.1
Component: number theory Keywords: relative order number field coercion
Cc: Robert Bradshaw Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

sage: t = OK.basis()[0]
sage: x = ZZ['x'].0
sage: K.<a,b> = NumberField([x^2 + 1, x^2 - 3])
sage: OK = K.maximal_order(); OK.basis()                                                                                          
[1, 1/2*a - 1/2*b, -1/2*b*a + 1/2, a]
sage: OK(a)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (363, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1152, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ncalexan/.sage/temp/sage.math.washington.edu/21534/_home_ncalexan__sage_init_sage_0.py in <module>()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/order.pyc\
 in __call__(self, x)
   1192         if x.parent() is not self._K:
   1193             x = self._K(x)
-> 1194         x = self._absolute_order(x) # will test membership
   1195         return OrderElement_relative(self, x)
   1196

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/order.pyc\
 in __call__(self, x)
    900             return x
    901         if not is_Element(x) or x.parent() is not self._K:
--> 902             x = self._K(x)
    903         V, _, embedding = self._K.vector_space()
    904         if not embedding(x) in self._module_rep:

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.\
structure.parent.Parent.__call__ (sage/structure/parent.c:3653)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in \
sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:2793)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in \
sage.structure.coerce_maps._call_ (sage/structure/coerce_maps.c:2700)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/number_fi\
eld.pyc in _element_constructor_(self, x)
    829                     return self._element_class(self, x)
    830                 x = L(x)
--> 831             return self._coerce_from_other_number_field(x)
    832         elif isinstance(x,str):
    833             return self._coerce_from_str(x)

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/number_fi\
eld.pyc in _coerce_from_other_number_field(self, x)
   3560             return self._element_class(self, f[0])
   3561         # todo: more general coercion if embedding have been asserted
-> 3562         raise TypeError, "Cannot coerce element into this number field"
   3563
   3564     def _coerce_non_number_field_element_in(self, x):

TypeError: Cannot coerce element into this number field
OK(b)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (363, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1152, 0))

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ncalexan/.sage/temp/sage.math.washington.edu/21534/_home_ncalexan__sage_init_sage_0.py in <module>()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/order.pyc\
 in __call__(self, x)
   1192         if x.parent() is not self._K:
   1193             x = self._K(x)
-> 1194         x = self._absolute_order(x) # will test membership
   1195         return OrderElement_relative(self, x)
   1196

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/order.pyc\
 in __call__(self, x)
    900             return x
    901         if not is_Element(x) or x.parent() is not self._K:
--> 902             x = self._K(x)
    903         V, _, embedding = self._K.vector_space()
    904         if not embedding(x) in self._module_rep:

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.\
structure.parent.Parent.__call__ (sage/structure/parent.c:3653)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in \
sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:2793)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in \
sage.structure.coerce_maps._call_ (sage/structure/coerce_maps.c:2700)()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/number_fi\
eld.pyc in _element_constructor_(self, x)
    829                     return self._element_class(self, x)
    830                 x = L(x)
--> 831             return self._coerce_from_other_number_field(x)
    832         elif isinstance(x,str):
    833             return self._coerce_from_str(x)

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/number_fi\
eld.pyc in _coerce_from_other_number_field(self, x)
/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/number_fi\
eld.pyc in _coerce_from_other_number_field(self, x)
   3560             return self._element_class(self, f[0])
   3561         # todo: more general coercion if embedding have been asserted
-> 3562         raise TypeError, "Cannot coerce element into this number field"
   3563
   3564     def _coerce_non_number_field_element_in(self, x):

TypeError: Cannot coerce element into this number field
sage: OK.basis()[3].list()
[0, 1]
sage: OK(OK.basis()[3].list())
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/ncalexan/.sage/temp/sage.math.washington.edu/21534/_home_ncalexan__sage_init_sage_0.py in <module>()

/scratch/ncalexan/sage-3.3.alpha5-sage.math-only-x86_64-Linux/local/lib/python2.5/site-packages/sage/rings/number_field/order.pyc\
 in __call__(self, x)
   1190         Coerce an element into this relative order.
   1191         """                                                                                                               
-> 1192         if x.parent() is not self._K:                                                                                     
   1193             x = self._K(x)                                                                                                
   1194         x = self._absolute_order(x) # will test membership                                                                
                                                                                                                                  
AttributeError: 'list' object has no attribute 'parent'                                      

Change History (6)

comment:1 Changed 14 years ago by Michael Abshoff

Cc: Robert Bradshaw added
Milestone: sage-3.4sage-3.4.1

3.4 is mostly about the ReST patches. Once those are in we will likely cut 3.4 as a release and then quickly open 3.4.1 to merge fixes on top of the ReST code.

Cheers,

Michael

comment:2 Changed 14 years ago by Francis Clarke

Summary: coercion to orders in relative number fields is not implemented[fixed subject to review of #5508] coercion to orders in relative number fields is not implemented

The problem is solved by changes to __call__ for the class RelativeOrder in sage/rings/number_theory/order.py to be found in #5508.

comment:3 Changed 14 years ago by Michael Abshoff

Summary: [fixed subject to review of #5508] coercion to orders in relative number fields is not implemented[fixed by #5508] coercion to orders in relative number fields is not implemented

To close this we would need a doctest.

Cheers,

Michael

comment:4 Changed 14 years ago by Michael Abshoff

Milestone: sage-3.4.2sage-3.4.1

comment:5 in reply to:  3 Changed 14 years ago by Francis Clarke

Replying to mabshoff:

To close this we would need a doctest.

See lines 1194 to 1199 of sage/rings/number_field/order.py as patched by #5508:

            sage: K.<a, b> = NumberField([x^2 + 2, x^2 + 1000*x + 1]) 
            sage: OK = K.ring_of_integers()
            sage: OK(a)
            sage: a
            sage: OK([3, 4])
            4*a + 3

comment:6 Changed 14 years ago by Michael Abshoff

Resolution: fixed
Status: newclosed

Fixed in Sage 3.4.1.alpha0 via #5508. Thanks Francis :)

Cheers,

Michael

Note: See TracTickets for help on using tickets.