[Numpy-discussion] Question about numpy.max(<complex matrix>)

Robert Kern robert.kern@gmail....
Fri Sep 21 15:57:33 CDT 2007


Stuart Brorson wrote:
> Thank you for your answer!
> 
>>> As a NumPy newbie, I am still learning things about NumPy which I didn't
>>> expect.  Today I learned that for a matrix of complex numbers,
>>> numpy.max() returns the element with the largest *real* part, not the
>>> element with the largest *magnitude*.
>> There isn't a single, well-defined (partial) ordering of complex numbers. Both
>> the lexicographical ordering (numpy) and the magnitude (Matlab) are useful
> 
> [... snip ...]
> 
> Yeah, I know this.  In fact, one can think of zillions of way to
> induce an ordering on the complex numbers, like Hamming distance,
> ordering via size of imaginary component, etc.  And each might have
> some advantages in a particular problem domain.
> 
> Therefore, perhaps I need to refocus, or perhaps sharpen my question:
> Is it NumPy's goal to be as compatible with Matlab as possible? 

No.

> Or
> when questions of mathematical ambiguity arise (like how to order a
> sequence of complex numbers), does NumPy chose its own way?

Yes.

-- 
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