RFC: complexes and quaternions...



well, I have just solved one problem with another one.

I have a compiler, which supports both complexes and quaternions. and, I had
figured, since there is seemingly a lot of overlap, I could add quaternions
as an actual part of the numeric tower (if albeit a novelty one, since my
primary use of quaternions is likely to be for working with vectors...).

so, as implemented, I cast a complex to a quaternion by converting it like
this:
a+bi => a+bi+0j+0k

and, for converting the other way, I simply discard j and k.

my testing (at least thus far) shows results equivalent to those gained by
the use of complexes.

and, of course, one can convert to/from reals in a similar manner.
thus far, everything looks consistent.


but, then I was thinking: this is arbitrary...

for example, I could also write:
a+bi => a+0i+bj+0k

which would also work, and so long as I stuck to this, it would behave just
like a complex, likewise for bk.


seems that what I have done is something analogous to saying that 2D space
is directly oriented as the XY plane in 3D space, when infact a 2D plane can
be orientated any which-way in 3D space.

this would imply that any such conversion would infact require an
orientation (we 'transform' from some 2D planar space into a 4D hyperspace
and vice-versa...).

so, we transform the complexes into 4D hyperspace, do calculations
orientated any which-way, and convert back into some-defined 2D complex
space, with the results likely depending heavily on whatever which-way
things happen to be orientated...

(of course, this definition is hardly useful for the implementation of ones'
numeric tower).


so, it seems, my simplistic, if arbitrary, option may well work...
or maybe I am just being stupid?

or something...

any comments?...



.