Error Messages/43025
Warning message
You cannot compare two complex numbers using the inequality operators <, >, <= or >=.
Cause
Unlike real numbers, there is no consistent ordering on complex numbers. Any attempt to impose even a partial ordering results in contradictions.
To demonstrate, suppose you adopt a system where 0 < 1j. This would violate a standard axiom that says if a > 0 and b > c then a*b > a*c. Test it by plugging in a = 1j, b = 1j
and c = 0
, and you've just proved that -1 > 0, a contradiction.
If you attempt to use the ordering operators in Analytica with two non-equal complex numbers, and if you have the Show Result Warnings preference turned on, the warning shown here results. If you ignore the warning, the result is NaN.
The =
and <>
operators can be applied to complex numbers.
Remedy
First, you should think about why are you comparing the order of different complex numbers? Is there a logical flaw in your thinking? This warning may have just detected a conceptual error, in which case you should refine your conceptual approach to whatever you are doing.
Here are a couple ways to impose a total ordering, where instead of x <= y
you could do these:
Abs(x) <= Abs(y)
RealPart(x) < RealPart(y)
orRealPart(x) = RealPart(y)
andImPart(x) < ImPart(y)
RealPart(x) < RealPart(y)
Keep in mind that all of these are susceptible to contradictions. The Sort, SortIndex and Rank functions use the second method show here to determine the sort order.
Enable comment auto-refresher