News for hackers. Stuff that matters.
Re:Rotations with quaternions by imadr on Tuesday June 01, 2021 @09:27AM (#27354055)
How far into algebra do you need to get to understand "Rotations of 3-dimensional real space form the topological group SO(3)"? I kinda understand that norm-1 quaternions map to rotations in 3D space somehow but I can't prove it myself. What kind of curriculum do I need to follow to really grasp this?
Re:Rotations with quaternions by gspr on Tuesday June 01, 2021 @09:31AM (#27354120)
To understand the definitions and apply them in practice, a first course in group theory + a basic understanding of vector calculus suffices. To add the adjective "topology", the first parts of a general topology course is enough.

To truly appreciate groups like SO(3), a course in differential geometry and differential topology is useful.

Edit: This is all assuming you have no background in mathematics (or, alternatively, physics) at all. If you do, a targeted text can teach you these concepts in a few pages.

Re:Rotations with quaternions by billfruit on Tuesday June 01, 2021 @11:08AM (#27355519)
The thing is group theory is taught in an incredibly abstract manner, its hard to find any motivating application for it, or any problems it helps us solve.

Also terminology/definitions are vague too, whether a vector has an endpoint or it something unachored in space is itself not clear from many treatments.

Re:Rotations with quaternions by gspr on Tuesday June 01, 2021 @11:18AM (#27355737)
> The thing is group theory is taught in an incredibly abstract manner, its hard to find any motivating application for it, or any problems it helps us solve.

Mathematics is abstractly defined. But for basic group theory there's a plentitude of very concrete examples to rely on.

> Also terminology/definitions are vague too,

Absolutely not. There is no vagueness at all! Everything is completely well-defined in most introductory textbooks/courses (or you can even read the precise definitions on Wikipedia, which is often not the case).

> whether a vector has an endpoint or it something unachored in space is itself not clear from many treatments.

Vectors do not have endpoints. Vectors are not anchored. Vectors are elements of vector spaces. Vector spaces are completely clearly defined.

Re:Rotations with quaternions by thaumasiotes on Tuesday June 01, 2021 @11:22PM (#27364453)
> Vectors do not have endpoints. Vectors are not anchored. Vectors are elements of vector spaces. Vector spaces are completely clearly defined.

Ehh.... compare this text from the wikipedia article on affine spaces:

> In an affine space, there is no distinguished point that serves as an origin. Hence, no vector has a fixed origin and no vector can be uniquely associated to a point. In an affine space, there are instead displacement vectors, also called translation vectors or simply translations, between two points of the space.

If you're working with vectors, you're generally working with them as points, not as values that happen to obey the axioms defining a vector space. Those vectors are anchored, and the anchoring is so deeply embedded in the concept that there's a separate concept, affine spaces, specifically devoted to the question of "what if we had things that were like vectors, except without being anchored to a particular point in space?"

Re:Rotations with quaternions by kmill on Tuesday June 01, 2021 @11:49PM (#27364614)
Generalizing this, in the theory of differentiable manifolds, a vector (well, a "tangent vector") can be thought of as being an arrow rooted at a specific point. In Euclidean space (affine spaces), you can always translate all vectors to an origin, so it's safe to ignore a vector's root, but in general there's not a canonical way to translate vectors. The issue is essentially curvature -- for example, if you took a tangent vector at the north pole of a sphere, dragged it down to the equator, dragged it along the equator for a bit, then dragged it back up to the north pole, the vector would have rotated. What this shows is that vectors at different points are not mutually comparable without more structure.

I swept a detail under the rug, which is that the vectors are infinitesimal arrows, so their tip is not actually another point of the manifold. In an affine space, vectors can be regarded as non-infinitesimal arrows -- the arrows that you always find textbook illustrations on vector arithmetic. The arrows with a common root form a vector space.

Re:Rotations with quaternions by gspr on Thursday June 03, 2021 @06:04AM (#27379107)
Right, but the individual vector spaces you speak of there are the tangent spaces of a manifold M. There's a vector space TpM attached to M at a point p. And the point you make is that there isn't necessarily a canonical way to relate vectors in TpM to vectors in TqM for p≠q. In this sense, we may well say that "a vector in TpM is anchored at p, and a vector in TqM is anchored at Q". I agree with that, obviously. However, within a fixed vector space, of which such a TpM is merely one example, there is no notion of vectors being "anchored".
Re:Rotations with quaternions by kmill on Friday June 04, 2021 @09:13PM (#27401012)
Given the definitions in a textbook on smooth manifolds, I agree with you -- the modern notion of a vector space has no notion of root or anchor since these words have no associated definitions.

It's interesting to think about how we came to the modern viewpoint. Some of the underlying context behind my comment is that long ago manifolds were concretely subsets of R^n that could be locally parameterized. The tangent space at a point was the affine subspace of R^n that was tangent to the manifold there, and you could regard a tangent vector as an arrow rooted at that point inside that subspace. Even though we have our clean modern notion of an abstract vector space, somehow these old intuitions linger on in other disciplines

In math we have a precise definition for a vector (an element of a vector space, full stop), but I don't think experts have the authority to be prescriptive about jargon outside their discipline. Of course, a student should be willing to drop preconceptions and to absorb correct usage.

Re:Rotations with quaternions by Tainnor on Wednesday June 02, 2021 @06:18AM (#27366941)
It's true that a vector space has a designated origin. Whether you choose that to interpret as "vectors being anchored" is, I guess, up to you - that's just an issue of language usage, not of mathematics.

I personally don't consider functions or polynomials to be "anchored", but yes, of course there is the zero polynomial etc.

Also, keep in mind that physicists, for example, often use a more restricted definition of "vector" than mathematicians. That Wikipedia definition you quoted doesn't strike me as very mathematical. A mathematician's definition of an affine space is much more abstract.

Re:Rotations with quaternions by gspr on Thursday June 03, 2021 @06:02AM (#27379091)
Maybe I misunderstood what the original poster meant by "anchored", sorry.
Re:Rotations with quaternions by billfruit on Wednesday June 02, 2021 @09:12AM (#27368273)
What I was trying to tell was that even a fundamental concept such as vector isn't clearly defined in undergraduate level treatments. And consider that fields like Physics, EE, Aeronautics and Computer Graphics use such concepts, often use different definitions of the same thing even.
Re:Rotations with quaternions by gspr on Thursday June 03, 2021 @07:30AM (#27379639)
> What I was trying to tell was that even a fundamental concept such as vector isn't clearly defined in undergraduate level treatments.

Of course it is. I'm sure there are instances where it isn't, but it also mostly is.

Re:Rotations with quaternions by jcora on Tuesday June 01, 2021 @04:30PM (#27360872)
Sounds snarky but completely correct. Parent should look for a more diverse set of examples for vector spaces. In fact sounds like a good linear algebra course would be a priority over group theory
Re:Rotations with quaternions by FabHK on Tuesday June 01, 2021 @08:19PM (#27363253)
> taught in an incredibly abstract manner

And that’s a shame, because a lot of group theory originated in concrete, tangible problems. Check out the book Visual Group Theory by Nathan Carter, discussed (a bit) here:

https://news.ycombinator.com/item?id=11745486

https://news.ycombinator.com/item?id=16345844

Re:Rotations with quaternions by swiley on Tuesday June 01, 2021 @12:22PM (#27356997)
That's an odd complaint to hear on a technology centered forum.

The most obvious application for algebra should be thinking about data structures with their operations. If you can't be sure about a method on a class being valid in terms of the contracts for that class (IE being a closed operation) then the method can't be public (usually an idea taught in "intro to OOP" style classes although with other words unless you're reading something like SICP.)

Re:Rotations with quaternions by klodolph on Tuesday June 01, 2021 @03:14PM (#27359818)
Some of the motivating examples are hard to understand, unfortunately. You can't do quantum mechanics without group theory, and if you can't do quantum mechanics, it will be much harder to understand how half the instrumentation in your chemistry lab works.
Re:Rotations with quaternions by immmmmm on Tuesday June 01, 2021 @11:47AM (#27356354)
it's actually more group representation theory you'll need: the rotation group has an infinite number of representations acting on different vectors spaces, rotation of an electron in 3d is SU(2) which maps to SO(3), the rotation of vectors.
Re:Rotations with quaternions by rikroots on Tuesday June 01, 2021 @01:35PM (#27358273)
I failed advanced math (UK A level) and dumped advanced physics before reaching the point of taking the exams. I've managed to implement a quaternion system in my canvas library[1] - with nagging doubts that it's not entirely right - mainly by staring at lots of (poorly explained) examples online and hoping that things would click 'by osmosis'. So, I reckon you can go a long way without understanding the concepts behind quaternions, but you'll need to do a lot of geometry and physics study if you ever want to feel comfortable with any quaternion code you write.

The only reason I went through all that pain was because I kept on coming across articles saying that "quaternions fix the gimbal lock issue you encounter with Euler angles" - now I see people saying in this thread that the assertion is false. I no longer know what to believe, but I do know I never want to go crawling down the Euler/quaternion rabbit hole again!

[1] - https://scrawl-v8.rikweb.org.uk/docs/source/factory/quaterni... - just looking at that code makes me wince!

Re:Rotations with quaternions by meiji163 on Tuesday June 01, 2021 @12:37PM (#27357249)
You can get a very good intuition with 3B1B's video ( https://www.youtube.com/watch?v=zjMuIxRvygQ )
Re:Rotations with quaternions by jacobolus on Tuesday June 01, 2021 @09:56AM (#27354549)
Re:Rotations with quaternions by gspr on Tuesday June 01, 2021 @10:10AM (#27354750)
It's a good text, but the parent poster may wish to be made aware that it's very physics-centric. If they do not come at this from an interest in physics or a physics mindset, it may be counterproductive.
Re:Rotations with quaternions by rsj_hn on Tuesday June 01, 2021 @09:49PM (#27363865)
This area of math -- covering spaces, Lie groups, representations, etc, is often presented abstractly because there are some very powerful and beautiful theorems that, to a mathematician, really clarify what is happening. But to an engineer, it is a hard slog unless you have some firm examples in mind, and you don't really need the powerful results to work everything out concretely. It just saves you a lot of time to do that.

Nevertheless, I think it's still a good and important idea to work things out concretely a few times and for that all you really need is linear algebra.

That said, the concrete version of your statement is as follows:

SO(3) is best defined as the group of all rotations in 3 space. You then show that this is just all 3x3 matrices that are orthogonal (their transpose is the inverse) and have determinant 1.

You can do this by abstract linearity arguments (e.g. the rotation of a vector times a scalar is the scalar times the rotation of the vector) or by directly writing things out with linear algebra.

The first ingredient is to realize that the rotation in the plane by angle t is a linear map of the plane to itself, and can be represented by matrix multiplication and thus a square 2x2 matrix which sends

(1, 0) to (cos(t), sin(t))

and

(0, 1) to (-sin(t), cos(t)).

Thus the matrix is

[cos(t), -sin(t)]

[sin(t), cos(t)]

this matrix clearly has determinant = 1 and you can verify that the transpose is the inverse. But you could have derived this from general principles that rotations are volume and orientation preserving.

Now a rotation in 3 space must fix some line and then is just a planar rotation for the plane perpendicular to the line. So you can pick a new basis in 3 space corresponding to the line, v, and then two orthonormal unit vectors so that the rotation is just the matrix

[1 0 0]

[0 cos(t) -sin(t)]

[0 sin(t), cos(t)]

for some choice of unit vector v and some angle t. Here you should realize that you need an orientation. E.g. the plane perpendicular to v is the same plane as is perpendicular to -v, but you need an orientation on the plane to figure out the direction of rotation.

Already this should tell you that SO(3) is three dimensional and you have a parametrization of (most of) SO(3) as a point on a sphere together with an angle, so it's kinda like S^2xS^1, except the parametrization breaks down when the angle is pi as you get the same rotation if you pick anti-podal directions and when the angle is zero all the points on the sphere map to the same (identity) rotation. So this parametrization is not a diffeomorphism, it's not even 1 to 1, but it is surjective, and knowing exactly how it fails to be 1 to 1 allows you to understand SO(3) completely because you can think of SO(3) as S^2xS^1 with some points identified.

All of the above relies solely the basics of linear algebra such as what you usually get in a multi-variable calculus course. You don't even need stuff like Jordan decomposition or other more advanced linear algebra topics, just the definition of linear maps, the definition of a "rotation" in 3 space, ideas of orthogonality and the determinant being an oriented volume of a linear map. Most of these concepts are taught in multi-variable calculus as you need them to get volume forms as the result of a change of basis when you are doing integrals over surfaces and volumes.

In terms of 'topological group", the set of matrices with determinant 1 that are orthogonal form a group, as is easily verified via the fact that det(A*B) = det(A)det(B) and det(A^t) = det(A). That is all you need to show that this is a group. It is a topological group in the sense that the multiplication operation is continuous in the inherited norm you expect to get on matrices. E.g. if you write out the multiplication of matrices with the entries being variables you just get polynomials in the product of the two matrices so multiplication is a continuous operation.

When you are working at the elementary level, you don't care too much about whether the matrices are topological groups because you are not going to be using the heavy duty Lie theory machinery, you can write everything out in terms of matrices and maps between them explicitly. It's really good to write things out explicitly a few times and then learn all the abstract stuff because it helps you understand what the general results are really saying. Do not be intimated by people using terms like "universal cover", homotopy, classifying spaces, etc, as you don't need any of that to understand the basic properties of quaternions and the orthogonal groups, but these abstractions have shown to be an very useful way of looking at these spaces so they can help explain what is happening in a deeper way than relying on matrix algebra once you get to the point where you are searching for unifying ideas behind these results. The results themselves can always be proved with elementary techniques.