ECE 680 Selected Notes from Lecture 3 January 14, 2008 1

Using the Lagrangian to obtain of

In Section 1.5 of the textbook, Zak introduces the Lagrangian L = K − U, which is the difference between the kinetic and potential of the system. He then proceeds to obtain the Lagrange equations of motion in Cartesian coordinates for a point subject to conservative , namely,

d ∂L ! ∂L − = 0 i = 1, 2, 3. (1) dt ∂x˙ i ∂xi

(Any nonconservative forces acting on the point mass would show up on the right hand side.) Here’s how the text gets from the definition to the result. We know that for a point mass, is equal to mass , d ˙x F = ma = m¨x = m , dt and is equal to the integral over of the applied force. We can substitute for the force to obtain

Z B W = F · dx (2) A Z B = m¨x · dx (3) A Z B = m ˙x · d ˙x (4) A where we have played fast and loose with the to conclude that

xdx¨ = (dx/dt˙ )dx = dx˙(dx/dt) =xd ˙ x.˙

Assuming conservative forces, we can then integrate to obtain

m   B W = ˙xT ˙x (5) 2 A so the work is the difference between the at point B and that at point A. Conservation of energy requires that an increase in kinetic energy must be balanced by decrease in so we can write

Z B − F · dx = ∆U (6) A and thus F = −∇U, ECE 680 Selected Notes from Lecture 3 January 14, 2008 2 where we use the notation " ∂U ∂U ∂U #T ∇U := . ∂x1 ∂x2 ∂x3 We have used the fact that if we measure change in potential energy with respect to a constant reference, the of the constant reference is zero so we have ∇ (∆U) = ∇U.

We’re almost ready to rewrite Newton’s in its Lagrangian form. We know that ∂K = mx˙ i (7) ∂x˙ i so Newton’s law becomes d ∂K ! F = − (∇U)i = = mx¨i i = 1, 2, 3. (8) dt ∂x˙ i

Now with L = K − U, we see that K does not depend on and U does not depend on , so ∂L ∂K = (9) ∂x˙ i ∂x˙ i ∂L ∂U = − (10) ∂xi ∂xi so Newton’s equation can be rewritten as d ∂L ! ∂L − = 0 i = 1, 2, 3 (11) dt ∂x˙ i ∂xi as asserted earlier. Next, in Section 1.6, Zak extends the above analysis to by ex- pressing each of the xi in terms of new coordinates qi. By the chain rule we then have

∂xi ∂xi ∂xi x˙ i = q˙1 + q˙2 + q˙3 (12) ∂q1 ∂q2 ∂q3 and after repeating the derivation with the new coordinates qi we obtain, (surprise, sur- prise,) d ∂L ! ∂L − = 0 i = 1, 2, 3. (13) dt ∂q˙i ∂qi If the applied force has a nonconservative component, the right-hand side is equal to the nonconservative component rather than zero. Let’s do a of simple examples to demonstrate that this is a viable method for obtaining the equations of motion. ECE 680 Selected Notes from Lecture 3 January 14, 2008 3

Example 1:

Consider a pendulum of mass m and length ` with angular θ from the vertical. From the geometry, the expressions for the kinetic and potential are

1  2 K = m lθ˙ (14) 2 U = mgl (1 − cos θ) . (15)

Accordingly, 1 L = K − U = m`2θ˙2 − mgl(1 − cos θ). (16) 2 The ∂L = −mg` sin θ (17) ∂θ and ∂L = m`2θ˙ (18) ∂θ˙ so d ∂L! = m`2θ¨ (19) dt ∂θ˙ and finally solving for θ we have g sin θ θ¨ = − . (20) `

Example 2: Pendulum on Cart

This may have seemed like a very difficult way to get the equation of motion of a pendulum, so let’s try a more complicated example. We hang the pendulum from a cart of mass M and position x, acted upon by a force u in the direction of x, and moving on frictionless rails. The the x position of the pendulum is x+` sin θ and the y position is ` cos θ, so the kinetic energy is 1 1 d !2 1 d !2 K = Mx˙ 2 + m (x + ` sin θ) + m (` cos θ) . (21) 2 2 dt 2 dt First taking the -derivatives, then squaring, then noting that cos2 θ + sin2 θ = 1 we obtain 1 1 K = (M + m)x ˙ 2 + m`x˙θ˙ cos θ + m`2θ˙2. (22) 2 2 The potential energy is as before, so 1 1 L = K − U = (M + m)x ˙ 2 + m`x˙θ˙ cos θ + m`2θ˙2 − mg` (1 − cos θ) . (23) 2 2 ECE 680 Selected Notes from Lecture 3 January 14, 2008 4

Clearly ∂L/∂x = 0 and ∂L = (M + m)x ˙ + m`θ˙ cos θ (24) ∂x˙ so ! d ∂L   = (M + m)x ¨ + m` θ¨cos θ − θ˙2 sin θ = u (25) dt ∂x˙

Next we consider the θ direction and velocity, taking ∂L = −m`x˙θ˙ sin θ + mg`θ˙ sin θ (26) ∂θ and ∂L = m`x˙ cos θ + m`2θ.˙ (27) ∂θ˙ Taking the yields ! d ∂L   = m`x¨ cos θ − m`x˙θ˙ sin θ + m`2θ.¨ (28) dt ∂θ˙ The Lagrangian equation of motion is thus   m` x¨ cos θ + `θ¨ − g sin θ = 0. (29)

We can write this as a differential equation " #" # " # M + m m` cos θ x¨ m`θ˙2 sin θ + u = . (30) cos θ ` θ¨ g sin θ

Of course the cart pendulum is really a fourth order system so we’ll want to define a new h iT state vector x x˙ θ θ˙ in order to solve the nonlinear state equation.

(31)

For comparison, it will be instructive to read Section 1.7 in which Zak presents an example of a cart with . Instead of using the Lagrangian equations of motion, he applies Newton’s law in its usual form. There are a couple of differences between the examples. Specifically, in the example in Section 1.7

1. the pendulum is a distributed rather than point mass, and

2. frictional force on the cart wheels is considered.