# gsl_quaternion proposition

Robert G. Brown rgb@phy.duke.edu
Thu May 11 17:30:00 GMT 2006

On Thu, 11 May 2006, picca@synchrotron-soleil.fr wrote:

> On Thu, 11 May 2006 11:13:34 -0400 (EDT)
> "Robert G. Brown" <rgb@phy.duke.edu> wrote:
>
>> But this is getting a bit OT, sorry.  This does answer Linas's question,
>> at least to some extent.  Although one certainly can do any actual
>> computations associated with quaternions by means of the various already
>> supported operations in the Grassman product (and by making up one's own
>> quaternion struct as needed) or via complex matrices or with 4x
>> matrices, all within the GSL, the process might be easier and more
>> portable if they were consistently supported within the library as named
>> entities.
>
> so creating a gsl_quaternion might be the begining of lie algebras in
> the GSL ? after this we can add octonion etc...

Actually, if this is the plan I'd STRONGLY recommend getting Geometric
Algebra for Physicists (by Doran and Lasenby:

http://www.amazon.com/gp/product/0521480221/103-6500592-0253419?v=glance&n=283155

) and NOT doing octonion etc -- the problem is that
real->complex->quaternion->octonion is not the mathematically correct
progression or development of the graded division algebra, it is merely
historical and useful (up through quaternions, anyway).

Honestly, even before you try to fully implement quaternions it is
worthwhile to look into this, as it would save redoing/undoing work
later.  For example, there exists a geometric algebra with three
components in between complex (two) and quaternionic (four) although
Hamilton was unable to discover it.  It just >>doesn't have the same
interpretation<< as e.g. \vec{x} \cross \vec{y} (where \vec{x} is a 2d
vector) is NOT A VECTOR perpendicular to the xy plane, it is a kind of
number.  It is an ALGEBRA with a certain geometric interpretation, not a
system of vector transformations.

>>  Second, it is possible that 3-vector rotations are more
>> efficient when done by multiplying quaternions, although I'd want to see
>> it proven by actual code; other S3/SO(3R)/SU(2) operations can fairly
>> naturally be done in quaternionic form (and sometimes encapsulate
>> physics algebraically expressed in that form.
>
> I think that composition of rotation are more accurate with quaternions
> than with matrix product. I do not catch the S3/SO(3R)/SU(2) (you know
> material science ;).

Sorry, a listing of various unitary or orthogonal groups (lie groups).
You know most of these already by other names.  SU(2) is spinors (or,
really, quaternions) SO(3,R) (or O(3)) is the rotation group in three
dimensions, basically.  SU(2) double-covers SO(3,R) as people used to
demonstrate, sort of, with the belt trick that shows that rotations of
>>4<<\pi are symmetries of certain transformations, not 2\pi.  S3
(really should be S^3 to differentiate it from S_3, sorry) is the three
dimensional spherical surface of a unit four sphere, and can also be
made equivalent to quaternions of length 1 (S^1 is the circle group --
recall that every complex number can be represented by a modulus (the
radius of the circle) and a single angular coordinate that drives you
around the circle, so S^1 is identifiable with (unimodular) complex
numbers, S^0 with real numbers, etc -- basically to cover all
quaternions one has to scale S^3.  I get confused myself unless I
happen to be teaching one or another of these at which point I refresh
my memory.

There is a nice little Wiki article on "Lie Group" that explains a lot
of this.  And hey, I spared you mention of the exceptional groups,
metaplectic groups, and lots more -- mostly because I don't know much
would include systematically adding support for arithmetical
representation of group objects and operations for these continuous
groups.

Doing generalized Lie Groups or algebras in the GSL would be a LOT
harder than doing Geometric Algebra, by the way.  GA is fairly
systematically grade-extensible, while there are many, many lie groups
with e.g.  double-cover relations, subgroup relations and embeddings,
and still unsolved problems (like what IS the "right" cover for U(1) x
SU(2) x SU(3) in the standard model:-) buried therein.  One would pretty
much have to cover every group, or at least every generic KIND of
dimension-extensible group -- by hand, one at a time.  You also have to
deal with representation theory, as group representations aren't unique
even for a single group.  The 3D quantum isotropic harmonic oscillator,
for example, lives in SU(3) but the generators aren't the same as those
used in QFT IIRC, for example.  To do arithmetic you'd likely have to
stick to matrix representations, but do you use a 4x4 matrix of reals or
a 2x2 matrix of complex's (a sum of pauli spin matrices plus the
identity matrix, which more or less ARE unit quaternions).

I actually think that this is a really interesting question to discuss
on-list, but it might help if we got some sense of how many GSL users
there are, at least on list, that are actually doing computations using
any of these ideas (where they've programmed their own spinor
representation, for example).  Anybody?  I personally do rotations a
fair bit and would love to do them more efficiently and/or accurately
and with minimal trig (!) as transcendental calls are muy caro
(expensive).

> If I understand we could add something more generic by defining a lie
> object which different generator for complex numbers, quaternions and
> octonion. Just by providing the multiplication table of the object ?

No, it is more complex.  If you go through the GA approach, you can
indeed add a more generic object.  In principle you could write a
constructor/destructor for a data object that represented a variable in
a geometric algebra of arbitrary grade, I think, and write composition
methods for those objects that did the right thing as a function of the
grade of the objects they acted on, although my copy of Doran and
Lasenby is in at the department and I'm home at the moment and I cannot
check to be certain.  This would include the grades missing from real
complex, quaternion, octonion, done, and would NOT necessarily be
understandable in terms of vectors -- in geometric algebra the cross
product of two vectors makes an area (dimensioned number) not
necessarily another vector (which is why it can work for 2d vectors).
It requires the generalization of what one means by the word "product"
beyond Gibbs.

I have no idea, as noted above, how to do "Lie Groups" (or algebras) in
anything like a completely general way.  There are a lot of them, and
they are very different -- so different that I think one would have to
do many of them by genera one at a time with as much effort as it would
take to do GA the first time, and with (I think) more ambiguities to be
resolved in the process, possibly to the frustration of at least some
users.

>
>> Maybe it
>> could be a joint maxima/GSL effort?
>
> Yes it seems to be a long term program :), do you have some knowledge
> of maxima ?

Only that it is derived from Macsyma, which I used pretty extensively --
20+ years ago.  To do enormously long and mindless computations of some
of these very things (algebraically) for my advisor, Larry Biedenharn,
who was a physics god of group theory among other things.  I also did
crystal band theory for my dissertation, which of course required me to
learn a lot about point groups.  So I know a bit more group theory than
the average physicist, although anybody working with supersymmetry or
even real QFT could probably laugh me out of any room.

My primary problem is just plain time and utility.  I took the time to
try to write a "tensor" extension of the GSL a couple of years ago and
it was never accepted.  Not unreasonably -- to add proper support for
tensor forms of arbitrary dimension would necessarily make the "matrix"
form a rank two tensor and the "vector" form a rank one tensor.  This in
turn would break a lot of things.  So to even try it one would have to
do a major revision number boost OR write a lot of cruftish and ugly
"glue" routines to convert rank two tensors to matrices, to pull vectors
out of higher rank tensors, where appropriate.  And I USE some of the
tensor/high dimension matrix code that I generated, so that made sense.

Now I have less time, and I don't use quaternions or GA in my actual
computations -- I just find them very, very interesting and suspect that
they are one of the missing keys to the TOE -- that the PARTICULAR Lie
Groups that are isomorphic to a geometric algebra of a high enough grade
are likely to be the ones of interest in TOE physics, which may one day
be enough of a hint for the string people to get the RIGHT theory out of
the very large space of alternatives.  So I can't see any easy way to
help right now.

I don't know if this isn't getting too OT for the list, though.  If
anybody is bored or getting PO'd, please sing out as I have no wish to
offend with these long replies.

rgb

--
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb@phy.duke.edu