https://code.jsoftware.com/wiki/Essays/Tolerant_Comparison
A good read, explains the workings of the comparators. -E On Wed, 23 Feb 2022, Michail L. Liarmakopoulos wrote:
Thanks for the detailed explanation and for the counterexample to my argument. It seems that I haven't thought carefully how the "=" operates behind the scenes when comparing two complex numbers. Best regards, --- Michail L. Liarmakopoulos, MSc On Wed, Feb 23, 2022, 13:03 Elijah Stone <[email protected]> wrote:Two arguments: 1. Comparison is tolerant anyway. So: 3j1e100 = 5j1e100 1 Since _ is greater than 1e100, the (relative) difference between 3j_ and 5j_ should be less than that between 3j1e100 and 5j1e100 2. Infinity is, of course, not a number. So, when encountering an expression involving infinity, it is necessary to ask how it should be interpreted. One way to interpret 3j_ is as follows: the limit as y approaches _ of 3 j. y. Well, that does not converge. But its _angle_ does, as does the angle of 5 j. y, and they converge to the same result: 0.5p1. The j interpreter is kind enough to tell us as much: 0.5p1 =!.0 {:"1*.3j_ 5j_ 1 1 3j_ -:!.0&*. 5j_ 1 (The fact that these expressions evaluate to 1 even with a comparison tolerance of 0--and would continue to do so, even given infinite precision--is my argument for why 3j_=5j_ should be 1 even with a comparison tolerance of 0. I recognise, however, that there are other tradeoffs involved, and this may not be the right choice; but I think there is no excuse for a 0 result given nonzero comparison tolerance, unless _=_ is changed.) -E On Wed, 23 Feb 2022, Michail L. Liarmakopoulos wrote: > It seems correct to me, as they're two different complex numbers. If they > were the same: > > 5j_=5j_ > 1 > > > They have the same modulus though: > > %: 9 + _ > > _ > > %: 25 + _ > > _ > > (|3j_) = (|5j_) > > 1 > > Best, > > --- > Michail L. Liarmakopoulos, MSc > > On Wed, Feb 23, 2022, 10:15 Elijah Stone <[email protected]> wrote: > >> 3j_ = 5j_ >> 0 >> >> I think it should be 1. For nonzero comparison tolerance, at any rate. >> >> -E >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
