#6643: vector function changes the ring of a vector for ZZ when possible
----------------------------+-----------------------------------------------
 Reporter:  slabbe          |       Owner:  slabbe    
     Type:  defect          |      Status:  new       
 Priority:  major           |   Milestone:  sage-4.1.1
Component:  linear algebra  |    Keywords:            
 Reviewer:                  |      Author:            
   Merged:                  |  
----------------------------+-----------------------------------------------
 The following works fine, i.e vector function doesn't change the ring of
 the input vector :

 {{{
 sage: K.<sqrt3> = QuadraticField(3); K
 Number Field in sqrt3 with defining polynomial x^2 - 3
 sage: v = vector(K, (1/2, sqrt3/2) ); v
 (1/2, 1/2*sqrt3)
 sage: v.parent()
 Vector space of dimension 2 over Number Field in sqrt3 with defining
 polynomial x^2 - 3
 sage: vector(v).parent()
 Vector space of dimension 2 over Number Field in sqrt3 with defining
 polynomial x^2 - 3
 }}}

 For rationals coordinates, it is also OK :

 {{{
 sage: v2 = vector(K, (1/2, 3/2) ); v2
 (1/2, 3/2)
 sage: v2.parent()
 Vector space of dimension 2 over Number Field in sqrt3 with defining
 polynomial x^2 - 3
 sage: vector(v2).parent()
 Vector space of dimension 2 over Number Field in sqrt3 with defining
 polynomial x^2 - 3
 }}}

 But, for integers, it changes the ring for ZZ :

 {{{
 sage: v3 = vector(K, (0, 1) )
 sage: v3.parent()
 Vector space of dimension 2 over Number Field in sqrt3 with defining
 polynomial x^2 - 3
 sage: vector(v3).parent()
 Ambient free module of rank 2 over the principal ideal domain Integer Ring
 }}}

 which I doesn't like because I want to be able to add them (the addition
 of those vector appears to be unsupported yet by the coercion
 system...this could be another ticket...) :

 {{{
 sage: v + v3
 (1/2, 1/2*sqrt3 + 1)
 sage: vector(v) + vector(v3)
 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', (1052, 0))

 Traceback (most recent call last):
 ...
 /home/slabbe/sage-4.1/local/lib/python2.6/site-
 packages/sage/modules/free_module.pyc in __cmp__(self, other)
    3806             if not c: return c
    3807             try:
 -> 3808                 if self.base_ring().is_subring(other.base_ring()):
    3809                     return -1
    3810                 elif
 other.base_ring().is_subring(self.base_ring()):

 /home/slabbe/sage-4.1/local/lib/python2.6/site-packages/sage/rings/ring.so
 in sage.rings.ring.Ring.is_subring (sage/rings/ring.c:4724)()

 AttributeError: 'NotImplementedType' object has no attribute 'natural_map'
 }}}

 I will also ask on sage-devel if there is a reason why the vector function
 changes the ring of a vector for ZZ when possible.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6643>
Sage <http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to