“Visualizing Quaternions” by Andrew J. Hanson July 10th, 2009
Patrick Stein

Sunday night, I finished reading Visualizing Quaternions by Andrew J. Hanson. Unfortunately, the events of the week have kept me from writing this summary sooner. I feel like it would have been longer had I written it Monday. Alas, let’s play the cards in front of me.

This is a wonderful book. In addition to having gobs and gobs of useful content, it is a fine specimen of book design. The layout and illustrations are tremendous.

It tends to go from well-written, conversational passages that explain things in great detail to terse passages that mean nothing if you’re not a tensor-analysis whiz. But, even if you skim the parts that assume you know things you don’t, there’s still lots of book here to read.

There is even a nice appendix about Clifford algebras which folds in nicely with the complex number, quaternions, Clifford algebra posts that I’ve made here recently. If you do three-dimensional simulations or you like a good mathematical read, you should give this book a look.

Clifford Algebras for Rotating, Scaling, and Translating Space July 6th, 2009
Patrick Stein

In (very much) earlier articles, I described:

Today, it is time to tackle rotating, translating, and scaling three-dimensional space using Clifford algebras.

Three dimensions now instead of two

Back when we used Clifford algebras to rotate, translate, and scale the plane, we were using the two-dimesional Clifford algebra. With the two-dimensional Clifford algebra, we represented two-dimensional coordinates (x,y) as xe_1 + ye_2. It shouldn’t surprise you then to find we’re going to represent three-dimensional coordinates (x,y,z) as xe_1 + ye_2 + ze_3.

As before, we will have e_1e_1 = 1 and e_2e_2 = 1. Similarly, we will have e_3e_3 = 1. In the two-dimesional case, we showed that e_1e_2 = -e_2e_1. By the same logic as the two-dimensional case, we also find that e_1e_3 = -e_3e_1 and e_2e_3 = - e_3e_2. We could potentially also end up multiplying e_1, e_2, and e_3 all together. This isn’t going to be equal to any combination of the other things we’ve seen so we’ll just leave it written e_1e_2e_3.

Read the rest of this entry ⇒

Quaternions for Rotating, Scaling, and Translating Space June 11th, 2009
Patrick Stein

In earlier posts, I described how complex numbers can be used to rotate, scale, and translate the plane, how Clifford algebras can be used to rotate, scale, and translate the plane, and why I resorted to an awkward trick for the Clifford algebra rotations of the plane. In this post, I am going to explain what the quaternions are and describe how they can be used to represent a rotation in three-dimensional space.

What are the quaternions

Okay, remember how we got the complex numbers? We needed something that was the square root of negative one.

Now, imagine that you are Sir William Rowan Hamilton. The year is 1843. It is springtime. You know how to use the complex numbers to represent points in the plane. And, you know that when you do that, you can use complex numbers to rotate, scale, and translate the points. That’s all well and good, but you don’t live in a two-dimensional world. How are you going to do the same sort of thing with three-dimensional space? How are you going to multiply triples?

You spend months on this. If only you could say, How about I let there be another number that is different from i (and from -i) that has the same property that its square is negative one? You fight with this for months. You try to represent a point with coordinates (x,y,z) as x + yi + zj. But, nothing you come up with makes any sense.

Your kids are harassing you, Daddy, did you figure out how to multiply triples yet? You have to answer them every morning with a polite, No, not yet.

Then, you’re walking along the Royal Canal in Dublin. It’s mid-October already. My, how the year has flown by. Bam, it hits you. If you add a third number like i and j which is equal to i\cdot j, everything works out. You get so excited, that you carve your equations into a stone bridge over the canal:

i^2 = j^2 = k^2 = ijk = -1

Read the rest of this entry ⇒

What Was Up With That Rotation Trick? June 10th, 2009
Patrick Stein

In my prior post about using Clifford algebras to do plane rotations, I finished with a non-intuitive step at the end. Rather than multiplying on the right by an element representing a rotation of angle \theta, I multiplied on the left by an element representing a rotation of angle \frac{\theta}{2} and multiplied on the right by an element representing a rotation of angle -\frac{\theta}{2}.

Why did I do this? Well, I mentioned it would be awkward for the two-dimensional case, but that it will be important when we get to three or more dimensions. Well, work for a moment with \frac{\theta}{2} being a quarter rotation (ninety degrees, \frac{\pi}{2} radians). This means our total rotation is going to be a half turn (180 degrees, \pi radians).

For that \frac{\theta}{2}, r = e_1e_2 and so \overline{r} = -e_1e_2. Let’s just look at what it does to our unit vectors e_1 and e_2 to multiply on the left by r and on the right by \overline{r}.

For e_1, we get -e_1e_2e_1e_1e_2 = -e_1e_2e_2 = -e_1. Similarly, for e_2, we get -e_1e_2e_2e_1e_2 = -e_2.

So far, we were only working in two dimensions. As such, there wasn’t any e_3 to worry about. But, what if there were? What happens to the z-coordinate of something if you rotate things parallel to the xy-plane? It remains unchanged.

Well, what would happen if we multiplied e_3 on the right by \cos\theta + \sin\theta e_1e_2? We would end up with \cos\theta e_3 + \sin\theta e_3e_1e_2 = \cos\theta e_3 + \sin\theta e_1e_2e_3. We’ve ended up scaling e_3 and adding in a trivector e_1e_2e_3. We’ve made a mess.

Let’s try it instead with our trick. We’re going to start with -e_1e_2e_3e_1e_2. Every time we transpose elements with different subscripts, we flip the sign. Every time we get two elements next to each other with the same subscript, they cancel out. So, switching the e_3 with the second e_1, we get e_1e_2e_1e_3e_2. From there, we can switch the first two elements to get -e_2e_1e_1e_3e_2 which is just -e_2e_3e_2. We can switch the e_3 with the second e_2 to get: e_2e_2e_3 which is just e_3. So, our trick leaves e_3 unchanged.

In the above, there is nothing special about the subscript three. It would work for any subscript except one or two. So, the trick allows us to break the rotation up into two parts that still do what we want with e_1 and e_2 but leave our other directions unchanged (or, maybe it’s easier to think of them as changing them and then changing them right back).

Clifford Algebras for Rotating, Scaling, and Translating the Plane June 8th, 2009
Patrick Stein

In my previous post, I reviewed how the complex numbers can be used to represent coordinates in the plane and how, once you’ve done that, complex arithmetic leads naturally to rotations, scalings, and translations of the plane. Today, we’re going to do the same with the Clifford algebra \mathcal{C}\ell_2.

What are Clifford Algebras

In our previous post, we used two different ways to represent coordinates in the plane. We used an ordered pair of real numbers like (3,5) and we used the real and imaginary parts of a complex number like 3 + 5i. Another way we could have written the coordinates in the plane is as a vector. Typically, to express a vector, we pick an axis (say, the x-axis) and then pick a second axis perpendicular to it (say, the y-axis). Most physics books would call these \hat{i} and \hat{j}. I am going to use e_1 and e_2 instead so that there is no confusion with i = \sqrt{-1} and because it is a notation that we will continue throughout Clifford algebras. We could then express (3,5) as 3e_1 + 5e_2. Here, e_1 and e_2 are called unit vectors. We assume they have length one so that when we take three of them, we get something with length three (for arbitrary values of three).

Having done that, we can easily multiply any vector by a real number using the normal distributive law: s \cdot \left(xe_1 + ye_2\right) = (sx)e_1 + (sy)e_2. And, we can add vectors just like we added complex numbers: summing like parts. So, (ae_1 + be_2) + (ce_1 + de_2) = (a+c)e_1 + (b+d)e_2. Of course, subtraction goes the same way: (ae_1 + be_2) - (ce_1 + de_2) = (a-c)e_1 + (b-d)e_2.

Read the rest of this entry ⇒

Updates In Email

Email:

l