CISM c1311 course: Differential geometric methods for multi-body-systems simulations (part I)
Spent a week at the International Center for Mechanical Sciences in Udine, Italy, for a seminar on Differential Geometric Methods for Multi-Body Dynamics Simulations. At five days, of course, all it can offer is a taste of the field, and this blog post is itself just a summary of a summary, but the field itself is very interesting.
Indeed, that's why I went there. Ever since about 2007 or so I started bumping into papers about group theoretic methods used for system simulation. The mathematics itself is beautiful, but there were many times where I might as well have been smashing my head into the research papers for all the good reading them did. In particular, I was curious what a specific function meant, and why its inverse looked a certain way. The papers I saw it in just dropped those in like they were obvious. Taking pen to paper revealed the calculations to be far from trivial. And I found out, at the seminar, they aren't supposed to be trivial, so I feel less stupid. But there was more to learn there, too, which I will try to summarize. (No slides or pictures from the course are included here.)
Engineering curricula typically cover vector spaces and linear algebra. Vectors are quite intuitive objects; directions are vectors. Displacements are vectors. One can scale a vector, which means change its length, or in other words walk more or less in the same direction. One can add two vectors to get a third. If you have several vectors, you can speak of "averaging" them.
All of that is easy because vectors live in "vector spaces", which is a fancy way of saying spaces that behave the same way our intuition of space does. We can put coordinates on these spaces, and, if we don't need an infinity of coordinates to locate a point in the space (typically, we don't), we can then represent vectors as lists of numbers. Caution, not all lists of numbers are vectors. Unless the numbers refer to coordinates in a space, they do not form a vector.
Since vectors are intuitive and simple to work with, we tend to model physical systems as 'points' in some vector space of appropriate dimension. For example, suppose a point-mass particle is moving in space, under the action of some force. Then we'd need three numbers for its position, and three numbers for its velocity, and together these six numbers make a state vector. We'd have some 'dynamics' equation telling us how this state vector changes- and this change would be a vector itself. If we wanted to simulate the particle, we'd use some discrete-time version of the equation fed through some 'integration' scheme, which just says we compute some small displacement from the current state in the direction given by the dynamics equation, and update the state.
One problem is that something very common to mechanical systems does not live in a vector space. Rotation. You can add vectors to make a third vector, and the order of addition does not matter. However, if you "add" some rotation along the Y axis to some rotation along the Z axis (meaning, rotate around Z, then rotate around Y), you'll get a different result than rotating around Y then around Z, even if you used the same angles for all rotations. This is why mathematicians would not say "add rotations" but rather "compose rotations".
To be mathematically strict, rotations live on something called a "group" (in particular, for 3D rotations this is SO(3)), which is a set of things, called "group elements", and an operation between them, usually called "composition". This composition must always produce elements in the group (composing any two rotations is always another rotation, not guacamole), it must be associative (which means the order in which the group elements are composed fully determines the result), it must have a neutral element (some element in the group is the "do nothing" element) and any element must have an inverse (if a group element and its inverse are composed one after the other, the do nothing element results).Groups are NOT required to be commutative, and indeed, rotations are not. Also, there is no scaling operation on groups. Since there's no addition, and no scaling, integrators that work on vector spaces are, technically, not proper to apply on groups.
But, there seems to be some kind of scaling on rotations. I could, say, rotate that GIMP monkey head by 10 degrees along the Z axis. What would scaling this rotation by 2 mean? Intuitively, it would mean I'd rotate it by 20 degrees instead, along the same axis. Indeed, any rotation (in 3D) has some axis, so I could say scaling rotations makes sense. That's because rotations (and groups that appear on continuous physical systems in general) are a very special kind of groups, called "Lie groups". And what's special is they have something called a "Lie algebra".
You can think of the group as some kind of space in which a point moves. Suppose the point starts at the "do nothing" element. Which directions could it go in? The space of all possible directions and velocities for the point to leave from the do nothing element is the Lie algebra of the group, and as it turns out, it is a vector space, and a rather special one.
For a lot of curved spaces, whether or not they are Lie groups, it is true that the space of possible velocities at any location is a vector space, the "tangent space (at that point)".
But, a Lie algebra has more structure. It makes sense to say, for any direction inside a Lie algebra, "keep going like this forever". Whichever axis of rotation you choose, you can rotate the object around it for as long as you like, and there'll be no confusion that you're still rotating around that axis. There's a bit of weird-sounding math to make this intuition rigurous, but for this post, it's enough: a Lie algebra contains directions in which you could go forever.
This allows some other handy math to be defined, in particular something called the exponential function (for Lie groups), which takes a Lie algebra element and returns an element of the group. Its meaning: if you walked in the direction given by the Lie algebra element, starting from the do nothing element, for one unit of time, you will arrive at this group element. (There's a corresponding logarithm function, which can tell you which Lie algebra element, in other words, which direction, to take so as to arrive at a given group element, if you started from the do noting element). Also, something called the "right trivialized differential of exponential function" (and its inverse) allows you to convert local velocities along trajectories in a group to directions in the Lie algebra, and vice-versa. The computational details are a bit ugly for general groups (for rotations, they turn out to look quite nice), but what matters is what these functions allow you to do.
With some cleverness, we can write integrators for systems evolving on Lie groups. The basic idea is to 'rotate' the system so that its current state is the do-nothing element: using the exponential and its right trivialized differential, identify which direction in the Lie algebra corresponds to the one the system would go next. Use the exponential map to get a short step along this direction, and then rotate everything back, so that the step is taken from the system's real state. In this way, we ensure that the solution we get from our integrator makes sense: it stays in the group the system is evolving on.
There are other ways to handle this too, which don't involve as much attention to Lie group theory. In particular, if the physical system is known to stay inside a region of state space for which we have a complete coordinate chart, then we can use integrators meant for vector spaces. Even so, there is a beauty to the mathematics that I for one find interesting. Anyway, this was the point of the first day and a half of the seminar.
Indeed, that's why I went there. Ever since about 2007 or so I started bumping into papers about group theoretic methods used for system simulation. The mathematics itself is beautiful, but there were many times where I might as well have been smashing my head into the research papers for all the good reading them did. In particular, I was curious what a specific function meant, and why its inverse looked a certain way. The papers I saw it in just dropped those in like they were obvious. Taking pen to paper revealed the calculations to be far from trivial. And I found out, at the seminar, they aren't supposed to be trivial, so I feel less stupid. But there was more to learn there, too, which I will try to summarize. (No slides or pictures from the course are included here.)
Engineering curricula typically cover vector spaces and linear algebra. Vectors are quite intuitive objects; directions are vectors. Displacements are vectors. One can scale a vector, which means change its length, or in other words walk more or less in the same direction. One can add two vectors to get a third. If you have several vectors, you can speak of "averaging" them.
All of that is easy because vectors live in "vector spaces", which is a fancy way of saying spaces that behave the same way our intuition of space does. We can put coordinates on these spaces, and, if we don't need an infinity of coordinates to locate a point in the space (typically, we don't), we can then represent vectors as lists of numbers. Caution, not all lists of numbers are vectors. Unless the numbers refer to coordinates in a space, they do not form a vector.
Since vectors are intuitive and simple to work with, we tend to model physical systems as 'points' in some vector space of appropriate dimension. For example, suppose a point-mass particle is moving in space, under the action of some force. Then we'd need three numbers for its position, and three numbers for its velocity, and together these six numbers make a state vector. We'd have some 'dynamics' equation telling us how this state vector changes- and this change would be a vector itself. If we wanted to simulate the particle, we'd use some discrete-time version of the equation fed through some 'integration' scheme, which just says we compute some small displacement from the current state in the direction given by the dynamics equation, and update the state.
One problem is that something very common to mechanical systems does not live in a vector space. Rotation. You can add vectors to make a third vector, and the order of addition does not matter. However, if you "add" some rotation along the Y axis to some rotation along the Z axis (meaning, rotate around Z, then rotate around Y), you'll get a different result than rotating around Y then around Z, even if you used the same angles for all rotations. This is why mathematicians would not say "add rotations" but rather "compose rotations".
To be mathematically strict, rotations live on something called a "group" (in particular, for 3D rotations this is SO(3)), which is a set of things, called "group elements", and an operation between them, usually called "composition". This composition must always produce elements in the group (composing any two rotations is always another rotation, not guacamole), it must be associative (which means the order in which the group elements are composed fully determines the result), it must have a neutral element (some element in the group is the "do nothing" element) and any element must have an inverse (if a group element and its inverse are composed one after the other, the do nothing element results).Groups are NOT required to be commutative, and indeed, rotations are not. Also, there is no scaling operation on groups. Since there's no addition, and no scaling, integrators that work on vector spaces are, technically, not proper to apply on groups.
But, there seems to be some kind of scaling on rotations. I could, say, rotate that GIMP monkey head by 10 degrees along the Z axis. What would scaling this rotation by 2 mean? Intuitively, it would mean I'd rotate it by 20 degrees instead, along the same axis. Indeed, any rotation (in 3D) has some axis, so I could say scaling rotations makes sense. That's because rotations (and groups that appear on continuous physical systems in general) are a very special kind of groups, called "Lie groups". And what's special is they have something called a "Lie algebra".
You can think of the group as some kind of space in which a point moves. Suppose the point starts at the "do nothing" element. Which directions could it go in? The space of all possible directions and velocities for the point to leave from the do nothing element is the Lie algebra of the group, and as it turns out, it is a vector space, and a rather special one.
For a lot of curved spaces, whether or not they are Lie groups, it is true that the space of possible velocities at any location is a vector space, the "tangent space (at that point)".
But, a Lie algebra has more structure. It makes sense to say, for any direction inside a Lie algebra, "keep going like this forever". Whichever axis of rotation you choose, you can rotate the object around it for as long as you like, and there'll be no confusion that you're still rotating around that axis. There's a bit of weird-sounding math to make this intuition rigurous, but for this post, it's enough: a Lie algebra contains directions in which you could go forever.
This allows some other handy math to be defined, in particular something called the exponential function (for Lie groups), which takes a Lie algebra element and returns an element of the group. Its meaning: if you walked in the direction given by the Lie algebra element, starting from the do nothing element, for one unit of time, you will arrive at this group element. (There's a corresponding logarithm function, which can tell you which Lie algebra element, in other words, which direction, to take so as to arrive at a given group element, if you started from the do noting element). Also, something called the "right trivialized differential of exponential function" (and its inverse) allows you to convert local velocities along trajectories in a group to directions in the Lie algebra, and vice-versa. The computational details are a bit ugly for general groups (for rotations, they turn out to look quite nice), but what matters is what these functions allow you to do.
With some cleverness, we can write integrators for systems evolving on Lie groups. The basic idea is to 'rotate' the system so that its current state is the do-nothing element: using the exponential and its right trivialized differential, identify which direction in the Lie algebra corresponds to the one the system would go next. Use the exponential map to get a short step along this direction, and then rotate everything back, so that the step is taken from the system's real state. In this way, we ensure that the solution we get from our integrator makes sense: it stays in the group the system is evolving on.
There are other ways to handle this too, which don't involve as much attention to Lie group theory. In particular, if the physical system is known to stay inside a region of state space for which we have a complete coordinate chart, then we can use integrators meant for vector spaces. Even so, there is a beauty to the mathematics that I for one find interesting. Anyway, this was the point of the first day and a half of the seminar.
Comments
Post a Comment