My Math Forum How to teach yourself...
 User Name Remember Me? Password

 New Users Post up here and introduce yourself!

 July 24th, 2011, 07:03 AM #2 Global Moderator     Joined: Nov 2006 From: UTC -5 Posts: 16,046 Thanks: 938 Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms Re: How to teach yourself... Are you familiar with complex numbers? Where they introduce a new symbol i with defining identity i^2 = -1, quaternions introduce two more in addition to i: j and k. The defining identities are j^2 = -1, k^2 = -1, and ijk = -1. It's very important to know that they are not commutative: you cannot replace j * k with k * j. Alternately, and perhaps more productively in your case, you can think of them as lists of four numbers (just like complex numbers can be thought of as a list of two numbers, the real part and the imaginary part*). The defining identities are long but very simple to program. I'll link to Wikipedia here rather than retype them, but you don't need to pay attention to anything but the equations if you don't want to. http://en.wikipedia.org/wiki/Quaternion ... _list_form * Or even simpler: integers can be thought of as a natural number 0, 1, 2, ... and a sign in {1, -1}. You can add a pair (n1, s1) + (n2, s2) as IF s1 = s2 (n1 + n2, s1) ELSE IF n1 > n2 (n1 - n2, s1) ELSE (n2 - n1, s2) I found some short references on quaternions online http://www.cs.iastate.edu/~cs577/handou ... ernion.pdf http://www.geometrictools.com/Documenta ... rnions.pdf The first one may help. The second may be useful after reading the first -- it looks more complicated to me than Wikipedia, though.
July 24th, 2011, 01:25 PM   #3
Member

Joined: Mar 2010

Posts: 31
Thanks: 0

Re: How to teach yourself...

Quote:
 Originally Posted by CRGreathouse * Or even simpler: integers can be thought of as a natural number 0, 1, 2, ... and a sign in {1, -1}. You can add a pair (n1, s1) + (n2, s2) as IF s1 = s2 (n1 + n2, s1) ELSE IF n1 > n2 (n1 - n2, s1) ELSE (n2 - n1, s2)
what are n1 s1 n2 s2?

As for the identities ij = k, jk = i etc, how do you use them? I read through the wikipedia page you referenced and I am really still at the same point of understand I was previously I cannot conceptualize what is going on. Maybe if I give you an example of what I am trying to do then I can put some values with the formulas.

I am working on a model editor and I need to be able to rotate the viewpoint around the model freely. Before I even got to quaternions I was thinking along the lines of 1 rotation around a plane and a 2nd rotation of the plane around the world. I visualized a point on a sphere (I find it much easier to develop my understanding this way, I think the biggest problem with quaternions would be that I cannot imagine would a 4D sphere would even look like combined with imaginary numbers).

Anyway, say my starting point is (1,0,0), the angle around the plane is 0. I rotate 45 degrees counter clockwise to (0.7071,0.7071.0), then I want to rotate up 45 degrees I figured that my x,y values over 90 degrees will range from 0 to 1 on the plane, but if I rotate the plane they will range from 0 to whatever the sin,cos is of that angle. So rotating the plane by 45 degrees would mean my x,y would be 0.7071^2. I got stuck then with the fact that I am rotating the plane around 1 axis and couldn't figure out how to adjust the values with different plane rotations. ( I also now know that the 3D vector would actually be .577,.577,.577, close but anyway.

So, I got onto rotation about a vector, a normal vector could define my planes rotation I can visualize that and could rotate around it, but I can't figure out how to do that either, so heres what I got, maybe you can help me get to grips with this...

I have two vectors to define the camera, xFrom,yFrom,zFrom, and xUp,yUp,zUp. xFrom = 0, yFrom = 500, zFrom = 0, xUp = 0, yUp = 0, zUp = 1. I am looking along the y axis to 0,0,0 and I am standing straight up. Dragging the mouse left to right will rotate me around my up vector, I have to take the cross product of my 2 vectors to create a 3rd side vector and I will rotate around that by dragging the mouse up and down, then somehow readjust my vectors. How do I create a quaternion out of that and what do I do with it? Whats imaginary? What formula do I use?

Too many questions I really don't understand this at all. How do you rotate with vectors alone? I get that with a unit circle in 2D that my vector components are the just the sin and cosine value of an angle, I don't know what that angle is in 3D, and if I have to continuously work with angles why am I bothering with vectors?

That's why I asked if anyone knows of a good place to learn all of the stuff I need to know as the stuff gets harder and harder to grasp. I know that i^2 = -1 but I don't understand what you use that for.

July 24th, 2011, 03:47 PM   #4
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: How to teach yourself...

Quote:
Originally Posted by MattJ81
Quote:
 Originally Posted by CRGreathouse * Or even simpler: integers can be thought of as a natural number 0, 1, 2, ... and a sign in {1, -1}. You can add a pair (n1, s1) + (n2, s2) as IF s1 = s2 (n1 + n2, s1) ELSE IF n1 > n2 (n1 - n2, s1) ELSE (n2 - n1, s2)
what are n1 s1 n2 s2?
The magnitudes and signs, respectively. You can represent 7 as (7, 1) and -7 and (7, -1) and then add them with the rules I gave. Multiplying is even easier -- can you find that formula?

That's sort of a warm-up for working with imaginary numbers, which are themselves a warm-up for working with quaternions.

Quote:
 Originally Posted by MattJ81 As for the identities ij = k, jk = i etc, how do you use them?
One possibility: you replace ij with k (etc.) wherever it appears.

Quote:
 Originally Posted by MattJ81 I think the biggest problem with quaternions would be that I cannot imagine would a 4D sphere would even look like combined with imaginary numbers).
No no. If you're thinking of it as a 4-dimensional sphere, the coordinates are real numbers, not complex. If you're thinking of it as a two-dimensional number, the coordinates are complex (the Cayley-Dickson construction). Pick one that works for you and stick with it. There are alternate representations as well, for example as a 4x4 matrix of real numbers.

Quote:
 Originally Posted by MattJ81 That's why I asked if anyone knows of a good place to learn all of the stuff I need to know as the stuff gets harder and harder to grasp. I know that i^2 = -1 but I don't understand what you use that for.
I did give two links; how did they work for you?

 July 24th, 2011, 08:50 PM #5 Member   Joined: Mar 2010 Posts: 31 Thanks: 0 Re: How to teach yourself... OK I am trying my best to get my head around this, I am slowly understanding some of the formulas, but if someone asked me "what is a quaternion?" I wouldn't have an answer, so I still have no idea how I would take coordinates in my program, use any of these formulas and get rotated coordinates, but I am trying to work on it. Lq(v) = qvq? = (q0^2 ? |q|^2)v + 2(q . v)q + 2q0(q × v) q?q = (q0 ? q)(q0 + q) = q0q0 ? (?q) . q + q0q + (?q)q0 + (?q) × q How do you get the 2nd steps here? and what is Lg(v)? For the 2nd example I just distributed out the brackets and ended up with q0^2 + q^2 This is from the first of the 2 links at the end of your post, it actually makes a little more sense than the wikipedia link so far.
 July 25th, 2011, 06:46 AM #6 Global Moderator     Joined: Nov 2006 From: UTC -5 Posts: 16,046 Thanks: 938 Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms Re: How to teach yourself... L_q(v) is just an operator, a function on q (a unit quaternion) and v (a 3-vector treated as a pure quaternion). It is defined as q, times v, times the conjugate of q. So if you have a point v = (1, 2, 3) representing 1 unit right, 2 units forward, 3 units up from the origin, you're treating it as the quaternion 0 + 1i + 2j + 3k and doing the indicated multiplications. If q is a + bi + cj + dk then the whole thing is (a + bi + cj + dk)(0 + i + 2j + 3k)(a + bi + cj + dk)* which is, by definition of conjugation, (a + bi + cj + dk)(0 + i + 2j + 3k)(a - bi - cj - dk) which you can multiply out through the normal rules. (You can do the product on the left or the product on the right first -- they're not commutative but they are associative.)
 July 28th, 2011, 01:43 AM #7 Senior Member     Joined: Jul 2010 From: St. Augustine, FL., U.S.A.'s oldest city Posts: 12,184 Thanks: 481 Math Focus: Calculus/ODEs Re: How to teach yourself... Well, they say practice makes perfect! Learning math is like playing a musical instrument...you have to practice to get better!
 July 29th, 2011, 10:17 PM #8 Member   Joined: Mar 2010 Posts: 31 Thanks: 0 Re: How to teach yourself... The only problem, well a problem is what do I practice? I can practice solving polynomials all day but that doesn't help me progress. Purplemath.com is a great site that tries to teach the basics of things in order or how you would learn it at school. The stuff I am working on in 3D video games is so complicated that the jump from what I understand to what I have to learn is huge and I come across so many topics that link to other topics that link to more that I get lost. Going from algebra and the concept of complex numbers to quaternions and 4d hyperspace is like I missed a few years of study, how can I fill in the gap? I can pick my topic of study and figure out what I need to know and get some foundation but it would be nice if I could do that along the way so I can build brick by brick and not have to ask stupid questions. Is there a site that teaches college mathematics step by step?

 Tags teach

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post Hunisgung1986 Academic Guidance 24 August 28th, 2015 05:09 AM complicatemodulus Number Theory 3 February 16th, 2014 09:34 AM MATHEMATICIAN New Users 12 August 23rd, 2013 02:23 AM cameron Geometry 1 June 19th, 2009 05:35 AM MATHEMATICIAN Calculus 0 December 31st, 1969 04:00 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top