05-19-2021 01:31 PM
Obviously, this is not really a bug since it has been like that since the beginning of time. Still, it seems to be a glaring omission in functionality.
In range and coerce does not accept complex numbers and I wonder why that is and why this cannot be cured. Obviously I am missing something here.
Expected functionality: Let's take a simple complex number that we want to see if it is contained within a rectangular area of the complex plane. We apparently need to first extract RE and IM, test them individually, then merge them back together to complex. Tedious! Comparing both RE and IM seems to be the logical behavior and could simplify certain things (example). It would need to be implemented and documented in the help.
(OTOH, we could also compare them to DBL, in which case we check if r is within range. (probably not that useful and we would need to decide how to deal with e.g. negative limits since r is always positive).)
So, is there a fundamental reason why the function currently does not accept all complex inputs? If this cannot get extended internally, maybe a VIM would be a good solution.
05-20-2021 02:50 AM - edited 05-20-2021 02:52 AM
I think comparing complex numbers is ambiguous?
Can we compare two complex numbers? - Quora
Comparing Re and Im and combining the results is just one way to compare.
Of course, if the In Range And Coerce would compare like that, it would be more useful than simply breaking.
05-20-2021 10:02 AM
Thanks. Yes, I agree that sorting complex numbers is not possible, but "in range" does not really rely on 1D sorting. The limits just define a rectangular area and even a three year old can tell if a given point is inside or outside.. Maybe I just make my own vim.
Of course we can also cast the complex input/limits to a suitable cluster or array and things would work just fine:
05-21-2021 02:39 AM
The links mention that comparing 1 complex number is ambiguous. LabVIEW agrees:
The In Range is 2 compares. Does that double (or square) the ambiguity, or eliminates it 🤔?
The way we use complex numbers a lot (as coordinates), it sure would be convenient if the In Range would treat complex numbers like that.
As a programmer I agree that it makes sense to limit it the way you propose, but mathematicians might not.