From octave-maintainers-request at bevo dot che dot wisc dot edu Tue Sep 5 22:54:40 2000 Subject: Re: [PATCH] Add min/max tests. (4/4) From: "John W. Eaton" To: Edward Jason Riedy Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Tue, 5 Sep 2000 22:54:43 -0500 (CDT) On 4-Sep-2000, Edward Jason Riedy wrote: | And "John W. Eaton" writes: | - I think that | [...] | - is much less surprising than | [...] | - since -2 is smaller than 1 [...] | | Not in magnitude. I suppose that's the key. | | I just realized the behavior I want to avoid still occurs. Imagine | a nice long calculation intended for complex matrices and magnitude | comparisons written with min / max. Now imagine that a column just | happens to become all real... I wouldn't want to try to debug that | problem. | | Unfortunately, it still happens when a matrix becomes all real ``by | accident,'' so there does need to be a way to specify magnitude | comparisons to min / max. How about min (abs (x), abs (y)) ? If I recall correctly, it doesn't really make sense to ask whether one complex number is `less than' another. That Matlab overloads the relational operators to mean X op Y == abs(X) op abs(Y) is, I believe, just a convention. Someone (presumably Cleve Moler) thought it would be a convenient shorthand. I suppose it is in some cases, but it also introduces some ambiguity and surprising results (something of a running theme in the design of Matlab, if you ask me). If it were up to me (or if I could do it over again) I'd say that min, max, <, <=, >, >= have no meaning for complex numbers in Octave, and that if you want to compare magnitudes, you have to state that explicitly. jwe