# Boost :

From: Hubert Holin (Hubert.Holin_at_[hidden])
Date: 2004-11-26 08:03:17

Somewhere in the E.U., le 26/11/2004

In article <98604e9d041123112135c8caae_at_[hidden]>,
Matt Austern <austern_at_[hidden]> wrote:

> On Tue, 23 Nov 2004 10:55:19 +0100, Hubert Holin <hubert.holin_at_[hidden]>
> wrote:
>
> > > Just out of curiosity: Can you give me an example of an algorithm where
> > > this would be of advantage?
> > >
> > > Roland
> >
> > It is interesting if, for instance, you have to track an object
> > along an orbit for a very long time. Using the canonical ("cartesian")
> > representation usually entails transcendental functions (say sine and
> > cosine), for which it is very hard to guaranty the accuracy (of a given,
> > one-size-fits-all, implementation) for big values of the argument. If
> > you integrate numerically, you all the more want to stay in the polar
> > domain (unless we cross the singularity, but we are not modeling
> > missiles, are we ;-) ? ).
>
> I'm sure you'd want to use polar coordinates for that, yes. There are
> of problems for which you want to use polar coordinates of some sort
> or another.
>
> But is it likely that you would want to use a package that provides
> complex numbers in polar form? My experience is that if you're

Basically, as I answered the OP, the answer is no ;-) .

> working with complex numbers that you want to think of in the form
> r exp(i phi), then you'll probably just do the work of separating out
> the magnitude and phase ahead of time in your equations, and then
> compute with them separately. After all: if you're doing something

Yes.

> where the magnitude-phase form is most convenient, it usually
> means that putting numbers in that form makes the equations
> simpler.

Yes (but it usually also means to watch out for the singularity).

>
> --Matt

Still, from the discussion on comp.std.cpp a few years back, I
recall that there was a feeling that having multiple representations
(say cartesian and polar) at the same time would have been nice. Of
course, it would have been a bloated beast (at least in a naive
implementation), and a slow one at that (to keep track of the various
changes, in a naive implementation still). Furthermore it clashed with
the desire to have some layout guaranty which played nice with C (that
line of reasoning seems to have flown out in limbo, however).

This illustration is merely there as a reminder that the wish for
concurrent multiple points of views of a given abstract entity is not a
futile one, if one that I fear can't be translated from mathematics to
CS. We've had another illustration of that recently with the affine
space/vector space discussion in a GUI thread a few days back here
(which also happens to be relevant to this discussion as well, at least
in two dimensions).

Merci

Hubert Holin