biVector forum

How to really get geometric algebra working in practice?

Hello,

I am a scientist working quite a lot on discrete geometric problems, usually involving the parameterization of crystal structures, and got aware of and interested in geometric algebra this way. I read material on the internet, a few books, watched youtube videos, for years already. I find it so elegant and the glimpse of its potential power makes it so intriguing for me that I really want to use it for my own work.

But then I have a big problem. I somehow don’t find a proper way how to use it in my daily work. I try to find ways to use it, and ask myself ways of how I might apply it, but usually this means a day of researching the concepts again, getting distracted by the big picture in many ways, eventually without having a result of using geometric algebra, and as a consequence going back to the usual linear algebra calculations I got used to, which are so cumbersome to do, but eventually give you the right result. This is very frustrating and usually stops my interest in geometric algebra for a while. Until it crosses my way again, always triggering my fascination again.

Thinking a lot about the reasons of my failing attempts, I found, that it seems the problem to be not just getting used to the new concepts, like in learning just another new calculation method again, but rather it appears to me that exactly the abstract power of geometric algebra is blocking me from further progress. In one way I admire the coordinate free approach, but when I have to model something, there have to be the coordinates again at some point, and then it seems to get back to the same cumbersome bookkeeping style of work again but with too much of preliminary/intermediate abstractions added to it. And even without the coordinates it appears so abstract that I do not get the idea how to model my geometric problem in the first place, say to use the power of geometric algebra to find the most efficient model, to improve on the intermediate calculations, to get clean and concise solutions. It seems to me that geometric algebra might not even be very useful in rather simple geometric problems? But how to approach more complex problems, if simple problems are not the way to start with? I just fail to get it on paper.

I guess it is somehow related to the fact, that many ideas of geometric algebra appear unfamiliar in the context of simple problems at first. Like using projective or conformal geometric algebra right from the start. Or even just deciding, which of these to use for a given context. To know which abstract tool to invoke in a special situation. The best thing that happened to me so far was to understand parts of some conventional linear algebra calculation I had done in terms of geometric algebra concepts, but just in hindsight that was, and without making any difference really, to the ease of getting to a solution.

I don’t know if other beginners face the same problem? If so, I would like to know, how they tackle it. Or, if any people who are advanced users of geometric algebra experienced the same problem in their beginnings, and how they overcame it? I have the impression just reading more texts or watching more videos does not really help me.

Thanks and best wishes

hi ,
this is a great post. i can totally identify with your trouble. it took me several years to be able to put GA to use, and even now i sometimes have to translate my thoughts into GA. i suppose its like learning a foreign language late in life; it takes a long time to re-train your mind.
i found using the software packages very helpful to get some concrete-ness to it. maybe you can post a simple problem you want to solve?

A simple problem that comes to my mind and which would be related to a real but more complicated problem I want to solve is the following: Think of two equal sized equilateral triangles sharing a common vertex. Now perform a transformation to one of the triangles, say a rotation by some small angle. The other triangle should follow this rotation in such a way that the triangles keep connected, getting tilted toward each other. Think of some physical model of metal balls and magnetic sticks connecting them. I find this problem quite tricky to describe with ordinary vector and matrix calculations, performing rotations and translations individually, while keeping track of the constraints of keeping the triangles intact and connected, and guess it should have a much better geometric algebra description.

The general problem then would be one of having a much more complex framework of polyhedra, tilting individual polyhedra while keeping the overall framework intact, but also having it respond the way it naturally would in a physical model made of metal balls and magnetic sticks.

I think it’s a great idea to work on a concrete example.

However I don’t quite understand how the second triangle should “follow” the rotation so that the two triangles get “tilted” toward one another. Is this happening in 3D? What are the constraints, besides the fact that the two triangles share a vertex?

No, it is happening in 2D. The constraints are that both triangles have to stay intact (all edge lengths and angles stay the same) and connected at one vertex, while their relative orientation is mostly free, say apart from an additional constraint of excluding their mutual overlap. The common vertex acts like a joint, in fact.

crystal structures

Have you seen
http://geocalc.clas.asu.edu/pdf/crystalsymmetry.pdf
http://geocalc.clas.asu.edu/pdf/CrystalGA.pdf

Might be an interesting exercise to translate http://geocalc.clas.asu.edu/pdf/CrystalGA.pdf into PGA. It’s written using CGA, but I believe it only uses Euclidean transformations and not the full conformal group.

The first step to using GA in practice is to develop a nearly allergic reaction to cross products. If I see a cross product I simply reformulate using a wedge instead.

The next step is to realize you can use the division operator very freely. You can divide vectors! In fact, a quaternion can be formulated as a ratio of vectors. Barycentric coordinates? Divide two areas ( blades ).
Previously this is stuff I had to look up or do some extra mental gymnastics to figure out how to stuff coordinates into the right spots in a matrix. When you switch to thinking in GA it’s just kinda obvious.

Then the next step is being comfortable enough with GA in R3 to just use formulas from CGA or PGA with confidence that doing something exotic like multiplying two spheres together is a reasonable thing to do.

For your triangle problem you would want to start by looking at the algebra of dual quaternions I believe. I haven’t done this, but assuming dual quats are isomorphic to screw theory, you can transform the dual quats representing the transforms on the centres of the two triangles so they act from the common axis located at the joint and enforce the constraint that the change in transform on the left is the same as the one on the right. Then transform back to acting on centroid. Basically featherstone’s algorithm from robotics. You can only extend this to a tree-like structure of constraints.

2 Likes

I think I saw at least one of these articles some time ago, when I came into contact with geometric algebra for the first time. I find them highly interesting, because they cover a topic I am already more familiar with its conventional linear algebra description, so I hoped that this will make things easier, but honestly I experienced the same problem I described in my first post. The formulas look deceitfully simple, yet are totally incomprehensible for a novice. I guess if you already have a grip on geometric algebra understanding, these must be wonderfully clear expositions.

Thank you for these remarks. I guess I already hate the cross product, so that seems fine for me :D. The next step, dividing vectors, is something that intrigued me from the beginning. The descriptions with the dual quaternions sounds interesting but is already a cliff too steep for me. Though I realized that robotics might be a good point to look for. I think my problem is related to (inverse) kinematics, essentially it is rigid bodies connected with joints moving in space. I will try to look up literature related to these applications, which I did not consider so far.

Hi Iridium !

Welcome, I gave it a quick go :

You can find the code here :

https://enkimute.github.io/ganja.js/examples/coffeeshop.html#DWU_QtSyw

This is just using formulas from https://bivector.net/2DPGA.pdf

Let me know if this is what you meant, or have any further questions.

btw as others have pointed out, you did not supply enough constraints in the formulation of the problem, so I assumed your mention of ‘natural response’ could be translated to keeping the center of gravity of the second triangle as close as possible to its original position.

In general, while simple versions of these problems have closed form solutions, the more intricate ones do not and an iterative solver becomes a much better bet. These to are more easily formulated using GA, the coffeeshop 2D IK example is one way to approach such a solver.

In case you were wondering, this ‘also just runs in 3D’ :

Yes, thank you, this is in principle what I meant. It’s true, for realizing it as a graphic one has to possibly consider more constraints, than when you play with some similar model on a table more freely. It might be a good idea to see, if one can figure out the constraints better, in a more systematic way, taking the viewpoint of an engineer doing robotics. This is a new area I did not considered before, to think about this and similar problems, which possibly already have been studied more intensely in these fields. I also will play with the code, I guess it is more easy to learn this way.

Hi @enki, I just tried to make the triangles move a bit more, but then they disconnect : triangles moving high
I can’t see why …

1 Like

Cause I cheaply normalized :wink:

Here’s the /2 replaced with .Normalized, fixing the problem :

https://enkimute.github.io/ganja.js/examples/coffeeshop.html#1wnyJon0t

Enki

Geometric algebra becomes useful via coordinate-free algebraic expressions. This is why a computer algebra implementation of geometric algebra is a necessary prerequisite for computational applications. It becomes useful because it is no longer necessary to work with coordinate expressions in the implementation of an algorithm. To let the algebra do the book-keeping work for you, it is necessary to rely on a geometric algebra implementation. They key is to think in terms of coordinate-free algebra, and geometric algebra happens to have that algebra available. Therefore, once a geometric algebra implementation is available, it becomes a matter of switching over to those algebraic operations. If you do not have a full geometric algebra implementation available, then you will need to do the book-keeping work manually, which is what it appears what you are complaining about. The solution is to start working with a full implementation of geometric algebra, as @alex stated earlier.

I had similar trouble. I work in medical imaging, currently on vector field analysis.
I got attracted by GA two years ago, wrote my tentative problem formulation a few months ago, and managed implementing something useful recently.

It is a simple bivector reconstruction algorithm in ganga.js involving gradient decent / optimization / objective function of bivector.
If your work involves optimization, I would recommend Chapter 8 of GA for CS, Multivector differential calculus by Prof. Eckhard Hitzer., and Geometric Algebra Levenberg-Marquardt by Steven De Keninck and Prof. Leo Dorst. (Don’t forget to check the automatic differentiation example by Steven De Keninck.)

Here is also my note on w/r data set on observablehq.com, in ganja.js’ inline Algebra() environment.
I’m using zeit.cc to read data from a GitHub private repository, and save data locally in JSON. (But possibably it is not the best paretic as my knowledge on javascript is quite limited.)

1 Like

Yes, I agree. I always learned the most of any method by applying it to specific examples and play around with software. Maybe I should focus on that more.

I am not too much into optimization problems I think. It is more about applied geometry, a lot of small problems with a lot of change in the details when going from one to the next. So while the modeling of each problem appears rather simple, the toolbox in the background has to be large, because every now and then a different tool is needed. Usually that means one can combine a lot of different tools from different fields of mathematics and get to a solution. But then, a unified, general framework, once mastered, could be much better. I think geometric algebra could be this framework. That is why I got interested in it.

1 Like