[Camllist] Complex Arithmetic

David McClain
 Bruce Hoult
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:  20010328 (07:48) 
From:  Bruce Hoult <bruce@h...> 
Subject:  Re: [Camllist] Complex Arithmetic 
At 12:21 AM 0700 3/28/01, David McClain wrote: >Borda's Mouthpiece requires taking the square root of the square of values >along the negative imaginary axis. When you square (0  1i) you get (1). >...but actually you get (1 + 0). Most languages simply accept the square >as (1) = (1 + 0+). > >Taking the subsequent square root when you have made this incorrect >assumption gives the value sqrt(1) > (0+1i). And so the stream line mapped >from the negative imaginary axis ends up cutting across all the other stream >lines when this condition is encountered. An obvious error! > >The correct answer is obtained by noting that (0  1i)^2 > (1 + 0) and >sqrt(1 + 0) > (0 1i) again. Only by properly considering the nature of >floating point zero (i.e., which of the two you really have) can you perform >this computation correctly. I guess I'm just dense, but I don't see how you generalize this. I mean, OK, if you want to also say that (1, 0)^2 > (1, 0) so that you can then do sqrt(1, 0) > (1, 0) instead of (1, 0) then I guess I could live with this. But how do you deal with all the other complementary pairs? I mean, how do you distinguish the results of, say (4 + 5i)^2 and (4  5i)^2  both of which are (9 + 40i)  so that when you do sqrt(9 + 40i) you get the number you started with rather than always the principle one? I'm afraid I just don't see it.  Bruce  To unsubscribe, mail camllistrequest@inria.fr. Archives: http://caml.inria.fr