Incomparable abominations
Bengt Richter
bokr at oz.net
Mon Mar 24 23:52:55 CET 2003
On Sun, 23 Mar 2003 07:13:17 -0500, "John Roth" <johnroth at ameritech.net> wrote:
>
>"David Mertz, Ph.D." <mertz at gnosis.cx> wrote in message
>news:mailman.1048407038.15040.python-list at python.org...
>>
>> Even then, no matter how you cut it, the relation "1j < 2j" is
>> self-evident and natural. How can I explain to anyone why that is an
>> error rather than a True result?!
>
>That is, however, a border case. Is 1+2j < 2+1j true or false?
>Why? Support your answer.
>
I guess you could define an ordering of all the complex points by
sorting on (magnitude, phase) -- or (magnitude**2, phase) -- tuples.
In which case 1j < 2j would be the tuples
>>> (0**2+1**2, math.atan2(1,0)) , (0**2+2**2, math.atan2(2,0))
((1, 1.5707963267948966), (4, 1.5707963267948966))
compared:
>>> (0**2+1**2, math.atan2(1,0)) < (0**2+2**2, math.atan2(2,0))
1
and 1+2j < 2+1j would be the tuples
>>> (1**2+2**2, math.atan2(2,1)) , (2**2+1**2, math.atan2(1,2))
((5, 1.1071487177940904), (5, 0.46364760900080609))
compared:
>>> (1**2+2**2, math.atan2(2,1)) < (2**2+1**2, math.atan2(1,2))
0
At least an ordering would be defined, and IWG a fair proportion of
results would ring intuitively true ;-) (I.e., equality would
mean the identical complex point, and differing magnitudes would sort
by magnitude, and equal magnitude numbers would compare by positions
on their equal-magnitude-radius circles).
Regards,
Bengt Richter
More information about the Python-list
mailing list