This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

[Caml-list] Complex Arithmetic
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2001-03-28 (08:17) From: David McClain Subject: Re: [Caml-list] Complex Arithmetic
```> 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 think the easiest way to begin is to convert to polar form in your head.
Then you can see where the results belong. Take (4+5i) for example. This is
a ray in Quadrant I of the complex plane. Squaring it puts it into Quadrant
II, and the subsequent square root moves it back to Quadrant I.

On the other hand, (-4-5i) is a ray in Quadrant  III. Depending on how you
view it, in terms of Riemann sheets you can either see this as r *
Exp[theta] with theta > pi, or else r * Exp[theta] with -pi < theta < 0. By
convention we use the principal sheet with angles between -pi <= theta <=
pi. So in this interpretation, squaring this number would put you on the
next sheet down (in the negative theta direction, which lies beneath
Quadrant II. Taking the square root moves you right back into Quadrant III
on the principal sheet.

Translating this into rectangular form... this particular example is
problematic, because we have gone beyond the principal Riemann sheet. And so
rectangular representation cannot give the correct answer and Kahan's
principal is clearly illustrated -- i.e., that the language of pairs is
insufficient for complex arithmetic.

Borda's Mouthpiece represents a boundary case in which arithmetic stays
entirely in the prinicipal Riemann sheet. and so all arithmetic should
behave itself in rectangular form as long as proper attention is paid to the
nature of zero. Your example pushes beyond even this. And so only the polar
form can be used to get the correct answer.

- DM

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr

```