News for hackers. Stuff that matters.
Re:Quaternion Knowledge Graph Embeddings by ziofill on Thursday April 25, 2024 @02:28AM (#40154135)
I always wondered why bother with quaternions and abstruse math when at the end of the day they behave like some matrices of floats.
Re:Quaternion Knowledge Graph Embeddings by pinkmuffinere on Thursday April 25, 2024 @03:52AM (#40154679)
As a concrete example, feedback controllers for attitude control (ie, pointing something) are imo easier to develop in quarternions than with 3x3 matrices. For one, the quaternion formulation isn’t over-constrained by the extra parameters.

This is essentially because quaternions are a remarkably good representation of rotations.

Re:Quaternion Knowledge Graph Embeddings by TeMPOraL on Thursday April 25, 2024 @07:18AM (#40156045)
Related, 3D math is done with 4x4 matrices, not 3x3 as the "3D" would make someone think, because you need that extra dimension to represent translations in matrix form, and once you do that, you can compose arbitrary transforms through multiplication.
Re:Quaternion Knowledge Graph Embeddings by hi-v-rocknroll on Thursday April 25, 2024 @02:47AM (#40154266)
For 3D graphics, it makes rotation and translation simpler by adding another dimension. Maybe you had a less-than-stellar teacher for this topic. If so, here's a master lecturer elucidating it:

https://youtu.be/mHVwd8gYLnI

https://en.wikipedia.org/wiki/Transformation_matrix#Examples...

Re:Quaternion Knowledge Graph Embeddings by klyrs on Thursday April 25, 2024 @03:00AM (#40154355)
To be fair, some of us learned about quaternions over finite fields before anything about 3D graphics. The first time I heard about this application of them, I was gobsmacked. Saying this because my professor for that course was quite excellent.
Re:Quaternion Knowledge Graph Embeddings by hi-v-rocknroll on Thursday April 25, 2024 @04:02AM (#40154749)
Nice! For undergrad, I was 2 courses shy of a math major || CS major, but then I saw neither was ABET accredited. Wat? Not to worry, because the CS & Eng major was accredited but required physics and chemistry for engineers series, interfacing, computer architecture, and a load and store (or was it compare and swap?) more electives approximating an EE major. It was really an EE/CS program but they couldn't call it that for historical and intercampus political reasons.

I think most of the difference in mastery of a given topic in an academic setting comes down to the skill and interactivity with a competent and expert lecturer who also has expertise in the additional domains of public speaking and teaching. Ken Joy and Sean Davis were the virtuosos of teaching at UC Davis: massive and accessible brains. Intellectual curiosity and an semi-extroverted personality help too.

Re:Quaternion Knowledge Graph Embeddings by lanstin on Tuesday April 30, 2024 @12:50PM (#40213132)
Or over the reals. I have studied quaternions a number of times but never studied 3d graphics. They are interesting algebraically as part of the sequence of divison algebras reals, complex numbers, quaternions, octonions, nothing. https://en.m.wikipedia.org/wiki/Hurwitz%27s_theorem_(composi...
Re:Quaternion Knowledge Graph Embeddings by globalnode on Thursday April 25, 2024 @07:53AM (#40156335)
hurts me how he keeps saying over and over that they were invented by someone named Heisenberg.
Re:Quaternion Knowledge Graph Embeddings by webnrrd2k on Thursday April 25, 2024 @02:44PM (#40161430)
For those who haven't encountered quaternions or their history, see https://en.m.wikipedia.org/wiki/History_of_quaternions.
Re:Quaternion Knowledge Graph Embeddings by hi-v-rocknroll on Thursday April 25, 2024 @07:06PM (#40164155)
I'm thinking either word substitution or maybe an in joke about Breaking Bad because Ken Joy was hilariously funny. You know he meant Hamilton.
Re:Quaternion Knowledge Graph Embeddings by godelski on Thursday April 25, 2024 @03:03AM (#40154373)
The problem is most people were taught math wrong and this typically only gets corrected when you get to high level mathematics like abstract algebra.

Imaginary numbers aren't "imaginary" they are how to do consistent math in a 2D framework. Quaternions? Well that's about 4D. Poincaré once said that math isn't about numbers, but relationships between numbers. For some reason we don't talk about mathematical structure (explicitly) until the late stages. I wouldn't necessarily call these concepts "abstruse" but they are a bit more abstract. A big part of the problem though, we often ignore the ground we are building upon and so when you finally look at it, it is new and confusing. But then again, the success of Bourbaki's New Math is arguable[0]

[0] https://en.wikipedia.org/wiki/New_Math#In_other_countries

Re:Quaternion Knowledge Graph Embeddings by auraai on Thursday April 25, 2024 @03:21AM (#40154484)
> Poincaré once said that math isn't about numbers, but relationships between numbers

He described math more poetically and profoundly: "the art of giving the same name to different things"

Re:Quaternion Knowledge Graph Embeddings by aap_ on Thursday April 25, 2024 @04:33AM (#40154955)
> Quaternions? Well that's about 4D

Quaternions are about 3D. You need 4 numbers for it, but the space that they operate on is 3D.

Re:Quaternion Knowledge Graph Embeddings by raincole on Thursday April 25, 2024 @05:11AM (#40155191)
He's talking from a mathematical perspective, not a compute graphics one.

(Unit) quaternions happens to work as rotations in 3D space. But quaternions' algebraic structure is indeed 4D, just like imaginary numbers' is 2D.

Re:Quaternion Knowledge Graph Embeddings by ducttapecrown on Thursday April 25, 2024 @01:42PM (#40160689)
Since you can multiply a quaternion by a quaternion, the quaternions act on themselves, so they indeed act on a 4D space. They can also act on a couple 3D spaces: the unit sphere in 4D, called the three sphere, or the imaginary quaternions.

In math, this is called a representation of a Lie group, and there are representations in all dimensions.

Re:Quaternion Knowledge Graph Embeddings by truckerbill on Thursday April 25, 2024 @03:20AM (#40154476)
'Why bother with programming languages when at the end of the day they are just pages of text'
Re:Quaternion Knowledge Graph Embeddings by TeMPOraL on Thursday April 25, 2024 @07:20AM (#40156060)
Or even why bother with computer science and engineering, when at the end of the day, it's all just about counting very fast.
Re:Quaternion Knowledge Graph Embeddings by authorfly on Thursday April 25, 2024 @05:30AM (#40155308)
Because they enable you to involve things typically unrelated (i.e. two types of embeddings), think and understand and manipulate them in a simpler mathematical model (a single vector) and see how you can then apply the most fundamental mathematical operations (e.g. cosine similarity) in terms of simpler outputs/metrics. It enables a form of creativity in other words; it makes you see things like the math in Transformers in a less anxious light as you understand how these things can overlay into a simpler intuitive understanding.
Re:Quaternion Knowledge Graph Embeddings by redwood on Thursday April 25, 2024 @06:12AM (#40155560)
Sounds similar to the power of LoRa; critical building blocks to building efficient scalable serving
Re:Quaternion Knowledge Graph Embeddings by barfbagginus on Thursday April 25, 2024 @07:07AM (#40155967)
I recently took the plunge and learned unit quaternions and dual quaternions for representing rotations, compound rotation-translations, and kinematic chains and geometric interpolation (serial and parallel robot arms, character skeletons, skinning).

The advantages I found are:

Unit quaternions represent rotations with less redundancy than matrices

It's easier and more intuitive to derive, manipulate, simplify, interpolate, and solve quaternions than matrices.

They're less abstract/more concrete than matrices.

Rotating with quaternions takes fewer multiplications than matrices.

Dual quaternion inverse kinematics are easier to derive and faster than matrices

Unit and Dual quaternions have an efficient implicit form, which further speeds up IK. See: https://www.researchgate.net/profile/Neil-Dantam/publication...

Re:Quaternion Knowledge Graph Embeddings by captaincaveman on Thursday April 25, 2024 @11:39AM (#40158851)
Re:Quaternion Knowledge Graph Embeddings by barfbagginus on Friday April 26, 2024 @10:36AM (#40169871)
Quaternions makes it hard to imagine why gimbal lock would even have to be a problem.

Normally it happens because we have to solve a rotation into potentially redundant roll, pitch and yaw factors.

In Q, you can just write the axis of rotation as a unit vector quaternion v = v1 i + v2 j + v3 k. That pure vector quaternion represents a 180 degree rotation around v. Other rotations around v are interpolations between v and the identity rotation scalar 1:

w = a1 + bv, where a^2 + b^2 = 1.

This is a circular analogue of linear interpolation. Indeed, if t in [0, 1] is our rotation angle, we observe:

a = cos(pi t) b = sin(pi t)

And we can reduce

w = a + sqrt(1-a^2)*v

Where a \in [-1, 1].

This representation is so nice. There is no need to solve roll, pitch, and yaw. Just pick unit rotation axis v, then twist the scalar knob a to set the rotation amount.

This is quite human!

Re:Quaternion Knowledge Graph Embeddings by somenameforme on Thursday April 25, 2024 @08:21AM (#40156609)
One of the big motivations for quaternions is performance. Not only are they much more compact than a rotation matrix (4 float vs 9), but many important operations, such as composing rotations, are also much quicker. The only real downside of them is that they seem to drive everybody to this obsession to try to truly understand them. After years of using them, I've learned to embrace my ignorance. The underlying math is not terribly complex (hur hur), but relationships between interdependent periodic rotations all packed in a tidy imaginary number package, is simply not something you're going to really get a good intuitive feel for - numerically speaking.
Re:Quaternion Knowledge Graph Embeddings by ubj on Thursday April 25, 2024 @08:33AM (#40156720)
> The only real downside of them is that they seem to drive everybody to this obsession to try to truly understand them.

This. If you only want to understand *how to apply* quaternions to represent rotations, it's not too hard to learn. However, if you want to understand *why* they work, that's a totally different story.

Many of my colleagues still use Euler angles to represent rotations. I always use quaternions, and am a bit baffled why people are so averse to them.

Re:Quaternion Knowledge Graph Embeddings by noone_important on Thursday April 25, 2024 @09:25AM (#40157267)
If you have some knowledge of group theory the 'why' is pretty straight forward.

Quaternions are the generators of SU(2) which is a double covering of SO(3). The latter describes rotations in 3 dimensions. Thus you can express any rotation in 3d with quaternions.

Re:Quaternion Knowledge Graph Embeddings by GuB-42 on Thursday April 25, 2024 @08:00PM (#40164494)
If you are still interested, try this: https://marctenbosch.com/quaternions/

The idea is that quaternions are the wrong way to look at the problem and that a better approach would be to use geometric algebra, bivectors and rotors. The formulas are essentially the same as with quaternions, but at least for me, this approach make more intuitive sense. It also work in dimensions other than 3, which matter to the author as he is the author of "4D toys" and hopefully, Miegakure.

Here is another talk on the subject, by a different author: https://www.youtube.com/watch?v=htYh-Tq7ZBI It is not specifically about quaternions, it is about multiplying vectors and what you get from that, and it includes quaternions.

Re:Quaternion Knowledge Graph Embeddings by meindnoch on Thursday April 25, 2024 @08:40AM (#40156774)
Rotation matrices (i.e. orthonormal matrices) are a complicated manifold in 9 dimensional space.

Rotation quaternions (i.e. unit quaternions) are simply the unit sphere in 4 dimensional space.

Re:Quaternion Knowledge Graph Embeddings by pizza on Thursday April 25, 2024 @10:19AM (#40157927)
Simplicity depends on the observer