So, I just got into this subject that mathematicians refer to as "quaternions". And, since this is the lounge sub-forum, I thought I should ask a few questions about it..
When I have two quaternions, Q1 and Q2, respectively assigned the following values for their real components (in a+bi+cj+dk, a, b, c and d are the real components): {2, 3, 4, 5} and {3, 4, 5, 6}.
When I then type this into my calculator and do some simple matrix calculations:
Q1*Q2 = {68}
Q2*Q1 = { {6, 9, 12, 15}, {8, 12, 16, 20}, {10, 15, 20, 25}, {12, 18, 24, 30} }
(Note: I defined Q1 as a 1x4 Matrix and Q2 as a 4x1 Matrix.)
I understand the second output, since this is just 3 * {2, 3, 4, 5}, 4 * {2, 3, 4, 5}, etc. But, what does the first calculation evaluate to, what does this number represent?
More questions might pop-up on the way, as this is a rather new subject to me.
Thanks in advance for even reading this topic up to this point.
EDIT:
Changed the Q1*Q2 equation, was not paying attention when writing it down.
Mmmm... What you do there is matrix multiplication, not quaternion multiplication. You are almost right about Q2*Q1 (it's 3*{2,3,4,5}, 4*{2,3,4,5}, ...). As for Q1*Q2, the result is calculated like this:
2*3 + 3*4 + 4*5 + 5*6 = 68 (I use bold for the Q1 elements).
Although I have a maths degree, quaternions wasn't a mandatory course, thus I'm not familiar with the subject (but I'm quite sure that this is not how you multiply quaternions). All I know is that they are used in 3D graphics for rotation. Maybe hamsterman (or someone else) can explain this better.
Whoops, was not paying attention when writing down the equations, too lazy to change them now, too. So, yeah, that would make sense. This does have a lot to do with quaternion, since they are expressed in 4 "dimensions" (1 real and 3 imaginary). A quaternion is a "more complex" number than regular imaginary numbers:
i2 = j2 = k2 = ijk = -1
We can now get the value of i, j, and k, expressed in the other variables like this:
-1 = ijk
Times i
-i = i2jk
-i = (-1)jk
i = jk
Doing the same for the others, we get:
i = jk
j = ik
k = ij
-i = kj
-j = ki
-k = ji
And there's a bunch of other things going on which I can't explain better than a simple google search.
EDIT:
Just another thing, the latter equation has something to do with quaternions, as it returns a set of multiplications of 1, i, j and k, but.. what does the other value represent in this context?
EDIT:
Found out the striped through question; the values are irrelevant, that's all there is to say about it.
Umm, one natural way to write down quaternions is with 4x4 matrices, ( I doubt you'll get something good with 1x4 matrices).
Wikipedia tells you how to write quaternions with 2x2 *complex* matrices. You can turn any n by n complex matrix to a real 2n by 2n matrix by substituting
a+ib
with the matrix
1 2
(a -b)
(b a)
So, the 4 complex matrices (2 by 2 each) given in Wikipedia can be written as 4x4 real matrices:
1->
1 2 3 4
(1 0 0 0)
(0 1 0 0)
(0 0 1 0)
(0 0 0 1)
i->
1 2 3 4
(0 -1 0 0)
(1 0 0 0)
(0 0 0 1)
(0 0 -1 0)
j->
1 2 3 4
(0 0 1 0)
(0 0 0 1)
(-1 0 0 0)
(0 -1 0 0)
k->
1 2 3 4
(0 0 0 -1)
(0 0 1 0)
(0 -1 0 0)
(1 0 0 0)
You can now verify that the defining equalities you wrote for the quaternions hold for these 4x4 matrices.
Taking linear combinations of them gets you all quaternions.
A nice exercise: write a parser for quaternion expressions. Then simplify the quaternion expressions. Finally, print out the matrix form of the result.
Of coures, such an exercise would take you looooots of time.
I find thinking of it as "directionally determined " multiplication through the standard i - j - k orientation is helpful. When you go the opposite direction you get the negative. In the above you have:
j = ik and -j = ki
That looks reversed to me and should be j = ki and -j = ik.