## Friday, April 19, 2013

### Q is for Quaternions.

Science week in Philadelphia this week! They have stuff for kids and adults! Go! I'll be hanging out at some events.

Going from phi, a simple concept most people with no interest with math understand, to quaternions, which actually has three complex numbers in it.

#### Quaternion Basics

A quaternion is a four-element vector that can be used to encode any rotation in a 3D coordinate system.  Technically, a quaternion is composed of one real element and three complex elements, and it can be used for much more than rotations.
There you, a basic introduction to quaternions. You see, they're a vector. . . which have elements . . . this one has four . . .  complex elements. . . mumble. . .what the hell does that paragraph say?
From the beginning complex numbers are scary. For a complex number, you need an imaginary number, the memory of which might haunt your nightmares if you ever took high school math. Remember the square root of negative one, except you can't get the square root of a negative number? This is a hour long conversation in itself, but for the purpose of discussion forget about high school math. All I want you to remember is x + yi = [x,y] which I hope you remember from third grade is points on a Cartesian plane. Yes, imaginary numbers can be used to plot points in imaginary space, which you might recognize as a place that unicorns and dragons live. I love the history of imaginary numbers because it's full of sarcastic mathematicians saying sarcastic things like "Well, since you can't square a negative number, then you can call it whatever you want! It doesn't really exist!" or "If you can just add complex numbers together to plot imaginary space, why don't you just do it to infinity?"
xi is called a complex number, because it's dark and mysterious and it will never let you in, even though you just want to love it! Also, i by itself is meaningless. You can't add it to itself, i + i, because it's the square root of negative one, so it's pretty useless. You have to multiply it by itself for it to actually do anything. I know this doesn't make sense, I might have to write a "history of i" soon. It's one of my favorite stories. So x+yi allows us to plot objects in 2 dimensional space. A quaternion allows us to plot points in 3D. A mathematician got the idea to add a number to three complex numbers in order to graph 3D space, which led to a friend asking him what's to stop someone from adding them forever. And now octonions exist, which are 7 or so complex numbers. *sigh* We can't even picture a dimension like that!
A quaternion looks like a + bi + cj + dk, where i, j, and k are all imaginary numbers. You can structure it like a vector, which I'll talk about on V-day, and you'll get points in 3D space. So you can build Dreamatorium Community style, and use quaternions to figure out where everything is.