On 12/6/2011 9:54 AM, K.-Michael Aye wrote:
> I have a function f(x,y).
>
> I would like to calculate it at x = arange(20,101,20) and y = arange(2,30,2)
>
> How do I store that in a multi-dimensional array and preserve the grid
> points where I did the calculation


In [5]: X, Y = np.meshgrid(range(3), range(4))

In [6]: X
Out[6]:
array([[0, 1, 2],
        [0, 1, 2],
        [0, 1, 2],
        [0, 1, 2]])

In [7]: Y
Out[7]:
array([[0, 0, 0],
        [1, 1, 1],
        [2, 2, 2],
        [3, 3, 3]])


now do your f(X, Y)

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to