Quaternions and spherical trigonometry
terrytao.wordpress.com
terrytao.wordpress.com
When i first read this i found it very hard to understand, because i was unfamiliar with spherical trigonometry, but there's quite some beauty to be found there.
Omg wow... the theoretical physics I’m talking about is just quaternions and Lie Algebra isn’t it? Oh… dont tell me Quantum Spin just called Spin because it’s a Spinor rather than something actually metaphorically spinning?!
Please chime in if you know what I’m talking about and can confirm this or shoot it down.
You DO NOT understand how happy I am right now. Truely!
I did general physics for a year at uni as part of my Computer Engineering course, then switching to Computer Science where I picked up a year of quantum mechanics. Since then whenever I lay in bed and thought about physics I would end up awake for hours. So damn interesting but the maths always held me back, so sadly gave up.
I don’t know what’s changed (maybe maturity or maybe Vyvanse lol) but I’m slowly putting the pieces together. It’s always been in my outer periphery but still out of reach. Your confirmation has and will change my life. Maybe not career wise or life altering seen from the outside, but hot damn you have at least cleared my constant nagging guilt for not perusing maths and physics because you’ve just made it slightly closer within reach. Can’t wait for the book to arrive. Thank you!!!
I had a bad experience with complex analysis as a teen (took a grad class that was a bit over my head). Many years later, I got Tristan Needham's "Visual Complex Analysis" and the whole thing clicked for me - I'm a visual person and do a lot of geometry. I hope your experience is similar.
Awesome :) Yes, I saw that book this morning on my Amazon travels... though I'll put it in my wishlist because I think this morning blew out my yearly book allocation lol.
sounds good, I've had a look at a few books but would be good to see something like that
That's a great way to understand them if you are already comfortable with the algebra of spinors and spin groups, but it doesn't short-circuit the history—spinors were so called after quantum spin (https://en.wikipedia.org/wiki/Spinor#History), and I believe that was so called because, yes, it was envisioned as something at least conceptually spinning.
I've tried many times to go through Modern Algebra texts, and so I on-the-surface get that it's an algebra of sorts.
When I have enough time I'm going to finally go through mathacademy.com, because I think it really does suck not knowing advanced maths but want to do the hard sciences
In early days it was hypothesised that particles were spinning about their own axes, but this isn't accurate.
All the interesting stuff of Spin from its quantizable nature, the non-commutatability of spin measurements along orthogonal directions, the very different fundamental behavior of particles with half-integer spin (Fermions, eg Electrons, Protons) vs integer spin (Bosons eg Photons), how Spins interact (eg spins of say two electrons with half-integer spin interacting as a Spin-0 Boson in a Cooper Pair of a superconductor), or spin interacting with orbital angular momentum eg electron spin interacting with it's orbit around proton in an atom.
At the end of the day Spin isn't a terrible name for it.
I believe Spinor vectors are merely named after the eigenvectors used to represent spin itself, not the other way around as you suggested.
What basic complex numbers represent is a way of doing rotations where something moves from one direction towards it's orthogonal. That's what Euler's Formula is about also, which shows the relationship of 'e' and 'i' in this of course.
Now what Quaternions represents is the realization that if complex numbers have two components (real, imaginary) then we can treat each of those as a base vector and find a sort of 'next level up' orthogonality to each one individually.
I'm not good enough at math/geometry to know if this kind of 'next level up' bifurcation of dimensionality extends up past Quaternions or not (like something called Octernions, 16ions, 32ions, 64ions, etc), but it seems like is would?
Spoiler alert: rotors are mechanically identical to quaternions, while being easier to understand. If you understand rotors, you understand quaternions. You can fit the laws you need to understand rotors on a business card.
Plus, rotors abstract to higher and lower (well, there's only one plane and its two respective orientations in 2d, but still) dimensions.
Complex numbers as planes (bivectors in GA parlance) has been the most mind-opening mathematical concept I've been exposed to in the last decade. The associated geometric product has helped me better understand concepts (like "handedness") that troubled me during undergrad engineering.
I wonder how/if any of this can be applied to LLMs 'Semantic Space'. As you might know, Vector Databases are used a lot (especially with RAG - Retrieval Augmented Generation) mainly for Cosine Similarity, but there is a 'directionality' in Semantic Space, and so in some sense we can treat this space as if it's real geometry. I know a TON of research is done in this space, especially around what they call 'Mechanistic Interpretability' of LLMs.
The neat thing is that it "extends" automatically. The math is exactly the same. You literally just apply the same fundamental rules with an additional basis vector and it all just works.
MacDonald's book [1] proves this more formally. Another neat thing is there are two ways to prove it. The first is the geometric two-reflections-is-a-rotation trick given in the linked article. The second is straightforward algebraic manipulation of terms via properties of the geometric product. It's in the book and I can try to regurgitate it here if there's interest; I personally found this formulation easier to follow.
If you really want your mind blown, look into the GA formulation of Maxwell's laws and the associated extension to the spacetime (4d) algebra, which actually makes them simpler. That's derived in MacDonald's book on "Geometric Calculus" [2]. There's all kinds of other cool ideas in that book like a GA formulation of the fundamental law of calculus from which you can derive a lot of the "lesser" theorems like Green's law.
Take all of this with a grain of salt. I'm merely an enthusiast and fan, not an expert. And GA unfortunately has (from what I can tell) some standardization and nomenclature issues (e.g. disagreement over the true "dot product" among various similar but technically distinct formulations)
> I wonder how/if any of this can be applied to LLMs 'Semantic Space'.
Yeah, an interesting point. Geometric and linear algebra are two sides of the same coin; there's a reason why MacDonald's first book is called _Linear and_ Geometric Algebra. In that sense, Geometric Algebra is another way of looking at common Linear Algebra concepts where algebraic operations often have a sensible geometric meaning.
1. https://www.faculty.luther.edu/~macdonal/laga/ 2. https://www.faculty.luther.edu/~macdonal/vagc/
It is a great precursor to then thinking about quaternions
https://www.youtube.com/watch?v=T647CGsuOVU&list=PLiaHhY2iBX...
Octonions and up (more generally known as hypercomplex numbers) exist, but every time you pull the "double dimensions by adding more imaginary components" trick[0], you lose another useful property.
Real to complex loses total ordering. Complex to quaternion loses commutativity. Quaternion to octonion loses associativity (but they are at least alternative). The sedenions aren't even alternative, and they have zero divisors to boot.
You can also generalize hypercomplex numbers to the study of Clifford algebras.
[0] The Cayley-Dickson construction
But while the octonions at least have some mathematical relevance (they're actually connected to various exceptional objects, such as the exception Lie group G_2!), the sedenions and beyond basically don't. They have a tiny bit of associativity but not enough that they connect to any things or that hardly anyone wants to study them -- and worse yet, there are zero divisors so cancellation (ab=ac => b=c for nonzero a) doesn't even hold. (Inverses exist, yes, but without associativity, inverses don't imply cancellation! And therefore aren't much use.)
As another commenter mentioned, what you might be looking for instead if it's orthogonality you're focused on is Clifford algebras (aka geometric algebra). However, if you want to get the complex numbers or quaternions out of it, you'd need to use a negative-definite quadratic form -- if you use a positive-definite one, you'd instead get the split-complex numbers, which are much less interesting (and you'd get something similar instead of the quaternions).
Cayley-Dickson is interesting especially for Physics of course, because it brings in the concept of 'variable dimensions'. I think the flattening of objects, and the stopping of clocks (in Relativity), due to Lorentz effects in Minkowski space both on Black Hole Event Horizons and for objects approaching light speed (anywhere Lorentz holds) is, at the limits, ultimately the loss of a dimension, which would be my overall interpretation of what Cayley-Dickson is about too, in very broad terms.
So if Minkowski space is 4 dimensional, there would be some geometry for a 5-Dim Minkowski and it would use Octonians maybe, and that would be the geometry of the universe our universe is "embedded in"...I mean assuming of course you believe our universe is a Black Hole and we are all on an Event Horizon embedded in a 5D universe. Ya know, as one does. lol.
Orthogonality is captured linear algebra over R^2, but R^2 isn't a field or an algebra.
In higher dimensions you get other type of (sometimes weird) operations, related to the Cartan–Dieudonné theorem.
Visualizing quaternions (2018) - https://news.ycombinator.com/item?id=38043644 - Oct 2023 (42 comments)
Visualizing quaternions: an explorable video series (2018) - https://news.ycombinator.com/item?id=31083042 - April 2022 (15 comments)
Visualizing quaternions: An explorable video series - https://news.ycombinator.com/item?id=18310788 - Oct 2018 (32 comments)
https://www.olliw.eu/2013/imu-data-fusing/#chapter23
Best of luck =3
Edit: I get fusion is regarding multiple sensors
gyroscope: fast over-sampled low-pass filter, but slowly drifts compounding heading errors
accelerometer: relatively stable, but dead-reckoning errors compound quickly
magnetometer: best stability, but low-sample rate and vulnerable to metal/magnets fooling/blinding the sensors
The fusion algorithms usually weights which data is consistent with the motion path, and attenuates the estimated pose errors.
Notably, not all sensors are equal quality, but there are probably better options now. =3
https://github.com/jdranczewski/optical-levitation-raytracin... for my repo, and https://onlinelibrary.wiley.com/doi/abs/10.1002/nme.5165 for the rotational dynamics with quaternions.