Now we are going to take the ideas from the previous segment that are familiar to you from your correspond ordinary differential equations and your course on linear algebra, and we're going to delve into territory that possibly you've never seen before. There will be some exercises for you to work through, to try to fix the ideas in your thinking. But likely, we're reaching the point here where you will need to take more advance courses in the future and in order to make complete sense of these ideas. Our notion of including this material in this special MOOC course is that you would see how the mathematical ideas fit and are needed to understand the more complicated aspects of the robot behaviors that we'll be discussing in future segments. In this segment, I'll be talking about just a pendulum, a simple pendulum hanging in the gravitational field and we will be pretending that this pendulum is the leg. A one degree of freedom leg, a swinging leg with one joint of a body. If you'd prefer to think of it as an arm, that's fine, but we'd like to think about it as the simplest appendage. As you know in most animals and in most robots that are interesting, there will be many, many, many more joints. Often, they'll be revolute joints. And so you can begin to think about compound pendula when you start thinking of the many jointed robot arms and robot legs that we'll be discussing. These many jointed pendula have far more complicated behaviors than the simple one degree of freedom pendulum that I'll be discussing, but the idea and the mathematical connections are very, very much the same. And we will try to get that idea across by making the connection between this non linear one degree of freedom pendulum motion, which perhaps you've not seen before. In contrast to the one degree of freedom linear mass on a spring from the previous segment that you've seen before in physics and ODE theory. The first new idea that we'll be discussing at great length in a future segment on kinematics is the relative motion between constrained rigid bodies creates the normality, because the pendulum swings around and around and around. The mass comes back to the same place that it's been, which would never be possible in the straight line motion of the original protocol. This periodic phenomenon is characteristic of all the interesting kinematics, revolute joints are much more useful in general than prismatic joints as you'll come to see in our kinematic section. Yet, they account for the origin of the normality. So let's look at the picture of the simple pendulum with point mass, m at some position p and I'd like you to think about p as having a spacial component. There's a position on the plane in the horizontal direction x and a position on the plane in a vertical direction z and there's this fixed distance l, which the masses constrained to travel on there by forming a circular arc, whenever it travels at all. It can travel along that circular arc for many, many, many degrees depending on how much energy it has. So our variable p, which looks like a planer variable, because it has two components, px and pz is really a one degree of freedom variable, but a nonlinear freedom variable wstablished by the kinematics of the simple pendulum. We'll model the geometric relation using polar coordinates, which you'll remember from high school probably. Namely, we'd like to think about the horizontal and the vertical components of this point mass, p as having a radial component l, which is fixed and an angular component theta. So that using trigonometry, we can express the position p, px and pz as the function g of the variable theta. Theta is a scalar variable, g is a vector. So g takes the scalar variable, theta, the angle of the pendulum and gives us back, reads out for us, the Cartesian positions, px and pz of the mass that's constrained to ride on that pendulum. G is a special function and its called the kinematic function or the forward kinematics and we think about it as mapping, the joint space that is the space of shaft angles into the workspace, that is the space of positions. When we introduce the kinematics ideas later on in this MOOC, we will talk about kinematics at great length, but we will be increasingly less mathematical, because the mathematics becomes very, very much more complicated. Here in this segment, we're still going to talk about the concepts in the mathematics in a unified manner. Hoping that it will give you some insight later on when you study these more complicated kinematics in greater depth. So we will now having discussed the kinematics of the pendulum, we will now introduce the dynamics of the pendulum by introducing a potential force. The potential force that we're interested in, of course is gravity. Gravity in the Cartesian world looks like a constant accelerator. So gravity adds 9.8 meters per second squared acceleration and you can see that we now have a new differential equation in theta. It looks a little bit like the high double dot equation that we had before in the previous segment on linear time and variant, one degree of freedom particle dynamics. But now we've got the nonlinear term sine theta, which is a consequence of the nonlinearity introduced through the kinematics Well, we could agonize about solving this differential equation. We've given the dynamics and l squared theta double dot equals this right-hand side function sine theta, but we'll find that the mathematicians have discovered a while ago that these nonlinear systems cannot be solved in closed form. The way the Linear Systems can be solved in closed form. Fortunately, the energy dynamical systems point of view that we took in the previous slide, where we thought about the energy in a norm like fashion, those ideas do generalize, and we'll proceed to use those ideas here. Well, how can we repeat the analysis of the linear case in this nominal setting? Let's remember what we did. We realized that there was a Kai, Kai dot plane. Here, we're going to realize that there is a theta, theta dot plain. Namely, what we will do is we will assign to q one, the variable theta. And we will assign to q two the variable theta, theta dot. Please keep in mind that q, the phase variable. Is two dimensional for a very, very different reason that p. P is the partition position of the point mass. Really, this point mass is constraint to have just one degree of freedom, theta. So, we are looking now with the variable q, at the phase space of theta, namely q has coordinance, position and velocity even thought unlike the old vector x in the previous segment, the vector q lives in a non linear space. We can write down a first order depherntial equation in q the same way we wrote down the first order depherntial equation in x in the previous section. Namely q one dot d by d t of theta is theta dot which is just the second derivative and second position q2. In q2 dot we realize q2 dot is d by dt of q1. So, d by dt of b by dt of q one, is q one double dot, and q one double dot means that we should solve for theta double dot in this scalar second order physical version of this first order, two-dimensional system that we're writing down. The mathematician's understand enough about equation five that they can promise us that every initial condition still has a good projectory that I'm denoting q of t through the initial condition q0. But unlike the original equation of the linear time and varying case, qt is not available in closed form. Let's push on. Instead, let's try to use an energy conservation argument to reduce the properties of q(t) over time. Let me write down again the total energy of the simple pendulum. Now, I'm going to write down the kinetic energy of the pendulum which depends only on the velocity q2. Together with the potential energy due to gravity which depends only on the angle position q1. I once again must do the power calculation. That I tried to do an succeeded in the linear case. Namely, I would like to show that with no dissipation at all Hamilton was correct and the total energy is conserved. Let's do that computation. Let's show that D by DT of Ata. When Ata is composed along the motions of this system, that d by d t of Ata is always zero, so that ata is constant. I'm going to write down in theta and theta dot coordinates, and then rewrite them in q1 q2 coordinates to get the expression for Ata as a function of q at any time, t. I'm going to realize that because of conservation it's true and I can rewrite q either q1 or q2, let's say we'll write q2 as a function of q1 and now, I'm plotting on the q1 q2 plane- In red the function Q2 of Q1 that we get by assuming that the total energy is conserved If we add damping it will turn out that there's a viscous churn. And our d by dt computation of total energy will reveal what Lord Kelvin realized, which is that the total energy is no longer conserved, but must be decaying down to zero. These computations are not hard to do, but they will take some time, and we provide exercises for you to work on them if you care to In a supplementary material to this lecture. Let's now pass on, assuming that these derivations are correct, and interpret the change of energy, the negative change of energy as a basin like property. Namely, we're going to look at two different trajectories. We're going to look at the trajectory around the fixed point at the bottom and the fixed point at the top. What do I mean by a fixed point? I mean, what you know physically that if you position the pendulum in the earths gravitational field with no velocity, with the pendulum pointing straight down, it will stay there forever. Similarly, if you position the pendulum straight up with no velocity and you balance it exactly right intuitively that it will also stay there forever. But you also intuitively know that these two different fixed points or fixed positions of the pendula have very very very different behaviors. If you position the pendulum underneath down under, it will stay there forever and if you bump it It will at least oscillate and if there's damping, it will oscillate back down to the 0,0 no energy position. In contrast, if you start with the pendulum pointed exactly up at the fixed point. And you bump it a little bit. Whether or not there's damping. This pendulum will escape from its top position, and it will continue to oscillate forever if there's no damping or it will die down to the bottom under fixed point asymptotically. In either case, the top behavior is unstable, the bottom behavior is stable and we must now develop a mathematical way of thinking about it and analyzing and talking about such different circumstances. Let's look at the behavior down under, a stable fixed point. The equilibrium motion or the fixed point motion is constant over time. Namely, if I start at theta equals zero and theta dot equals zero, I'll stay there forever. The pendulum at the top with theta is equal to pi, and theta dot is equal to zero, is also a fixed point, but will show it's unstable. First, let's define what we mean by stability. Stability is the notion that motions that start close together should stay close together. Asymptotic stability, which is even more important to us, adds the notion that motions that start close together, not only stay close together, but actually come asymptotically closer and closer until they converge. You know intuitively that this is just whats going to happen to the damped pendulum. You know that if you knock it a little bit off it's bottom fixed point, that it'll oscillate a little bit, and settle down to the zero, zero, zero energy state. We would like to use energy methods to show that this is true mathematically. Let's look at the pendulum near the bottom, and we'll see that its total energy gives us a norm-like shape curve. There close circles close to the bottom when we express total energy level curves, and since the power is non positive, we know that we're going to get a red, yellow, blue picture in the non-use setting, just like what we got in the linear case. In the linear case, these red curves were analytically determined. In this case, these red curves are developed by numerical simulation, and they're not closed form, but mathematically we know that they must be converging for the exact same arguments that we used before. We conclude that the bottom fixed point has asymptotic stability, and we've never needed to solve for the motions, because we showed that the total energy is decreasing. That idea is summarized in this total energy basin picture, where you see the red motions in the face plain, Q1, Q2 face plain below. And projected up onto the energy surface as blue ghost curves showing that all the energy is being sucked out of any of these initial conditions by the viscous damping of the pendulum shaft. In contrast, let's go to the unstable fixed point at the top, and do the same computation. The power is still nonpositive. D by D T of ata is still negative, so the power is still nonpositive, and so the energy must be decreasing. But let's see what that means. If we plot the level curves of the total energy function near the top, where theta dot is equal to 0 but theta is equal to pi, then we see that our level curves are saddle like. And indeed when we plot numerically in red, the solution trajectories over time, we see that energy indeed is decreasing, but it's decreasing by running down in one direction, and then running down further in the other direction till we get bluer, and bluer, and bluer. So energy dissipation in this case does not apply convergence. Around the unstable fixed point, the total energy is not norm-like, and therefore its decay does not tell us anything about stability, and in fact enables us to deduce instability. We conclude that it's lonely at the top, it's unstable at the top. And we show this again by thinking about the total energy surface as a saddle in space, where the red motions over time are being projected into these blue ghost curves on the energy surface, and we can see that running down the saddle doesn't mean that your going to run to the point of the saddle. It means that your going to run near the point and run off the saddle, all the way down to the stable fixed point below. We can do this without ever computing the solutions. I find it convenient to illustrate what's going on with these red numerically computed trajectories, but the blue story is all you need mathematically to conclude that this fixed point is unstable, and the fixed point below is stable. The total energy basin defines a task. We're going to think about these energy basins as task symbols, and we're going to try to start composing these task symbols later on in this series of lectures. The Basin properties were established rigorously only in the late 20th Century. These are greedy, tireless efforts of the physical system to get to the bottom of the local fixed point, and we're going to try always to encode what we want out of our robots in these very robust terms, because we don't need to know that much about the initial conditions. We don't need to know that much about the details of the friction. All we need to know is that the friction or whatever energetic method is pulling the energy away from the fixed points we don't like toward the fixed points that we do like. Best yet, these properties are persistent, in that we don't need to know exactly what the masses are or exactly what the spring constants are. These properties will still persist under in the parameters. So the notion of dynamical task encoding, ideas that I began to think about 20 or 30 years ago, have lasted, and generalized, and enable us to begin to implement more and more complicated behavior using artificial potential energy landscape functions. These ideas we're going to try and convey to you more intuitively as the segments go along. But we included this more mathematical rendition in the simple one degree of freedom case, so that you could if you wanted to make the connection between the intuitive ideas that we're presenting later, and the mathematics that underpins them, and introduce those ideas to your future study goals.