# Classical mechanics - particle in a well; Lagrangian and Hamiltonian

1. Apr 25, 2014

### Wobbles

1. The problem statement, all variables and given/known data

I'm working (self-study) through Goldstein et al, Classical Mechanics, 3rd Edition, and I'm currently stuck on Problem 8.11:

A particle is confined to a one-dimensional box. The ends of the box (let these be at $\pm l(t)$) move slowly towards the middle. By slowly we mean the speed of the ends is small when compared to the speed of the particle. Solve the following using Lagrangian formulation and then the Hamiltonian.

(a) If the momentum of the particle is $p_0$ when the walls are a distance $x_0$ apart, find the momentum of the particle at any later time assuming the collisions with the wall are perfectly elastic. Also assume the motion is nonrelativistic at any time.

2. Relevant equations

3. The attempt at a solution

I can solve this easily enough from standard Newtonian mechanics, but just can't get a handle on how to start from a Lagrangian or Hamiltonian viewpoint. My Newtonian approach is as follows.

Let $l(t)$ denote the distance of the walls from the centre of the box at time $t$; let $N(t)$ be the number of collisions between the particle and the walls of the box since $t=0$.

At time $t$, let the particle, of mass $m$, have velocity $\vec{v}(t)$. Denote the magnitude of the particle's momentum as a function of $l$ by $p(l)$, and as a function of $N$ by $P(N)$; at any given time, these two quantities have the same value.

Because collisions between the particle and the walls are elastic, at each collision, the magnitude of the particle's momentum increases by an amount $$\Delta P=-2m \frac{dl}{dt};$$as the collisions are occurring with a high frequency, we can approximate $P$ as a differentiable function with derivative equal to $\Delta P$.

The rate at which collisions between the particle and the ends of the box are occurring is
\begin{align} \frac{dN}{dt} &= \frac{1}{2l/\|\vec{v}\|} \\ &= \frac{\|m \vec{v}\|}{2lm} \\ &= \frac{p}{2lm}. \end{align}
Thus we have
\begin{align} \frac{dp}{dl} &= \frac{dP}{dN} \frac{dN}{dt} \frac{dt}{dl} \\ &= -2m \frac{dl}{dt} \frac{p}{2lm} \frac{dt}{dl} \\ &= - \frac{p}{l}, \end{align}
or
$$\frac{dp}{p} = -\frac{dl}{l}.$$
This has the solution $$\frac{p(l)}{p(l_0)} = \frac{l_0}{l},$$ or $$p(l) l = p(l_0) l_0.$$
Expressed in terms of the distance between the walls, $x = 2l$,
$$p(\frac{x}{2}) x = p(\frac{x_0}{2}) x_0.$$
Does anyone have any hints as to how I should approach this from both a Lagrangian and a Hamiltonian basis? I've been looking over this chapter for a month now and I just can't see how to apply these ideas to this problem from the start. It almost seems that one needs to solve the problem from a Newtonian standpoint to get the Lagrangian and Hamiltonian, but that seems like solving the problem after I've solved the problem.

2. Apr 25, 2014