### Algebra Tool Set

greenspun.com : LUSENET : quaternions : One Thread

Just getting involved with Quaternions.

Having trouble with a few formulae in the tool set. In particular ln and exp are not cooperating. In standard complex arithmetic the product of two numbers (a*b) (Grassman Product?) can also be determined by exp(ln(a)+ln(b)). The problem is that this formula does not work for quaternions as multiplication is not communitive, but this formula is.

What are the significance of ln and exp if they are not related to multiplication? Is there some place that shows the derivations for the formulae shown in thr Algebra Tool Set?

Thanks, Don

-- Don Guinn (donguinn@pvtnetworks.net), April 24, 2002

### Answers

Hello Don:

You are rediscovering a fundamental issue with quaternions. I'll try and explain my own unique slant on the issue.

Let's start with the real numbers.

The real numbers are a group under the operations of addition and subtraction. They also form a group under multiplication and division if the additive identity (zero) is omitted. Real numbers commute under these operations. Exponentiating a number dictates how many times to multiply the number together, numbers that can commute under addition and multiplication. This is why e^a e^b = e^(a+b).

Precisely the same story happens for complex numbers. It is the basis for Fourier analysis, one of the greatest power tools of mathematics.

The quaternions are a group under the operations of addition and subtraction. They also form a group under multiplication and division if the additive identity (zero) is omitted. Quaternions commute under addition. Quaternions communter under the multiplication operator only if two quaternions are "pointed in the same direction" (same 3-vector within a numerical multiple), but generally they do not.

Every author I have read focuses on the part that doesn't work, which is not the way to find a solution! Let's see how it works for the special case of pionting the same way. I recently wrote a series of ~40 programs I call "command line quaternions." If you like the Unix command line as I do, it is a way of playing directly with quaternions (I hope to release the code in a week or so under the GPL). Since you are asking a bright question, I'll presume you are a bright guy and can decode the following output

key: q_x_scalar: multiplies a quaternion by a scalar q_x: multiplies 2 quaternions q_x_odd: the odd part of multiplying 2 quaternions (cross product) q_exp: e^quaternion

> q_x_scalar 1 2 3 4 6 6.000000 12.000000 18.000000 24.000000 > q_x_scalar 1 2 3 4 6 | q_x_odd 1 2 3 4 0.000000 0.000000 0.000000 0.000000 > q_x 1 2 3 4 6 12 18 24 -168.000000 24.000000 36.000000 48.000000 > q_x 6 12 18 24 1 2 3 4 -168.000000 24.000000 36.000000 48.000000 > q_exp 1 2 3 4 1.693923 -0.789560 -1.184339 -1.579119 > q_exp 6 12 18 24 252.332689 116.904326 175.356489 233.808652 > q_x `q_exp 1 2 3 4` `q_exp 6 12 18 24` 1096.628339 -1.204813 -1.806938 -2.409607 > q_x `q_exp 6 12 18 24` `q_exp 1 2 3 4` 1096.628339 -1.204930 -1.807172 -2.409373 > q_exp `q_add 1 2 3 4 6 12 18 24` 1096.628360 -1.204809 -1.807214 -2.409618

The last three lines say symbolically: e^a e^b = e^b e^a = e^(a+b) when a and b are quaternions that commute, or equivalently, that the cross product is zero.

What happens at the opposite extreme? What is the opposite extreme? The opposite extreme is when the product of two quaternions is _only_ the cross product with a zero scalar. In that case, multiplying two quaternions in reverse order flips the signs:

> q_x 0 1 2 3 0 1 7 -5 0.000000 -31.000000 8.000000 5.000000 > q_x 0 1 7 -5 0 1 2 3 0.000000 31.000000 -8.000000 -5.000000

Now get the ln's of these so we can multiply them together and get the same result:

> q_ln 0 1 2 3 1.319529 0.419813 0.839626 1.259439 > q_ln 0 1 7 -5 2.158744 0.181380 1.269660 -0.90690 > q_x `q_exp 1.319529 0.419813 0.839626 1.259439` `q_exp 2.158744 0.181380 1.269660 -0.906900` -0.000002 -31.000017 7.999991 4.999984 Q> q_x `q_exp 2.158744 0.181380 1.269660 -0.906900` `q_exp 1.319529 0.419813 0.839626 1.259439` -0.000002 31.000007 -8.000011 -5.000014

OK, I've got some rounding error issues in my software, but hopefully you see the point. I haven't found (or perhaps forgot) a simple rule for coming up with this product.

In between these two extremes is a linear combination of these two. The weights depend on how "parallel" the two quaternions are. Note that if the scalar >>>> |3-vector|, then it will look like it commutes because the quaternion is almost a real number, with a 3-vector part whose direction effectively doesn't matter due to its size (but it is important that it is not zero). This is where classical physics lives in my opinion.

A different collection of words to describe this goes like so: when two quaternions are exchanged under multiplication, the two parts either keep their sign or flip signs. That sounds related to bosons and fermions to me.

Anyway, good luck with your algebra games, doug

ps. This discussion page is maintained by Phillip Greenspun's software which was being updated in the background, perhaps explaining its odd behavior at the time.

-- Douglas Sweetser (Sweetser@theworld.com), April 26, 2002.

Moderation questions? read the FAQ