# HG changeset patch
# User Francois Bissey <francois.bissey@canterbury.ac.nz>
# Date 1326836640 46800
# Node ID 8d780ec50b3fa0207163493be3e0f9847629c80d
# Parent 92c93226b64f933e0af00bbcbd1a8a79c444f43f
trac 11334: update to numpy1.6.1 documentation.
diff git a/doc/en/numerical_sage/numpy.rst b/doc/en/numerical_sage/numpy.rst
a

b


21  21  
22  22  NumPy arrays can store any type of python object. However, for speed, 
23  23  numeric types are automatically converted to native hardware types 
24   (i.e., ``int``, ``float``, etc.) when possible. If the value or 
 24  (i.e., ``int``, ``float``, etc.) when possible. This behavior was broken 
 25  in numpy1.6 and over, the conversion from sage object depends on the 
 26  context but most of the time the conversion will have to be done manually 
 27  to get a native hardware type. If the value or 
25  28  precision of a number cannot be handled by a native hardware type, 
26  29  then an array of Sage objects will be created. You can do 
27  30  calculations on these arrays, but they may be slower than using native 
… 
… 

86  89  sage: l[3:6] 
87  90  array([ 3., 4., 5.]) 
88  91  
89   You can do basic arithmetic operations 
 92  You can do basic arithmetic operations, note how the multiplication by a sage scalar 
 93  is not automatically converted, 
90  94  
91  95  .. link 
92  96  
… 
… 

95  99  sage: l+l 
96  100  array([ 0., 2., 4., 6., 8., 10., 12., 14., 16., 18.]) 
97  101  sage: 2.5*l 
 102  array([0.000000000000000, 2.50000000000000, 5.00000000000000, 
 103  7.50000000000000, 10.0000000000000, 12.5000000000000, 
 104  15.0000000000000, 17.5000000000000, 20.0000000000000, 
 105  22.5000000000000], dtype=object) 
 106  sage: numpy.array(2.5*l,dtype=float) 
98  107  array([ 0. , 2.5, 5. , 7.5, 10. , 12.5, 15. , 17.5, 20. , 22.5]) 
99  108  
100  109  Note that ``l*l`` will multiply the elements of ``l`` componentwise. To get 
… 
… 

283  292  sage: def f(x,y): 
284  293  ... return x**2+y**2 
285  294  sage: from numpy import meshgrid 
286   sage: x=numpy.r_[0.0:1.0:5*j] 
287   sage: y=numpy.r_[0.0:1.0:5*j] 
 295  sage: x=numpy.array[numpy.r_[0.0:1.0:5*j],dtype=float] 
 296  sage: y=numpy.array[numpy.r_[0.0:1.0:5*j],dtype=float] 
288  297  sage: xx,yy= meshgrid(x,y) 
289  298  sage: xx 
290  299  array([[ 0. , 0.25, 0.5 , 0.75, 1. ], 