# Setting up Differential Equations of Motion

1. Oct 30, 2004

### NeutronStar

I'm studying Lagrangian Dynamics using a Schaum's Outline. This book seems to assume that the student can easily set up the Differential Equations of motion, but I can't seem to get the hang of it. The book does not give any actual methods or examples for setting up these Differential equations of motion, they seem to be more concerned with just solving the resulting differential equations.

At the other extreme most of my classical physics books just give the standard equations of motion without really getting into calculus.

Are their any books out there that focus on just setting up the differential equations for a particlar mechanical system.

As an example there is a very simple problem in the Langrangian Dynamics book of a pendulum and spring system. (just one mass hanging from a spring allowed to move in the x-y plane only. It seems simple enough and they give the equations of motion as follows.

$$\ddot{r} - r \dot{\theta}^2 - g \cos \theta + \frac {k} {m} \left( r - r_o \right) = 0$$

and

$$r \ddot {\theta} + 2 \dot {r} \dot {\theta} + g \sin \theta = 0$$

I'd like to find a book that shows methodological procedures for arriving at these types of differential equations from the standard classical physics equations.

Any suggestions?

Also if someone feels like taking the time to show how the above equations where formed from the basic equations of a spring and pendulum motion that would be cool too.

Thank you.

Last edited: Oct 30, 2004
2. Oct 30, 2004

### Clausius2

Right, Let's go. Let's use two general coordinates: r and theta.

-Total Kinetic Energy of the Pendulum:(using polar coordinates)

$$T=\frac{1}{2}M*(\dot{x}^2+\dot{y}^2)=\frac{1}{2}M*(\dot{r}^2+r^2\dot{\theta}^2)$$;

-Total Potential and Elastic Energy:

$$V=-Mgy+ElasticEnergy=-Mgrcos\theta+\frac{1}{2}K(r-r_o)^2$$

-Lagrangian:

$$L=T-V=\frac{1}{2}M*(\dot{r}^2+r^2\dot{\theta}^2)+Mgrcos\theta-\frac{1}{2}K(r-r_o)^2$$;

Now, use the Lagrange equation for each Generalized coordinate:

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{r}}-\frac{\partial L}{\partial r}=\frac{d}{dt}[M\dot{r}]-[Mgcos\theta-K(r-r_o)+Mr\dot\theta^2]=0$$

So that;

$$\ddot{r}-r\dot\theta^2-gcos\theta+\frac{K(r-r_o)}{M}=0$$

i) choose the generalized coordinates (this is the MOST important step of the problem. Here the election is so easy as polar coordinates, but there are problems too difficult at this point).

ii) Write the expressions of Kinetic Energy and Potential Energy as a function of that coordinates.

iii) Employ the definition of Lagrange equations.

iv) Watch the equations for a few time and put your brain on another problem. Be sure they are too difficult to solve analitycally so you have nothing to do with them (except you have some time to waste).

What do you think?.

BTW: the second equation is left to you.

3. Oct 30, 2004

### NeutronStar

Ok. First, I thank you very much for the quick reply.

I do see where you are going with $$L=T-V$$. I understand that this is the Langrangian Method.

However, I'm actually still in chapter 1 (Background Material) of the Schaum's Outline, and they really don't get into the actual Lagrangian until chapter 3.

In fact, in chapter 2 they continue with (Backgound Material) discussing the mathematical forms of potential and kinetic energies in a build up to the Lagrangian methods.

Evidently in this first chapter they are still looking at things from a strictly Newtonian point of view. Using $$F = m\ddot{x}$$ as the main basis for analysis.

Is is possible to derive those same equations of motion using the Newtonian methods of $$F = m\ddot{x}$$? I think that the point to these early chapters is to show that while it is possible to do this using Newtonian Equations the Lagrangian Equations are much easier.

So I suppose my question now is can those same final differential equations be attained using only the Newtonian Equations of force, acceleration and mass?

Or am I misunderstanding something here? They really don't even introduce the Langrangian $$L = T-V$$ until chapter 3 so I don't see how they can be expecting me to use that in chapter 1.

By the way, your Lagrangian analysis was insightful for me and I will look at the second equation from that point of view. But I'd still like to do a couple of these using Newtonian Equations (if possible) just so I can see the difference between these methods.

4. Oct 31, 2004

### Clausius2

Sorry, you talked about "Lagrangian Dynamics", so I proceeded with Lagrange Equations.

Nevertheless, take a look at the equation:

$$\ddot{r}-r\dot\theta^2-gcos\theta+\frac{K(r-r_o)}{M}=0$$

and let me to reshape it as:

$$M\ddot{r}=Mr\dot\theta^2+Mgcos\theta-K(r-r_o)$$

That's the Newton second law for r coordinate. The first term on the right is the centrifugal force, the second one the gravity, and the third one the elastic force that avoids the mass to lenghten its distance from the center.

I mean, this equation is the same as Newton Law if you draw a free body diagram. Try it and divide the forces in those acting in r direction and theta direction. Set up the second law for each coordinate (polar coordinate is a good choosing at first sight) and you will find this equation and the other for theta.

5. Oct 31, 2004

### NeutronStar

Thank You, thank you, thank you! You're a genius!

I actually got this far considering the effects of gravity and the elastic force:

$$M\ddot{r}=Mgcos\theta-K(r-r_o)$$

I just couldn't figure out where they were coming up with the $$Mr\dot\theta^2$$ term. I was completely ignoring the action of the pendulum and the effect of centrifugal force! I would have never thought of that on my own because I just wasn't thinking about the centrifugal force due to the pendulum action.

This has helped me tremendously! Now I'll be able to sleep tonight.

Thanks again!

6. Oct 31, 2004

### Clausius2

Thank YOU, NeutronStar, for walking around here questioning something interesting and for your acknowledgement.

7. Nov 3, 2004

### NeutronStar

I'm pretty sure that I understand the first equation but I can't seem to derive the second one now. Here's what I'm trying to do,...

First off I tried to calculate it using the Lagrangian as you suggested, but I'm either not doing it correctly, or I simply don't know how to take these derivatives properly.

From what you gave me before,...

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{r}}-\frac{\partial L}{\partial r}=\frac{d}{dt}[M\dot{r}]-[Mgcos\theta-K(r-r_o)+Mr\dot\theta^2]=0$$

I'm thinking that I simply need to do the same thing for the second coordinate like so,...

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}}-\frac{\partial L}{\partial \theta}$$

First off, is that a correct assumption?

And if it is, how is that done, I'm not real sure on how to take these partial derivatives.

First I rewrote the original Lagrangian just to remove some brackets like so,...

$$L=T-V=\frac{1}{2}M\dot{r}^2+\frac{1}{2}Mr^2\dot{\theta}^2+Mgrcos\theta-\frac{1}{2}K(r-r_o)^2$$

I just did that so that I can better see each term for taking the partial derivatives

Then I get something like,...

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}}-\frac{\partial L}{\partial \theta}=\frac{d}{dt}[Mr^2\dot{\theta}]+Mgr\sin\theta=0$$

Then when all is said and done I finally get,...

$$\dot {r}\ddot{\theta}+g\sin\theta=0$$

But this is a far cry from what the book gives as the second equation of motion for this model,...

$$r\ddot{\theta}+2\dot{r}\dot{\theta}+g\sin\theta=0$$

So what am I doing that is so terribly wrong?

Also can you explain what each of these terms represents from a Netwonian point of view?

$$r\ddot{\theta}+2\dot{r}\dot{\theta}+g\sin\theta=0$$

I know that the last one comes from the gravitational force. But what are the other two terms? I'm thinking that they might be related to torque, or angular momentum but I can't quite figure out what's going on here.

I'd really like to fully understand the mathematical description of this system perfectly before I move on to to the next system in the book which is far more complex.

8. Nov 4, 2004

### dextercioby

The differentiation.Simply that.Try to make it again and u'll get your result.I won't make it for you.

9. Nov 4, 2004

### NeutronStar

I have been trying to do this over and over again for a week! I'm also doing this entirely on my own as self-study so I have no instructor to ask or anything.

This is the first time that I've ever done partial deriatives with repect to a varible that itself is a time derivative. So I'm not sure what the procedure is for that.

As far as I can see the Lagrangian only has two terms it in that contain $$\theta$$. So how am I ever going to end up with more than two terms with that contain $$\theta$$ unless a product rule is involved, but I don't see it.

First off, what does $$\frac {\partial{L}}{\partial{\dot{\theta}}}$$ mean?

Does it mean to take the derivative of the Lagrangian with respect to the time derivative of $$\theta$$? If that's what it means then there is only one term in the Lagrangian that contains $$\dot\theta$$. All the other terms would be treated as constants and go to zero wouldn't they? So I get,...

$$\frac {\partial{L}}{\partial{\dot{\theta}}}=\frac {\partial{}}{\partial{\dot{\theta}}}\left[\frac{1}{2}mr2\dot{\theta}^2\right]=mr^2\dot{\theta}$$

If that's wrong it's just because I don't understand the rules of taking a derivative with repect to the time derivative of a variable. That's what I get and I can't see anything wrong with the procedure unless there's more to the rules that I know about.

So now I need to do the other partial $$\frac {\partial{L}}{\partial{\theta}}$$

Again, I'm not sure how to do this because the Lagrangian contains two terms with theta, but one of them is a time derivative of theta. I don't know how to treat these. I'm taking it to mean that I just find the derivative with respect to theta, but not with respect to any time derivatives of theta. Like I say, I've never done partials with respect to time dependent variables before.

So I'm taking the derivative of only the terms that contain theta without a time derivative,…

$$\frac {\partial{L}}{\partial{\theta}}=\frac {\partial{}}{\partial{\theta}}\left[-mgr\cos\theta\right]=mgr\sin\theta$$

And that's the only term that contains theta that isn't a time derivative of theta. So all the rest go to zero. Obviously this must be wrong, but I just don't know the rules of partial differentiation with respect to variables that depend on time here.

So I could do this for weeks and not get anywhere until someone gives me some rules. Like I say, I'm doing this on my own so I don't have an instructor. I'm not taking a course. I'm just studying out of a Schaum's outline that doesn't explain things like this at all.

So have I done either one of these partials correctly? Or did I screw up both of them?

10. Nov 4, 2004

### dextercioby

Yes.

So far,so good.

Very well done.You're on the right track.

It's nothing wrong with the calculations so far.

You treat generalized coordinates (like $$r,\theta,\phi,...$$) and their time derivatives ($$\dot{r},\dot{\theta},\dot{\phi},...$$) as independent variables and derive without any problem.

Apparently you didn't see the mistake in your calculations for the second equation of motion.It's the result of the time derivative that sucks,not prior differentiations.
Try to do it again:
$$\frac{d}{dt}[Mr^2\dot{\theta}]$$ is equal to what????

They were both correct.

11. Nov 4, 2004

### NeutronStar

Try to do it again:
$$\frac{d}{dt}[Mr^2\dot{\theta}]$$ is equal to what????
[/QUOTE]
Ok,...

$$\frac{d}{dt}[Mr^2\dot{\theta}] = 2Mr\dot{r}\dot{\theta}+Mr^2\ddot{\theta}$$

Well that's crazy!

I've been tyring to do this all week with pencil and paper and I kept doing it wrong. Then I sit down here and type it in in Latex format and it comes out perfect! I better start doing all my calculations using Latex format!

I know that a got real confused about taking the time derivative of these coodinate variables. Part of what was screwing me up is that I was used to working in terms of x and y's, while studying differential calculus in another book, and then working with t's and r's my mind just didn't see it the same way.

In any case, I had actually done this product rule several times before getting a wrong answer each time. Funny how I got it right the first time when doing it in the Latex format.

Anyhow, thanks for pointing the way. I really couldn't figure out where I was screwing up.

Now I have yet another question that is actually more important to me.

What do each of these terms represent physically in this final equation from a Newtonian point of view?

$$r\ddot{\theta}+2\dot{r}\dot{\theta}+g\sin\theta=0$$

Do I just put the r term back in again like so,...

$$r^2\ddot{\theta}+2r\dot{r}\dot{\theta}+gr\sin\theta=0$$

Then say the first term is torque, the second one angular momentum, and the last one gravity? Would that be correct?

$$Mr^2\ddot{\theta}+2Mr\dot{r}\dot{\theta}+Mgr\sin\theta=0$$

I guess I'd have to put the M's back in too if I really wanted to call this torque, angular mometum and gravitational force.

But I'm unclear as to why there should be an angular momentum term in the second equation when there wasn't any linear momentum term in the first equation???

I'll get this whole problem down pat eventually if it takes the rest of my life! (ha ha)

Last edited: Nov 4, 2004
12. Nov 4, 2004

### tomkeus

Sorry, something's gone wrong with LaTeX. I'll try to fix.
$$\ddot{\theta}=\frac{d^2\theta}{dt^2}=\frac{d\dot{\theta}}{dt}=\frac{d\dot{\theta}}{d\theta}\frac{d\theta}{dt}=\frac{d\dot{\theta}}{dt}\dot{\theta}=\frac{1}{2}\frac{d}{dt}(\dot{\theta}^2)$$

Last edited: Nov 4, 2004
13. Nov 4, 2004

### Clausius2

Well, the last equation is the representation of the Angular Momentum Conservation at the turning center. The first term on the left is the moment of inertia of the mass multiplied by angular acceleration. The third term on the left is the momentum of the gravity force at turning point. But I have problems with the second term. Just now I don't realize where it comes from.

The fact is the sum of torques at the rotation center has to be equal to the inertia moment multiplied by angular acceleration. Remind this, linear coordinates will give you linear conservations laws, while angular coordinates will give you rotational dynamic equilibrium.

14. Nov 4, 2004

### NeutronStar

I'll have to think about exactly why that should be true, but it sounds good.

The Moment of Inertia is defined as $$I=mr^2$$ and torque is defined as $$\tau=I\alpha=mr^2\ddot{\theta}$$. But it probably makes more sense to look at the first term like like you say, as the moment of inertia times the angular acceleration because that's really what's causing it.

Thank you, that was a good reminder because I'm definitely rusty.

The middle term appears to resemble the defintion of angular momentum. $$L=I\dot{\theta}=mr^2\dot{\theta}$$. But I haven't yet justified to myself why it should be there doubled? I'll have to think about this a bit more.

15. Nov 4, 2004

### NeutronStar

I'm afraid I don't get anything from this.

$$\frac{d\dot{\theta}}{d\theta}\frac{d\theta}{dt}=\frac{d\dot{\theta}}{dt}\dot{\theta}$$

It doesn't look equal to me. But I could be wrong.

Also isn't ,...

$$\frac{1}{2}\frac{d}{dt}(\dot{\theta}^2)=\dot{\theta}\ddot{\theta}$$

I'm afraid I didn't get whatever it was that you were hinting at.

16. Nov 5, 2004

### Clausius2

Well, I think I've got it. The dynamic rotational equilibrium states:

$$\frac{d}{dt}(I(t)\dot\theta(t))=\sum (M_i)$$

Where M_i are the external momentums applied at rotating center, named point O. In fact, the moment of inertia of the mass varies with time, because radial coordinates also varies with time. So that, if one wants to write the rotational equilibrium without having any idea about Lagrange equations, he must write the above conservation equation. Proceeding with that:

$$\dot\theta(t)\dot I+I\ddot\theta=-Mgrsin\theta$$

because gravitational force is the unique force that exerts a torque at O.
If you define the moment of inertia of the mass M around point O as:

$$I(t)=Mr^2(t)$$

then you'll find your equation again.

As a cautionary note, you can see the derivation of this problem is easy enough by Newton itself indeed, here employing Lagrangian is a bit exagerated way for obtaining the motion equations. BUT don't take it for granted in the rest of problems. When you have spent five minutes trying to write the equations only with Newton laws, and you don't have success, automatically go on with the Lagrangian, trying not fail in the derivation you will find surely the equations of motion.

17. Nov 5, 2004

### dextercioby

Apparently we've got the problem solved.Fully.

18. Nov 5, 2004

### NeutronStar

Yes, this fullly answers the questions that I put forth in this thread.

I'd like to especially thank Clausius2 for his insightful physical interpretation of each term. This was the part that interests me the most.

While the questions that I asked in this thread have been answered I'm hardly finished with this problem. I now need to go on an solve these equations and then analyze the resulting time dependent equations. But if I have questions with that I'll probably ask them in the mathematics forum.

I do have one further question though while I'm here,...

The original equation for the kinetic energy of this system was given as:
If the pendulum was a solid rod instead of a spring would it be correct then to write the Total Kinetic Energy as simply:

$$T=\frac{1}{2}M*(\dot{x}^2+\dot{y}^2)=\frac{1}{2}M*(r^2+\dot{\theta}^2)$$

Or do you drop the r altogether since it's no longer a degree of freedom?

I suppose that the r would still come into play as a constant for the potential energy though.

I probably should have done that simpler case first!

19. Nov 6, 2004

### Clausius2

If the rod is solid and non elastic (K=0) then:

$$r(t)=R$$

furthermore

$$\dot r=\ddot r=0$$

All the terms that contain the above derivative are dropped, also the elastic terms. Check your new kinetic energy expression because that you posted is wrong.

EDIT: This is another advice, it's a traditional advice said by engineers to begineers in physics and mechanics:

Pay attention to physical DIMENSIONS of the expressions you write. For example:
$$T=\frac{1}{2}M*(\dot{x}^2+\dot{y}^2)=\frac{1}{2}M*(r^2+\dot{\theta}^2)$$

It hasn't got dimensions of energy (Joules), so that it is wrong at first sight without thinking anymore. Checking dimensions will enhance you to be forewarned about errors.

Last edited: Nov 6, 2004
20. Nov 6, 2004

### dextercioby

Your kinetic energy would be then
$$T = \frac{1}{2}Mr^2 \dot{\theta}^2$$ which is just the usual kinetic energy for the rotation movement:
$$T = \frac{1}{2} I\omega^2$$,identifying the momentum of inertia I with $$Mr^2$$.

The dimensional issue is valid only in classical dynamics.At a quantm level,usually this is neglected,because $$\hbar$$ and $$c$$ are set to 1.