gsl_quaternion proposition
Thu May 11 12:29:00 GMT 2006

On Wed, 10 May 2006 12:03:20 -0500 (Linas Vepstas) wrote:

> The code looks very professionally designed and well-pt-together.
> However, it does nothing more than to define a type and some basic
> operations on it (add, multiple, conjugate, etc).
> What is the intent of this? Are you thinking of creating some 
> gsl_sf_* routines to accept this type? What's the grand vision?

For me the intend is to use quaternions to compute rotations in the 3D
space. It is more accurate than matrix multiplication. I am writing a c+
+ library to do calculus for diffractometers. This is just about
rotation and diffraction. The purpose is to orientate a sample
(crystal) in the space relatively to a X-rays beam.

My problem is that a diffractometer can be describe by the
multiplication of quaternions. For example, a 6 circles diffractometer
is compose of 4 rotation for the sample:
1) q_mu
2) q_omega
3) q_kappa
4) q_phi

and 2 for the detector.
1) q_gamma
2) q_delta

q_sample = q_mu . q_omega . q_kappa . q_phi
q_detector = q_gamma . q_delta

to diffracte I must have

q_sample . v . q_sample* = q_detector . ki . q_detector - ki = Q

where v is a direction in the crystal and ki the vector of the X-ray, Q
is the scattering vector. I know v and ki and I want q_sample and

As you can see 1 have 6 unknowns with that diffractometer and only 3
equations (the coordinate of Q).
Their is multiple possibilities to orientate the crystal. I put some
constrain on the system to solve it. I need in fact to minimize the
system. That is why I want to use gsl.

for now I wrote a simplex algorithm to do that minimization but I would
like to switch to gsl to have more flexibility and more robust algo.

Now I have different kind of diffractometer so I need to generalize those calculus.
I red about quaternions in gsl mailing list so I decide to contribute (do My part for the GNU project) to gsl.

> Surely the isomorphism of the quaternions to the algebra of rotations 
> for 3D space SO(3)=SU(2)/Z2 is too shallow a justification for 
> introducing a new type?

we can say that because of this isomorphism, quaternions are
interesting for numerical computation ;).

> The other possible way to generalize is to su(n) and other Lie algebrs,
> but I don't see the point.

Maybe but I do not have the competences to do the generalization.
With your help why not ?

Have a nice day

More information about the Gsl-discuss mailing list