#9769: symbolic function do not work with numpy.int64 arguments
-------------------------+--------------------------------------------------
   Reporter:  maldun     |          Owner:  burcin    
       Type:  defect     |         Status:  new       
   Priority:  major      |      Milestone:  sage-4.7.1
  Component:  symbolics  |       Keywords:            
Work_issues:             |       Upstream:  N/A       
   Reviewer:             |         Author:            
     Merged:             |   Dependencies:            
-------------------------+--------------------------------------------------
Changes (by burcin):

  * milestone:  => sage-4.7.1


Comment:

 Note that there is no coercion when you call
 {{{
 sage: import numpy
 sage: vec = numpy.array([1,2])
 sage: sin(vec)
 array([ 0.84147098,  0.90929743])
 }}}

 The `__call__()` function for `sin` checks if the argument is a numpy
 array and calls the right numpy function on this input. See line 349 of
 `sage/symbolic/function.pyx`. We can handle other numpy types there.

 We cannot work with matrices as numeric objects in symbolics. I suppose
 you expect the sin() function to be applied to each entry of the matrix.
 The `apply_map()` method should be used for this purpose:

 {{{
 sage: t = Matrix(ZZ, 2,2)
 sage: t.randomize()
 sage: t.apply_map(lambda x: sin(x))
 [      0 -sin(1)]
 [ sin(4)       0]
 }}}

 -----

 {{{
 sage: x = PolynomialRing(RR, 'x').gen()
 sage: sin(x)
 <boom>
 }}}

 The problem here is really coercion, but it should be copied to another
 ticket (in the basic_arithmetic component):

 The `__call__()` function of RR[x] doesn't conform to the generic
 definition. You should be able to give the parameters as a keyword
 argument as well. This should be made to work:

 {{{
 sage: R.<x> = RR[]
 sage: (x^2+1)(x=5)
 11
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9769#comment:2>
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