Re: [Numpy-discussion] making two 2D real arrays into one complex array

2007-04-10 Thread Robert Kern
mark wrote: > Hello List - > > Any reason why the following doesn't work? > x,y = meshgrid(linspace(-1,1,10),linspace(-1,1,10)) z = complex(x,y) > Traceback (most recent call last): > File "", line 1, in ? > z = complex(x,y) > TypeError: only length-1 arrays can be converted to Py

Re: [Numpy-discussion] making two 2D real arrays into one complex array

2007-04-10 Thread Pierre GM
On Tuesday 10 April 2007 15:57:00 mark wrote: > Hello List - > > Any reason why the following doesn't work? > > >>> x,y = meshgrid(linspace(-1,1,10),linspace(-1,1,10)) > >>> z = complex(x,y) Because complex is a python function that doesn't work well w/ ndarrays. int/float/bool would give the sam

[Numpy-discussion] making two 2D real arrays into one complex array

2007-04-10 Thread mark
Hello List - Any reason why the following doesn't work? >>> x,y = meshgrid(linspace(-1,1,10),linspace(-1,1,10)) >>> z = complex(x,y) Traceback (most recent call last): File "", line 1, in ? z = complex(x,y) TypeError: only length-1 arrays can be converted to Python scalars I know I can ma