Live data from Hacker News

Quaternions

liorsinai.github.io

41–50 of 118 posts

Re: Quaternions

#41

Ask HN: Do quaternions have any interesting properties, akin to those of complex numbers, when calculus is applied? The only application I've ever seen is for doing rotations in computer graphics.

If I understand correctly, yes, calculus on quaternions is a useful thing. I'm not sure whether or not you have an equivalent of the residue theorem from the calculus of complex variables, but I'm pretty sure that you can do path integrals and stuff...

Re: Quaternions

#42

tldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form w + xi + yj + zk Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: pqp' where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(…

> Quaternions are hypercomplex numbers of the form I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. > Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most wel…

>> Quaternions are hypercomplex numbers of the form

>

>I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this.

Think it is right.

>>

>> Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j.

>

>Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most well-known and basic imaginary number, if I'm reading this right.

They are not the same thing. All of these are equal to -1 when squared, but they are different when multiplied by any other of this set and multiplication between them is anti-commutative.

>As for the second part, I can't even begin to unravel the significance. I know it must not be, but it just seems like arbitrary rules added for... some unknown reason.

>

These are not added for unknown reasons. They specify rotations of unitary vectors of a canonical base around one another.

>> Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing:

>>

>> pqp'

>>

>> where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(theta/2)u .

>>

>Oooooh kay... 1) Where'd w go?

The coordinate 'w' is the real part. For the vector 'u', such coordinate is 0. For 'p' and 'p'', it is cos(theta/2).

>Is this one of those things where there's a (situationally-defined) constant in the formula but we just pretend it doesn't exist most of the time (until it comes time to actually use the math to, like, do anything real)?

No.

>Would we need to bring it back in to apply the rest of this?

No. Just follow the rules to multiply hypercomplex numbers and the rotation will occur.

>2) "u =" is just defining something, fine, but (x, y, z) doesn't seem to equal the thing after it at all—I suppose this is a shorthand function notation, though it seems really weird to me to use equality to relate that. Am I right, or is this something else?,

The notation '(x, y, z)' is just a shorter notation for "xi + yj + zk". For this problem, the vector 'u' defines the axis of rotation.

>3) A quaternion is... a point, then? Since we're rotating around it?

You can see a quaternion as a point in R^4 since it has 4 coordinates. Actually it describes an axis of rotation, by its imaginary part, and the angle of rotation.

>4) I've got a feeling that theta needs a direction in this hypercomplex space but don't see where it's coming from. Somewhere "off screen", in this explanation? Or is it there but I'm not seeing it?

>

The axis of rotation is actually the vector "u".

Re: Quaternions

#43

tldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form w + xi + yj + zk Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: pqp' where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(…

> Quaternions are hypercomplex numbers of the form I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. > Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most wel…

It seems to me that i, j, and k are three things that have the same property, not three identical things.

Re: Quaternions

#44

In my opinion, Geometric Algebra and bivectors ( https://bivector.net ) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.

Came here to say this! I always felt like quaternions weren't a perfect fit for 3d rotation, and when I finally learned about bivectors my faith in the elegance of mathematics was restored :D I liked this article: https://marctenbosch.com/quaternions/

> Why does i2=j2=k2=−1 and ij=k? Why do we take a vector and upgrade it to an "imaginary" vector in order to transform it, like q(xi+yj+zk)q∗? Who cares as long as it rotates vectors the right way, right?

Yikes! This is the sort of thing that scares people away from complex numbers from a young age.

Re: Quaternions

#45

tldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form w + xi + yj + zk Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: pqp' where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(…

> Quaternions are hypercomplex numbers of the form I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. > Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most wel…

No, i, j, and k are not the same thing. They are the three distinct square roots of -1. You thus wind up with a space with one real axis and three orthogonal imaginary axes.

Why should -1 have three distinct imaginary roots? Well, why should it have one? Essentially, we just made up i, and we found out that the complex numbers had some really useful algebraic properties. The same is true of the quaternions.

But why not two imaginary roots, or four, or 17? Those turn out not to have nice algebraic properties. The only other thing out there are the octonions, with 7 imaginary roots.

Re: Quaternions

#46
This is fine; there are lots of similar "intro to quaternions" pages around. One thing I haven't seen yet is someone showing how to interpolate between multiple quaternions over time, smoothly. (Hint: it's not slerp.) It's a non-trivial problem.

Re: Quaternions

#47

Earlier quoted context omitted.

> Quaternions are hypercomplex numbers of the form I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. > Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most wel…

>> Quaternions are hypercomplex numbers of the form > >I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. Think it is right. >> >> Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. > >Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1…

Thank you, this was very helpful.

> The axis of rotation is actually the vector "u".

Ah, I thought the vector was what we were rotating.

Re: Quaternions

#48

Earlier quoted context omitted.

Came here to say this! I always felt like quaternions weren't a perfect fit for 3d rotation, and when I finally learned about bivectors my faith in the elegance of mathematics was restored :D I liked this article: https://marctenbosch.com/quaternions/

> Why does i2=j2=k2=−1 and ij=k? Why do we take a vector and upgrade it to an "imaginary" vector in order to transform it, like q(xi+yj+zk)q∗? Who cares as long as it rotates vectors the right way, right? Yikes! This is the sort of thing that scares people away from complex numbers from a young age.

[deleted]

Re: Quaternions

#49
I first encountered quaternions in the concept of abstract algebra. It's interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something:

Complex numbers (2-dimensional): No more ordering

Quaternions (4-dimensional): No more commutative multiplication

Octonions (8-dimensional): No more associative multiplication

Sedenions (16-dimensional): We lose the alternative property, i.e., with octonions its still true that x(xy) = (xx)y but with sedenions it is not.

We can continue this process indefinitely, although I know nothing of the characteristics of trigintaduonions or what comes later. I suspect that it might be the loss of the flexible identity next, a(ba) = (ab)a but I don't know for sure.

Re: Quaternions

#50
You should check out the bivector community dedicated to geometric algebra https://bivector.net/.

Check out a demo https://observablehq.com/@enkimute/animated-orbits

Join the discord https://discord.gg/vGY6pPk.

Enki (the guy behind bivector) also gave a talk on GA at SIGGRAPH 2019 https://www.youtube.com/watch?v=tX4H_ctggYo

Post reply on HN