Geometric Algebra for Python
github.com
github.com
So, if you could point to any resources that show how to properly dimension GA values, and how GA operators combine dimensions, that would get me started on GA again.
If you multiply two vectors with units of meters, you get a scalar + a bivector, both with units of square meters.
If you divide two vectors with units of meters, you get a scalar + a bivector which are both dimensionless.
Etc.
Edit: didn't read clearly. Better question is why would we want to have a scalar with units of square meters in this case? Shouldn't 0-grade objects all have the same units?
No, and this is a really important point. Scalars can have any units. For example, you can have a scalar with units of time, or mass, and you can take the dot product of a force vector and a displacement vector to get a scalar with units of [force]·[distance] = [work].
If you instead form the wedge product of those vectors, you get a bivector with the same units: [force]·[distance] = [torque] (note that the units of [work], [torque], and [energy] are all the same).
If you take the geometric product of a force vector and a displacement vector, the result is the sum of a scalar and a bivector, both with the same units of [force]·[distance].
This part is where I have problem with GA: what the hell is the physical[0] interpretation of such a sum? For example, a four-vector <p_x,p_y,p_z,c·E_k> (momentum and kinetic energy) can be thought of as kinetic energy being the temporal component of (4-)momentum, but no similar interpretation seems viable to combine work and torque into a logically unified quantity.
0: I'm not sure if this is the right word - the interpretation as single unified value with no special-case treatment of its components might be another, equally not-quite-right way of putting it.
Like with any expressive language (e.g. English, C++, or matrix algebra), GA makes it possible to state a wide variety of nonsensical things. But that’s not the fault of the language.
Where GA really shines IMO is in the ability to divide by vectors, something that is extremely useful but gets super cumbersome using other mathematical languages.
The biggest “problem” I have with GA is that it takes a lot of practice to get familiarity with all of the powerful stuff it can do. There are pages and pages of (extremely powerful and useful) short identities which are impossible to memorize by just looking at them, and can only be learned as far as I can tell through years of hard-won experience. I feel like I still only really have a handle on the most basic stuff.
I find regularly myself working on some complicated coordinate-based calculation for 3 pages of scratch paper full of mistakes and wrong turns, only to experience déjà vu, re-express the original thing in GA language, and end up with a clear and geometrically interpretable 4 lines of simple algebraic identities which solve the problem. But I’m not always sure if I’d be able to figure out which 4 lines to use right off the bat, without first going through the coordinate slog.
Isn't that just what distinguishing scalar/vector/bivector/trivector/etc is for? I don't have problems with coordinates because I don't bother with coordinate-based calculations in the first place. What I don't get is how adding two multivectors of different [ranks? eg scalar + bivector] is supposed to simplify anything.
> > > the geometric product [...] is the sum of a scalar and a bivector
> any expressive language [...] makes it possible to state a wide variety of nonsensical things.
Yes, but if everything the language makes it possible to state is nonsensical, then what's the point?
I assume there's some sort of point to geometric algebra, but I have yet to encounter any convincing explanation of what that point is, and why I shouldn't keep my dot and wedge products properly separated.
Nobody is going to force you to try something you don’t want to try. I don’t think I’ll be able to convince you.
Er, right; I was[0] asking for a example of a such a dramatically clearer and more insightful result, relative to just using normal dot and wedge products. Using vectors at all saves hours of headaches if all it's being compared to is coordinate-based calculations.
0: Well, the comment before that one was asking about the interpretation of the geometric product.
That isn't to say it's straightforward to implement computationally, or that there isn't interesting structure there.
David Hestenes is himself a physicists. He did a lot to bring Clifford algebras into the main public attention (mainly applying it to the study of space-time). He used the term "geometric algebra" because it looks like this was the term used by Clifford in his work.
There is nothing wrong with teaching the cross product, some people (me included) just think that teaching about exterior (and geometric) products would be more productive.
Introducing the concepts in the context of a euclidean metric seems unmotivated?
I think you're generally right that GA is a rebranding of concepts we already knew about, however representing them in a uniform manner seems like a useful thing to do. The at t=4083 in the video they show some interesting examples of projections, rotations, and other geometric operations that can be done quite simply https://www.youtube.com/watch?v=tX4H_ctggYo&t=4083
One example is why you multiply normals by the world_inverse_tranpose. Apparently the reason is because normals are actually bivectors, not directional vectors as they are usually explained.
another is that at least in code, they apparently solve lots of issues that other methods don't
See: https://marctenbosch.com/quaternions/
The "inverse transpose" is a symbolic manipulation to derive a transformation matrix that inverts the scale, but not the rotation, though it's actually a bit overzealous, you can actually just use the cofactor matrix. https://github.com/graphitemaster/normals_revisited
I know linear algebra but I have no idea what the heck this means. Is this a gaming thing?
e: I'm restating the question in a form I understand, not asking it.
For example, let T be a reflection about the plane spanned by e1 and e2. Then T(e1^e2)=e1^e2, but T(e1 x e2) = -e1 x e2, where "x" denotes the cross product.
That's when they start telling you, that you're supposed to be an elite mathematician, well versed in the higher forms of sophistry, and if that were the case you wouldn't need to understand bivector and wedge product and what not at an intuitive level.
I'm sold.
Especially when you teach applied math for nonmathematicians. For example teaching analysis using infinitesimals for engineers might be pedagogically better (for the level of understanding required).
I'm not expert in history of mathematics, but If I remember correctly there was lots of fighting over represetations related to hypercomplex systems, vectors and matrices in the 1800-century. Quaternion Society wanted to do it one way. https://www.nature.com/articles/052545a0
Anyway, that's why I use it. I'm 43.
1. What's the difference between Geometric Algebra and exterior algebras? Clifford algebras?
This is a hand-wavy explanation, but the GA community has specific GAs give a geometric meaning to objects and operations of some Clifford algebra. For example, there's a 5D algebra (Conformal Geoemtric Algebra?), which is really a 2^5=32D algebra, where elements of the algebra can represent points, point pairs, circles, planes, etc. On the level of Clifford algebra, any of these objects is a point in a 32D space, and operations on points give you other points. That's sort of the mechanics. And then it's the job of GA to give a geometric interpretation of the points and the operations. To draw an analogy to logic, I think of it as syntax vs semantics.
2. Also, what's wrong with cross products?
I just explained how GA is sort of unifying and uniforming. All sorts of disparate geometric objects can be treated uniformly in one representation.
At the same time GA allows you to distinguish between objects that are different. If you give me a vector `A` and a vector `B`, and I return to you `C=A×B`, on the "syntax" level, A, B, and C look the same. If we're thinking in terms of coordinates, they are all triples of real numbers.
But `C` is unlike `A` or `B`. For example, if you wish to operate under a different coordinate system, you might have a transformation matrix M to convert between old and new coordinates. So for example `Anew = M * A`, `Bnew = M * B`, and `Cnew = det(M) * M^{-1}^{T} * C` [2]. What what? The explanationsSome would use is that `A` and `B` are true vectors or polar vectors, and `C` is a pseudovector or axial vector.
In code that I write, I would very much like to have some distinction between vectors that transform like `A` or `B` and vectors that transform like `C`. You can do this with naming conventions, or just making sure you do keep track in some other way that. A GA framework would give you a way to track this difference. In my opinion (and there are many ways to accomplish the same thing) the programming language type of `C` should be distinct from `A`.
I think Hodge duality and the cross product are important, and I honestly don't know what's right to teach kids in high school. The tradition we currently have gets us pretty far. On the other hand, how awkward is it to invoke the notion of C being a "pseudovector" [3]? I think most people never really learn that. The first time I really reckoned with that was when learning computer graphics, because normal vectors transform differently from tangent vectors. Incidentally, if what I wrote doesn't make sense to anyone, learning about these concepts by thinking of normal vectors vs tangent vectors is probably an intuitive motivation. This page should help: https://www.scratchapixel.com/lessons/mathematics-physics-fo...
For anyone who might not know, "an oriented 3-dimensional Euclidean space, an oriented plane can be represented by the exterior product of two basis vectors, and its Hodge dual is the normal vector given by their cross product" [1].
[1] https://en.wikipedia.org/wiki/Hodge_star_operator
[2] https://en.wikipedia.org/wiki/Cross_product#Algebraic_proper...
I wish it had been earlier because I think it is important to have a strong idea of what the objects you are working with are and what properties they have.
Here you go:
A = <1.0, 2.0, 3.0, 4.0>
B = <5.0, 6.0, 7.0, 8.0>
What exactly is A×B supposed to look like there? :)Cross product is awful. The wedge product, on the other hand, is:
# C = <<Ax*By-Ay*Bx,Ax*Bz-Az*Bx,Ax*Bt-At*Bx,
Ay*Bz-Az*By,Ay*Bt-At*By,Az*Bt-At*Bz>>
# C = <<1*6-2*5,1*7-3*5,1*8-4*5,2*7-3*6,2*8-4*6,3*8-4*7>>
# C = <<6-10,7-15,8-20,14-18,16-24,24-28>>
C = <<-4.0,-8.0,-12.0,-4.0,-8.0,-4.0>>
Which works fine for any number of dimensions. (Assuming coordinate-lexicographic order (resonable) and that I didn't screw up the arithmetic (less so).)You would instead need to do CrossProduct(A, B, C) and calculate the determinant of the 4x4 matrix with the last row being the $\mathbb{R}^4$ basis.
You could also create a function by lazy evaluation of CrossProduct(A, B) : $\mathbb{R}^4 \rightarrow \mathbb{R}^4$
Thats also true for R^3: does <1,0,0>x<0,1,0> give <0,0,1>, or <0,0,-1>?
it's completely specified by the order of A and B - there are two possible orders and two possible vectors.
But I'm not quite sure what the package is for.
Is it for playing with geometric algebra? It is really rather simple to implement geometric algebra. As easy as understanding the internals of this package (which is not small for what it does). And in some ways a necessity for understanding the math. Like I wouldn't expect someone to just use quaternions and matrices to do 3-D, without learning how a matrix or quaternion multiplies. And I wouldn't start with a package of dozens and dozens of files in multiple directories, with a ton of inter-imports†.
So I'm assuming the package is for practical use, so it will be nice to see what they envisage it for. The only example is a single trivial operation. I'm aware it can be used for quantum physics. But my experience has been 3-D graphics. And there it is very meh.
So my long-standing problem with geometric algebra in software engineering has been... why? A frustration because it is a lot of fun.
My (imho) advice if you find it fun: you can write your own version in an evening.
---
† I wonder if packages are equivalent of books 20 years ago. I remember that temptation to buy a book, as if that was how you acquired some knowledge. I was guilty of that so many times. Now, want to get geometric algebra? There is a package for that.
I can't speak to performance. I was using it as a GA interactive calculator while I tried to wrap my mind around GA.
yeah... what foolish things we believed 20 years ago...
(tries not to look at the large pile of books accumulating dust in the corner of the room)
Join the discord https://discord.gg/vGY6pPk.
Check out a demo https://observablehq.com/@enkimute/animated-orbits
Is there a way to use Geometric Algebra for higher dimensions?
Was hoping for more (time wise) digestible introductions.
* neural computing
* image and signal processing
* computer and robot vision
* control problems
[edit to add] Also all the classic RF transmission line problems that one would normally solve with Smith Chart techniques map fairly elegantly onto GA(2)
It explains complex numbers and quaternions intuitively.
But I don't think it's intuitive to learn about complex numbers through GA. Complex numbers are a great jumping-off point to learn GA since it is simple and most people eventually accept that the imaginary unit squares to -1, and because complex numbers have a striking geometric interpretation.
But I feel almost certain that people should learn about the special case of complex numbers before they ever learn about geometric algebra.