# Classical Mechanics: Newtonian, Lagrangian, and Hamiltonian In classical mechanics, there are three common approaches to solving problems.  I’m going to solve the same situation three different ways.  It’s going to be fun.  Trust me.

Here is the problem.  A ball is at ground level and tossed straight up with an initial velocity.  The only force on the ball while it is in the air is the gravitational force.  Oh, the ball has a mass of “m”.

Newtonian Mechanics

First, let’s get this out of the way.  It wasn’t just Newton that did this stuff.  Also, please don’t lecture me on “Newton’s Three Laws of Eternal Motion and the Rules of the Universe”.  Yes, I think everyone spends too much time on “the three laws”.

In short, Newtonian mechanics works for cases in which we know the forces and we have a reasonable coordinate system.  Yes, it’s true that we can use unreasonable coordinate systems and still have this stuff work.  Also, it’s possible to deal with unknown forces (like the tension in a string with a swinging pendulum).  But Newtonian mechanics works best if we know the forces.

If you know the forces (or just one force), then the following is true (in one dimension): $F_\text{net} = m\ddot{x}$

Honestly, I prefer to write the momentum principle—but let’s just go with this for now.  Oh, in case you didn’t notice, I am using the “dot-notation” for derivatives.  A single dot means: $\dot{y} = \frac{dy}{dt}$

The double dot means a second derivative (with respect to time).

Back to the tossed ball.  The only force on the ball is the gravitational force.  Also, I am going to use “y” for the position.  This gives us: $-mg=m\ddot{y}$ $-g=\ddot{y}$

That’s just a second order differential equation (and not a very difficult one).  If I integrate both sides with respect to time, I get: $\dot{y} = \dot{y_0} -gt$

Integrating again, I get: $y=y_0 +\dot{y_0}t - \frac{1}{2}gt^2$

Boom. That’s your equation of motion for a tossed ball.

Lagrangian Mechanics

I’m not going to go over the whole theory behind the Lagrangian.  Here is the short answer (super short).  If you define something called the Lagrangian as: $L = T-U$

Where T is the “generalized” kinetic energy and U is the potential energy, then the path a particle will take will be such that the integral over time of L is stationary (which is like minimized).  When you need to find a function that minimizes an integral, you can use the Euler-Lagrange equation to get the following (in 1 dimension for simplicity): $\frac{\partial L}{\partial y} - \frac{d}{dt} \frac{\partial L}{\partial \dot{y}}=0$

The best part of Lagrangian mechanics is that you don’t have to use normal coordinate systems.  If you have a bead moving along a wire, the coordinate system can be defined as the distance along the wire.  Also, since the Lagrangian depends on kinetic and potential energy it does a much better job with constraint forces.

OK, let’s do this for the ball example.  I’m going to assume the ball has a position y as measured from the ground and a velocity $\dot{y}$.  That gives the following: $T = \frac{1}{2}m\dot{y}^2$ $U = mgy$ $L = T-U = \frac{1}{2}m\dot{y}^2 - mgy$

To get the equation of motion, I need to first take the partial derivative of L with respect to y: $\frac{\partial L}{\partial y}=-mg$

Also, I need that second term with the derivative of the partial with respect to $\dot{y}$.  It doesn’t matter in this problem—but here is where I caution students to be careful of the difference between a derivative and a partial derivative. $\frac{d}{dt}\frac{\partial L}{\partial \dot{y}} = m\ddot{y}$

Yes, I skipped a step in there because it was trivial.  Putting this together, I get: $-mg-m\ddot{y}=0$ $\ddot{y} = -g$

Now we are at the same place as the Newtonian method.  I could integrate twice, but I would clearly get the same thing.

Hamiltonian Mechanics

I’ll be honest.  I sort of suck at Hamiltonian mechanics.  Oh sure—it’s super important.  However, for just about every problem in classical mechanics it’s going to be easier to use either Newtonian mechanics or Lagrangian.

Then why do the Hamiltonian?  The first reason is for quantum mechanics.  Yes, in quantum mechanics we use the Hamiltonian operator.  It’s probably a good idea to understand just what the heck that means.  The second reason is statistical mechanics.  The Hamiltonian turns up there too.  Oh, and other places.

Let’s get started though. I am again skipping the derivation of the Hamiltonian.  This is a blog post, not a textbook.

In one dimension (and for one particle) the Hamiltonian is defined as: $H = p\dot{y}-L$

Yes, you have to find the Lagrangian first.  Oh, the p is momentum.  However, once you get the Hamiltonian you get the two following equations: $\dot{y} = \frac{\partial H}{\partial p}$ $\dot{p} = -\frac{\partial H}{\partial y}$

OK, let’s do this.  I already have the Lagrangian.  I can write the Hamiltonian as: $H = m\dot{y}\dot{y} - \frac{1}{2}m\dot{y}^2+mgy =\frac{1}{2}m\dot{y}^2+mgy$

Since the Hamiltonian really depends on position and momentum, I need to get this in terms of y and p.  Note: I am using $p = m\dot{y}$ for the momentum.  This is not always the case—it depends on your choice of coordinate system.  But anyway, I will proceed.  This makes the Hamiltonian: $H=\frac{p^2}{2m}+mgy$

Yes. In this case, this is the total energy.  It doesn’t have to be the total energy—it just works in this case.

Now I can use the two partials to get two equations: $\dot{y} = \frac{\partial H}{\partial p} = \frac{p}{m}$ $\dot{p}=-\frac{\partial H}{\partial y} = -mg$

Here is a major point about Hamiltonian: using this method, I get two first order differential equations instead of one second order differential equation.  That might be important in some cases.

In order to get the equation of motion, I’m going to take the derivative of $\dot{y}$. $\ddot{y} = \frac{d}{dt} \left( \frac{p}{m} \right) = \frac{\dot{p}}{m}$

Fortunately, I already have an expression for $\dot{p}$.  Putting this together, I get: $\ddot{y} = \frac{-mg}{m} = -g$

Boom.  Back to that same equation as in the other two methods.

The end.

# Update on Python Physics Curriculum

So here is the deal.  I had this idea.  The plan was to include numerical calculations into the intro physics curriculum by writing a sort of online textbook.  Or maybe just redo my Just Enough Physics ebook to include more numerical calculations.  Anyway, this is what I came up with. It’s written with trinket.io – an online implementation of python that pretty much rocks.

Here is my curriculum (it’s incomplete – but totally free).

Introductory Physics with Python

Here are some of my own thoughts on this curriculum (including using trinket.io):

• It’s free and online.  That’s mostly good – but I don’t know if online is the best format for physics.
• There is one thing about trinket.io that makes this rock.  There is python RIGHT IN THE PAGE.  Readers can view and run code – no logging in, no saving, nothing.  Just edit and run.  No barriers.
• It has the same idea as Just Enough Physics in that it goes over the basic stuff – but doesn’t overload the student with tons of different ideas (no fluid dynamics, waves, buoyancy, sound…).  It’s not that those are bad topics, it’s just too much.  Too much.
• Homework.  Students want homework questions.  I sort of added those in – but students seem to want traditional homework questions.

Now for the part that needs work.  Well, all of it needs work – it’s not complete.  But I made an error – I figured I would finish this curriculum as I was using it to teach the summer session of physics, but the pressure was too much.  In the end, I think I made it too much like the traditional format of a textbook (with the traditional order of topics).  Really, I started along the best path – but went off the rails when I wanted to do a problem that involved new physics.  So, I just added that new stuff in there.

I need to rethink just what I want to cover – and here is my new plan.

• Kinematics in 1-D and 2-D. I like starting with kinematics because students can model motion and this works great with numerical calculations.  The one problem is that you have to use acceleration instead of change in momentum – and this messes up with my momentum principle.  Actually, maybe I will just do 1-D motion so that I don’t need vectors.
• Forces. I don’t really want to focus on forces and equilibrium, but the students need this to do more stuff.  In this, I need to do the following.
• Vectors.  Boom – need vectors.
• Special forces: gravity, real gravity, maybe Coulomb force.
• What about friction, and forces of constraint (like the normal force)?  Here you can see how it gets out of hand.  Friction is super crazy if you think about it – so are normal forces.
• What if I just did simple forces – like pushing with your hand or rockets?
• Momentum Principle.  Here I need to make a connection between forces and motion.  Since I used acceleration before, I need to make a connection between the momentum principle and $\vec{F}_\text{net} = m\vec{a}$.  Honestly, I hate calling this Newton’s Second Law – it seems wrong.
• But what about circular acceleration?  How do you deal with that?  I don’t know.  Maybe just avoid it for now.
• Work Energy Principle. I think this is mostly ok – except I need to introduce the spring force and spring potential energy.
• Angular Momentum Principle.  My initial idea was to cover “Three Big Ideas” – momentum principle, work-energy, angular momentum principle.  However, there is SO MUCH baggage associated with angular momentum principle.  Much of this stuff is just beyond intro-level students.

I think I have a new plan.

• Forces – but simple stuff.  No friction.  No normal forces.  All the examples will be in space or something.
• Momentum Principle and acceleration. Again, normal stuff.  No forces of constraint.  Mostly space stuff because that will be fun.  Projectile motion stuff too.
• Work-Energy Principle.  Springs, gravity, dropping objects.  Orbits.
• Special cases.  Instead of Angular Momentum, I’m going to go over forces of constraint, friction, normal forces, circular acceleration.

The end.  Oh, I need to make sure there are plenty of exercises for students.  Rewrites coming.

I need to redo all my physics labs.  They are terrible.  I want to make them even MORE about model building.

With that in mind, I saw this:

One sentence labs.  Leave the procedure up to the students.  I think I will need some type of turn in sheet for these labs though.  What about informal lab reports?

# The worst high school physics question EVER

Here is a multiple choice question from an online high school physics question.  It’s bad, but it’s probably not actually the worst ever.

It goes something like this:

You have three objects that start at the same temperature.  Which one cools off the fastest?

1. A dry bean
2. Toast
3. Water

I’ll be honest, I answered this question incorrectly – well, I should say that my answer didn’t agree with the key.  Let’s go over the options.

Water

I’m starting with water because this is the answer I chose.  Why would water cool off the fastest?  My assumption was that the water would evaporate and cool off the liquid more than the other two objects.

Of course the evaporative cool depends on several things:

• The water temperature
• The air temperature and humdity
• The volume of water
• The surface area of water.

If I take some water and pour it into a very shallow pan with a large surface area, this stuff is going to cool off quick.  Note: here is an older post about evaporative cooling.

Toast

This was my second answer.  What is special about toast and why would they choose it?  In my mind, toast is special because it has lots of holes.  Lots of holes means that it has a large surface area to volume ratio.

Since things radiate thermal energy through the surface area, things with high surface area to volume ratios cool off faster.  This is why small objects cool off faster than large objects.  This is also why the moon’s core is cooler than the Earth’s core (the moon is smaller).

Oh, this is also how a heat sink works.  Large surface area to volume ratio.

Dry Bean

A dry bean could cool off the fastest because it is small (high surface area to volume ratio) and it is low density.  I assume if it has a low density it has a low specific heat capacity.  This means that with a low specific heat capacity, the dry bean has a small amount of thermal energy even though it has the same temperature as the water and the toast.

This is essentially the same reason that you can put pizza on aluminum foil in the oven.  Once it is hot, you can touch the aluminum foil, but not the pizza.  Although they are at the same temperature, the aluminum foil has less thermal energy to burn you (because of the low mass).

This was the correct answer (according to the people that wrote this dumb question).

Writing questions isn’t so simple

I think what the author really wanted to ask was “which has the lowest thermal energy?”  But even then, you have to take mass and specific heat capacity into consideration.

It’s really just a super bad question.  Super bad.  Oh, but it’s probably not the worst one.  I saw some others that were just as bad if not worse, but I have blocked them from my memory.

# Numerical Calculation Collection

The following are some of my best posts about numerical calculations.

# What is a good problem?

Part of the reassessment process has students pick problems to solve that they think are good demonstrations of their understanding of the material (or the standard).

For me (as the evaluator), I can learn quite a bit about what a student thinks just based on the problem they pick to solve.  However, it seems that students really don’t want to pick problems.  They would prefer to have me just tell them what problems to solve.

OK, let’s do this.  Let’s look at some problems and see which ones are good and which ones are not so good.  In this case, it will be for the Position-Velocity-Acceleration standard.  For this standard, students should show that they understand and can use the definitions of position, velocity, and acceleration in 1 dimension.  So here are some questions.  You get to pick which one is the best.  Actually, why don’t you score them from 0-10 (11 being the best).

Problem A.

A plane has a mass of 1120 kg and is landing on a runway.  The landing speed of the plane is 50 m/s and the runway is 2140 meters long.  What is the acceleration of the plane?

Problem B.

Your car is the fastest all around.  No one can beat you.  It has an acceleration of 8.2 m/s2.  Suppose you start from a rest (because, don’t all drag racers do this).  How long would it take your awesome car to get to a speed of 55 m/s?  What is this speed in mph?  What is the average speed during this time?  How far did you go?

Problem C.

A police car starts from rest and can accelerate at 5.5 m/s2.  The police car starts accelerating as soon as a speeding car passes by with a speed of 25 m/s.  Assuming the police car has a constant acceleration and the other car has a constant speed, where does the police car catch up to the other car?

Problem D.

Can you have a hang time of over 2 seconds when jumping?

Problem E.

A rocket is in space traveling with a speed of 328 m/s.  It fires its rockets to create an acceleration of -10.7 m/s2 (slowing down).  What is the speed after 5.8 seconds?

Problem F.

no words

# Torque produced by balls in Fantastic Contraption

The fun part about exploring the physics of [Fantastic Contraption](http://fantasticcontraption.com/) is coming up with new setups to test ideas. Torque is not too difficult to set up. Here is what I did:

In this setup, I have a “turning ball” with a wood stick attached to the side. I increased the length of the stick until the ball does not turn. At this point, the torque from the gravitational force on the stick is equal to the torque from the ball. I can use [Tracker Video Analysis](http://www.cabrillo.edu/~dbrown/tracker/) to find the lengths of the two wood sticks. The torque from each stick will be its gravitational weight times the perpendicular distance to the center of the turning ball.

In order to calculate the gravitational force, I need the mass of each “stick”. [From my previous post](http://blog.dotphys.net/2008/10/physics-of-fantastic-contraption-i/), I found that the mass density per length for sticks was

where mb is the mass of a ball and U is the diameter of a ball. I also need to find the horizontal distance from the center of the stick to the center of the ball. I will call the top stick 1 and the bottom 2. This gives:

Notice that stick 2 is connected at the same x-value as the ball, so I did not need to add the radius of the ball to its r value. Now I can calculate the total torque:

Although I do have an ok value for U in meters, I do not have a value for the mass of the ball, so no point in multiplying in the constant g. Anyway, let me test this. If this is true, how many balls could I hang right off the circle and lift? In that case, r would be 0.5 U (U is the diameter). So if the torque is around 3, I should be able to lift 6 balls (depending on the mass of string used). Let me try it.

I love it when a plan comes together. Actually, this was a little more than the weight of 6 balls, it also had the short length of water-sticks. But also, according to my calculation, this should not be able to lift 7 balls. Again, success.

# Physics of Fantastic Contraption I

One of my students showed me this game, [Fantastic Contraption](http://fantasticcontraption.com/). The basic idea is to use a couple of different “machine” parts to build something that will move an object into a target area. Not a bad game. But what do I do when I look at a game? I think – hey! I wonder what kind of physics this “world” uses. This is very similar to [my analysis of the game Line Rider](http://blog.dotphys.net/2008/09/the-physics-of-linerider/) except completely different.

Fantastic Contraption gives the unique opportunity to build whatever you want. This is great for creating “experiments” in this world.

The first step is to “measure” some stuff. The game includes three types of “balls” and two types of connectors. The balls are:

• Clockwise rotating
• Counterclockwise rotating
• Non-driven

Connectors:

• wood lines – these can not pass through each other
• water lines – these can pass through each other, but not the ground

First question: Do the different balls have the same mass? This can be tested by creating a little “balance”