Let's go back to our favorite example. We had this sled has one degree of freedom x. And we have this bar. Massless bar with an end mass of m that's swinging. So while the sled can move forward you will have some swinging. And there is a spring, there is gravity acting on this one. Yeah, gravity here it's acting straight down, right? And there is this dampener. Just to make your life better right? So there's a non conservative part. So now we can use LaGrange equations in its full form with the LaGrange in not just with kinetic energy and find these equations. So that you can compare this on your own to the prior stuff we did where we had darlin bears and canes and Newtonian stuff. So here are coordinates our x and theta like before. The only force I have to consider now is going to be this damping force and that's going to be minus the damping coefficients times extinct in the- and one direction. Right before we had to also consider the spring force. And then find the generalized force due to that. Now we won't we will simply have to then account for this through the potential. And the same thing with gravity, we just have to have a potential function for gravity. And then you're good to go, alright? So that's the modification. These coordinates we derived earlier, we still have those position of particle one that's where this spring and damper force will act. And particle two is over here. It's a function of 1+ theta dots. That gives me a swing in the theater direction. So now my Qx, the summation of all remaining forces and there's only one and it's acting on our one. There's no force left acting on. There's no non conservative force left acting on m2. The gravity we don't have to consider. So I just have to do this force dotted with the partial velocity of r1 with respect to the two coordinates rates. And this one here partial of r1 with respect to x stopped. This is just going to give you n1. n1 dotted with n1 is you can give you one. So you're left with -cx. Which is just a damping force in this case pretty simple. For the Q theta part the partial of this with respect to theta dot, there is a theta dot here. Right now there's no theta dot in the r1. So this partial will just go to 0 directly. No extra steps required. So something times 0 is going to be 0. So that one is there. Cool, now we need kinetic energy. This is where people make mistakes again I need the m1/2 times are dot r1 dot dotted with itself. So that will give you this term with an m1 but our two dot dotted with itself. You have to be careful. There's also going to be an n1 dotted with the theta and they are not orthogonal. That's where all of a sudden you get a cosine of this coming in, the projection of one dotted onto the other, right? It's plainer. But I'll let you do this on your own. But this is where you just want to be very careful with it's M1/2 times this magnitude squared plus m2/2 times this magnitude squared. And this one r2 clearly also has an x dot. So squared is going to give us this term. And the stuff over here is just everything in terms of r and r dots. I guess with cross coupling there's a next dot here are different ways you could write it. So you can see getting kinetic energy. Don't forget the basics. Make sure you have positions relative to inertial frame, you're taking inertial derivatives and then just be rigorous transport and it will go. With transport this becomes very automatable as well in mathematical once you get it set up. Potential functions for a linear spring, the potential function is simply k/2 x2. Pretty simple. A little bit later we'll look at cubic springs as well, cubic forces. But for now for the linear one is simply cadiz. So taking its gradient with respect to x negative would give you -kx. That was the force right? That we would have had. Now for gravity, there's different way to write it. For a linear gravity that we're assuming here it's mgh. And h is the height of some reference. How do we pick a reference? Paul? You just do it, okay? Right, so it doesn't matter where you pick it. So it just might as well make your life easy, right? So here I've chosen a formulation where one minus cosine theta, that's basically times our mg, r times this term is my h. But one minus cosine theta when theta is 0 is 1 -1 and it goes to 0. So that means here if you look at it, if you pendulum it backwards and theta 0, that's my reference that I had. What if you made the reference 15 m higher? Drew, will that impact the math? >> Always we take gradients of v. >> It take gradients of v, right? And so if you have a constant of the DV, V is something plus some constant because it's a constant and you take a gradient of it. That gradient of a constant always going to be 0. That's why the reference in the math doesn't matter. So pick your life. Sometimes students get old. I wasn't sure if I should go here or should I do it here or wherever it's well it's just pick one and [LAUGH] Make your life easy. It doesn't matter. If you picked an extra one, they'll have a term, it will drop out and that's okay too. So here I just picked this mgh, so that's the height. So as I have different thetas, this basically gives me the height upwards that I could swing including all the way up. But in terms of the one coordinate that I have there, which is data that I have to deal with. x is in the n1 direction orthogonal to g. So it never has a contribution to the height that mass and two is. So you can see there is still subtleties. And how do we compute potential? How do we compute energy? And this you want to get your cinematics right and figure that out. Now though we have t we have v, we quickly we only had one force left at this point. That's kind of beautiful. And we did get a generalized force that does work on the x, but not on the theta coordinates. So now we can find the Lagrange in t minus v. And again, I would just go into a symbolic manipulator. You can just plug this all in. You then grind through these derivatives of these partials and take this time derivative. And in the end this must be Q in this. So what you will end up with are these two differential equations which are the same that we had earlier or equivalent like that, right? So you can see it's highly automatable that you can. But you have to get energy things right. And we also still assume we have a minimal coordinates set. That's an important thing. But this is pretty popular. This covers a lot of basic simple systems that you might have. Writing it in terms of energy is interesting because this result that we've derived is true. Even if we do not have particles. What if you have some examples we'll get into I think today. What if we have a rigid body? As long as I can write the kinetic energy of the rigid body in terms of finite coordinates, generalized coordinates, here's your yard, pitch roll. And then I'll have to have your pitch roll rates which will give you your pitch and roll accelerations. Which is we know it's not a nice form to write it but it's perfectly valid. This works right? So while we've been dealing with particles all this time, this formulation actually also works with rigid bodies. So anything with finite that can be represented with finite coordinates. So what can't be included in here then? Anything with finite coordinates? Can you give me an example where we do not have a finite coordinates, On a closed continuous system? You're thinking too hard. >> I want to see. >> No, they're finite. So it's a quarter millions of finite but they're just redundant and we'll look at how to deal with constraints if you have an over parameters system. What were you saying? >> CRP. >> CRPs? >> Yeah. >> No, you're thinking they go to infinity. I'm talking a finite number of states. So CRPs uses three states. That's a finite number. Even though the value of the CRP might go to infinity. When do we end up with an infinite number of coordinates? The formidable bodies right? So as soon as we have flexing and stuff. So once we get past this current chapter, that's going to be to focus on homework four and everything up to the final weeks of the semester is. Leading to if you have the formidable bodies, what kind of equations do we get? Partial differential equations. Here we always end up with ordinary differential equations right now, right? So this works. With energy we can always write the energy in terms of a discrete number of coordinates. So even though it's a continuum, you can really write any continuum as a summation of infinite decimal particles, like what we did back in chapter one, you got a summation or an integral it's equivalent. But it is still a finite degree of freedom system. Because if it's a rigid body then the position of this point and this one are all given by three dimensions in position of the center of mass and three in terms of the attitude coordinates in a minimal set. Right, okay? So it's a subtle leap that we've done. But it is a very important leap. We can go from particles to rigid things.