#8426: polynomial * constant does not work if constant is a numpy type
-----------------------+----------------------------------------------------
   Reporter:  jason    |       Owner:  AlexGhitza
       Type:  defect   |      Status:  new       
   Priority:  major    |   Milestone:  sage-4.3.4
  Component:  algebra  |    Keywords:            
     Author:           |    Upstream:  N/A       
   Reviewer:           |      Merged:            
Work_issues:           |  
-----------------------+----------------------------------------------------
 This should work:

 {{{
 import numpy
 R.<x>=RR[]
 x*numpy.float32('23.0')
 }}}

 Instead, I get:
 {{{
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/jason/tmp/<ipython console> in <module>()

 /home/jason/sage/local/lib/python2.6/site-
 packages/sage/structure/element.so in
 sage.structure.element.RingElement.__mul__
 (sage/structure/element.c:11337)()

 /home/jason/sage/local/lib/python2.6/site-
 packages/sage/structure/coerce.so in
 sage.structure.coerce.CoercionModel_cache_maps.bin_op
 (sage/structure/coerce.c:6994)()

 TypeError: unsupported operand parent(s) for '*': 'Univariate Polynomial
 Ring in x over Real Field with 53 bits of precision' and '<type
 'numpy.float32'>'
 }}}

 Note that this does work:

 {{{
 sage: numpy.float32('23.0')*x
 23.0000000000000*x
 }}}

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

Reply via email to