[Numpy-discussion] Sine Distribution on a 2D Array

Ian Mallett geometrian@gmail....
Sat Jul 24 23:38:36 CDT 2010


So I have a square 2D array, and I want to fill the array with sine values.
The values need to be generated by their coordinates within the array.

The center of the array should be treated as the angle 90 degrees.  Each of
the four edges should be 0 degrees.  The corners, therefore, ought to be
-sqrt(2)*90 degrees.  The angle is equal to
(distance_from_center/(dimension_of_array/2))*90 degrees.  Then take the
sine of this angle.

To describe another way, if the array is treated like a height-field, a
single mound of the sine wave should just fit inside the array.

Right now, I'm having trouble because I don't know how to operate on an
array's values based on the index of the values themselves.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100724/99f4e677/attachment.html 

More information about the NumPy-Discussion mailing list