[Numpy-discussion] Complex arange

Robert Kern robert.kern@gmail....
Thu Feb 1 19:47:33 CST 2007

Russel Howe wrote:
>> arange(1j, 5j, 1) do? Numeric raises an exception here, and I thing  
>> numpy
>> should, too.
> The same as arange(1, 5, 1j) - an empty array since it takes 0 of the  
> step to cross the distance. 

I'm not sure that's really the answer. I think it's simply not defined. No
number of steps (which is different than 0 steps) along the imaginary axis will
take 1+0j to 5+0j.

> But something like
> arange(1j, 5j, 1j) seems fine.  As does arange(1j, 3+5j, 2+1j) which  
> should give [ 1j, 2+2j ].  The idea is to walk by step up to the edge  
> of the box.  I seem to recall a discussion of why this was a bad idea  
> a while ago on this list, but I can't find it...

Box? *Aaah*! You're looking at z1 placing distinct upper(lower) bounds on the
real and imaginary parts rather than specifying a point target. That's
a...unique perspective.  ;-)

But then, I'm of the opinion that arange() should be reserved for integers, and
the other use cases are better served by linspace() instead.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list