# Hamiltonian Mechanics 1: A Microwave Oven Floating in Empty Space

This is part one in a series on Hamiltonian mechanics. You can find the other parts by going to Hamiltonian Mechanics for Computer Scientists.

In this part, we want to make things as simple as possible for ourselves, so we’ll begin with just a single object of study. Let’s say it’s … a microwave oven, and for some reason it’s floating in empty space. No other things around.

# What is A Microwave Oven?

We first need to define what we mean by a microwave oven. This is not exciting, but it is very important. A microwave oven is defined, wholly and entirely, by the following three characteristics11 Your next microwave oven purchase just got so much simpler, right? Just ask the salesman for the position, momentum and mass of the models they are demonstrating..

Position

$$q$$: Obviously, the microwave oven has a position in space. That’s pretty important. It’s also floating around, so its position depends on the time. We say that its position is a function of time.

We should call that function $$q(t)$$, but we are physicists, so we are lazy and careless and will just name it $$q$$, assuming that everyone telepathically understands that it depends on time. After all, it does make the notation slightly more convenient.

Momentum

$$p$$: The microwave oven will also have something called a momentum. The momentum of an object is a measure of “how firmly it is moving”.

I do realise how weird that sentence sounds. What is the firmness of movement? It's not an established term, just an intuitive description. Let me explain by example22 It does make sense, I promise!. If two tennis balls are moving, but one of them is moving faster than the other, then the faster one is moving more firmly. If a tennis ball and a car both are moving with the same speed, guess which one is moving more firmly!33 If you still need help, think of momentum as how serious your injuries would be if something collides with you. (Hint: it is the car.)

Anyway, the firmness of movement, or momentum, is also a function of time and it should be denoted $$p(t)$$, but again, phycisists, so, $$p$$.44 In case you didn’t know, yelling “phycisist!” is a valid defense against anything. We’ll talk more about this later.

Mass
$$m$$: You may think you know what this is, but don’t be too sure. We’ll get into it later.

These three characteristics are fundamental to an object. We cannot calculate these characteristics. We need to know these.

Besides these three properties that define the microwave oven, there are two additional quantities that are really imporant, so I’m going to mention them right away. Just keep in mind that these quantities are not defining, i.e. we can actually compute these numbers as long as we have the three above.

Kinetic Energy

$$T$$: The kinetic energy of an object may superficially seem very similar (or even equivalent) to the momentum, but they are different in important ways. We’ll get into the calculations later when you’ll see how they differ, but we can for the time being view kinetic energy as a measure of “how hard must my effort be to stop this thing from moving?”

We call this measure $$T$$, and it’s actually a function of the momentum $$p$$.55 So we should call it $$T(p)$$ but phycisists … In other words, for each object, we can calculate its kinetic energy if we know its momentum and a couple of constants.

Total Energy

$$\mathscr{H}$$: We assign the name $$\mathscr{H}$$ (that is a fancy script version of the upper-case letter H) to the total energy of an object. So far, we only know of the kinetic energy, so the total energy will equal the kinetic energy66 I’m careful not to write this as a formula, because as we will learn very soon, it’s not quite the whole truth yet., but we can imagine adding more energies to the object and all of those would be part of the calculation of $$\mathscr{H}$$.

This is actually a place where even physicists get something right. $$\mathscr{H}$$ depends on both position and momentum, and they normally write it as such, but we haven’t learned that yet so I’m just going to blame the physicists anyway and get away with sloppiness.

# Concrete Numbers

So, say we happen to know that for this microwave floating in space,

$p = 11$

and

$\mathscr{H} = T = 33.$

In other words, it moves with a firmness of 11 and its total energy is 33.77 These numbers aren’t very useful yet because we have nothing to compare them to. We can imagine that corresponds to it drifting by slowly, but we have no way of knowing.

Another name for mechanics is dynamics, i.e. how things change over time. Knowing the numbers for a static point in time is fairly useless.

We need more information.

# Law of Energy Change in Response to Momentum Change

How did the microwave oven even get there in the first place?

Maybe we’re guilty of space-littering. Maybe we pushed it out of our vessel. Early on in our attempt at hauling it overboard, it moved with a firmness of only 4.5, and had a kinetic energy of 5.2.88 Let’s pretend we don’t know how to calculate the kinetic energy, but we can measure it. (Not an entirely unlikely scenario.)

Let’s say we have collected a few of these measurements, and they look like this.

Now we know something!

I could ask, pretending to be surprised, “Why did both $$p$$ and $$T$$ change?” – but we already said that $$T$$ can be calculated from $$p$$, so it’s probably no surprise to you. Besides, it makes a lot of sense; when a thing starts moving more firmly, surely it must carry more energy.

So, for an object, when $$p$$ changes, $$\mathscr{H}$$ will change too. But it’s not obvious how much $$\mathscr{H}$$ will change. This number is different for different objects. And that number – how much $$\mathscr{H}$$ changes compared to the change in $$p$$ – that number can be expressed with mathematical symbols as

$\frac{\partial \mathscr{H}}{\partial p}.$

And, in a weird twist of fate, that relation is what we perceive as the speed of an object.

I’ll repeat that, because it’s fundamental.

The amount of change in the total energy of an object in response to a change in momentum of that same object turns out to be exactly the speed of the object.

This is actually one of the fundamental laws of physics, according to the Hamiltonian model.99 And look how fast we got here! With these fundamental theories it usually takes a long time to get to the point, but we’ve already started getting to the meat! We’ll call this equation the evolution of position, because it describes how the position of an object evolves with time.

Evolution of Position

.

$\frac{dq}{dt} = \frac{\partial \mathscr{H}}{\partial p}$

Here, you can read the left hand side1010 Okay, I hate that I have to do this, but you’re going to wonder anyway. What is the difference between $$d$$ and $$\partial$$? Not big, as far as we care. Just imagine they mean the same thing. as “how fast does the position change in response to the passage of time?” which is just a fancy way of saying “speed”.

So, repeating once more: we will perceive “the size of the response of the total energy when the momentum changes” as speed, or size of position change over time.

# Mystery

In more concrete terms, this means that

• If we find an object for which $$\mathscr{H}$$ changes a lot even when $$p$$ changes only very little, that is an object that will move very fast.
• If we find an object for which even dramatic changes in $$p$$ only causes small changes in $$\mathscr{H}$$, that object will move slowly.

You may notice a vague pattern lurking here. There appears to exist some class of objects where – even if they don’t move very firmly – they pack a lot of energy into their soft and flimsy movement. If they exist, they move very fast. Conversely, there could be objects of the opposite character, i.e. that move incredibly firmly with very little kinetic energy.

I think you sense what happens here. Hold on to that thought for a few more minutes.

# Speed Calculation

Well, we have

$\frac{dq}{dt} = \frac{\partial \mathscr{H}}{\partial p}$

which can be approximated by the average

$\frac{dq}{dt} \approx \frac{\Delta \mathscr{H}}{\Delta p} = \frac{27}{6} = 4.5.$

In other words, the actual change in total energy divided by the actual change in momentum between two points in time will give the average velocity between those points in time. Our microwave has had the average speed 4.5 between the observed moments.

# Mystery Solved: Mass

But let’s get back to the energy–momentum relation again. We discovered that some things only need a little more kinetic energy in order to move much more firmly, e.g. trains1111 A train can have a wimpy kinetic energy, but I’m sure we’d all agree that it’d still be moving very firmly, however slow it’s moving. Other things (like ping pong balls) need to go very, very, very fast1212 i.e. have lots of kinetic energy before you’d think of them as moving firmly.

What’s the mechanism behind that?

Mass.

Mass is sort of a “scaling factor” that determines how violently the momentum reponds to small changes in kinetic energy1313 we will see later a different way to look at mass, when we start measuring how hard we push things. An object which moves much more firmly in response to a tiny change of kinetic energy is said to have a large mass. On the flip side, an object where a tiny change of momentum results in a large change in kinetic energy is said to have a small mass.

# Calculation of Kinetic Energy

Knowing just the momentum and mass of an object, we can finally calculate its kinetic energy. It is calculated as1414 why is momentum given as an argument to $$T$$, while mass isn’t? Generally, we think of mass as a constant of the object, while the momentum may change over time.

$T(p) = \frac{p^2}{2m}$

Since, in our example, $$T=\mathscr{H}$$, we can conclude that

$\Delta T(p) = \frac{\Delta p^2}{2m}$,

or in other words, the average momentum and the average speed are related the way you expect them to. In our example:

$= \frac{9^2}{2m}$

$8m = 8^2$

$m = 8$

???

can with some mathematic trickery calculate the exact speed must be

$\frac{\partial T}{\partial p} = \frac{p}{m}$

and therefore, the mass of our microwave oven must be 21515 If you are retracing these calculations, be careful about what numbers you are using. When we calculated the average speed, we used the average momentum. That’s what you have to use when you figure out the mass.. So using the new knowledge of the mass, we can calculate the exact speed at the time we let go of the microwave, rather than the average. At the time of letting go, we had $$p = 12$$. That gives us

$\frac{\partial T}{\partial p} = \frac{12}{2} = 6$

Which means that while the average speed during the throw-away-your-microwave maneuver was 4, the actual, final speed when we let go is 6.

# Getting Our Microwave Oven Back

As soon as we realise what we’ve done, we’re likely to want to get our microwave oven back. So when does it come to a stop? In other words, when does its momentum become zero?

Assuming the microwave oven has a constant mass1616 you should assume that about things in general, the momentum would have to change for its speed to change, right?

Time to bring out basic law of the universe number two:

$\frac{dp}{dt} = -\frac{\partial \mathscr{H}}{\partial q}$

This says that the momentum will change opposite to the size of the total energy change in response to changes in position. It’s difficult to put into words. If the total energy of an object changes merely for the reason that it has changed position, then the momentum of the object will change with the same rate, but in the opposite direction.

For our microwave oven, that means that when—

But wait.

We have a formula for the total energy. It depends on the momentum, sure, but it does not depend on the position at all. In fact, we’ve barely mentioned the position. We have mentioned the rate of change of the position, but not the position itself. So how does it respond to changes in position?

Not at all.

It doesn’t.

This is another way of saying that, in empty space with nothing else around, there is physically no way to tell exactly where you are. There is no physical experiment you can perform that will tell you the difference between here and there. Position is simply not a variable in the equations of physics, at this point.

For our microwave oven, that means the momentum will not change1717 This is known as inertia. The total momentum must be conserved, whatever the cost. That’s why I describe it as “how firmly something moves”; you can stand on the tracks all you want – when the train comes, it will do what it can to preserve its momentum, and it has way more momentum than you do.. Ever again. It will not stop, it will not yield. It will keep going on and on and on for as long as it’s alone in empty space.

# Fixing the Runaway Microwave Oven Problem

In the next article, we will start working on a solution to the problem of the runaway microwave oven, by introducing an incentive for it to return to us.