From the notes: Two masses on a string going through a hole

Two masses on a string going through a hole.  Yeah, that's the stuff we learn about in physics class.  Anyway, this is the first in a (possibly) series of posts where I work out some problem from my lecture notes or homework.  The reason for doing this is because 1) there's a (small) chance it will be useful or interesting to someone else, and 2) the drawn out process of typing this up and thinking about how to explain it helps me study.

Figure 1, two masses on a string going through a hole.

 

Consider two masses connected by a string (figure 1).  The ideal string passes through a hole in a plate which is parallel to the x-y plane.  One mass, m is sitting on the plate and is free to rotate about the hole with no friction.  The second mass, M, is hanging below the plate and moves only in the vertical z direction under the influence of gravity.   The total length of the string is l and we define r ands to be the distances between the hole and m and M, respectively, so that l=r+s.

We can use Lagrangian mechanics to explore the system.  In Cartesian coordinates, the total kinetic energy is the sum of the kinetic energy of each mass:

T=\frac{1}{2}m(\dot{x_{m}}^2+\dot{y_{m}}^2+\dot{z_{m}}^2)+\frac{1}{2}M(\dot{x_{M}}^2+\dot{y_{M}}^2+\dot{z_{M}}^2)      (1)

where we've used the dot notation for time derivatives.

Considering that m is only rotating about the z axis and M is moving only vertically, it makes sense to consider switching to a more reasonable coordinate system.  We can transform to cylindrical coordinates with:

x_{m}=r\cos\theta

y_{m}=r\sin\theta

z_{m}=0

x_{M}=y_{M}=0

z_{M}=-s=-(l-r)

Taking derivatives of these with respect to time and inserting them into (1), we can rewrite the kinetic energy in cylindrical coordinates as

T=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2

where r and \theta are now the generalized coordinates of the system.  The potential energy depends only on the height of M since m is confined to sit on the plate, so

V=-Mg(l-r)

With T and V we can write the Lagrangian L=T-V:

L=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2+Mg(l-r)

We see that \theta does not appear in the Lagrangian, which means that the generalized momentum corresponding to \theta is a conserved quantity:

p_{\theta}=\frac{\partial L}{\partial \dot{\theta}}=mr^2\dot{\theta}=rmv_m=a     (2)

a can be identified as the angular momentum of mass m.

We can also look at the total energy E=T+V:

E=\frac{1}{2}m(\dot{r}^2+(r\dot{\theta})^2)+\frac{1}{2}M\dot{r}^2-Mg(l-r)     (3)

From (2) we see that \dot{\theta}=\frac{a}{mr^2}.  Substituting this in (3) gives

E=\frac{1}{2}m\dot{r}^2+\frac{a^2}{2mr^2}+\frac{1}{2}M\dot{r}^2-Mg(l-r)

We can separate the constants on the left hand side and use the remaining terms to define an effective potential V'(r):

\frac{E+Mgl}{m+M}=\frac{1}{2}\dot{r}^2+\frac{1}{2}\frac{a^2}{m(m+M)r^2}+\frac{Mgr}{m+M}

V'(r)=\frac{1}{2}\frac{a^2}{m(m+M)r^2}+\frac{Mgr}{m+M}

Imagine m is rotating about the hole.  This means there will be some centripetal (or centrifugal, depending on your reference system) acceleration which will pull the hanging mass M up.  We want to find r such that the force is an extremum.  In other words:

\frac{\partial V'}{\partial r}=0

Setting the derivative equal to zero gives

\frac{-a^2}{m(m+M)r^3}+\frac{Mg}{m+M}=0

And solving for r:

r=\sqrt[3]{\frac{a^2}{mMg}}

which gives the radius of "orbit" of mass m about the hole for a given angular momentum a such that M remains suspended in the air.

 

Anti Rage-Induced-Accidental-Disconnect Minecraft Client Mod

We've all been there: You're playing on your favorite Minecraft PvP server, ready to get revenge on the player who just killed you, when suddenly, you're staring blankly at Minecraft's title screen.  How could such a thing happen?  Well, maybe Mr. McMillan has something to say about the matter:

 

Yes, Mr. McMillan, precisely.  The death screen GUI has "Respawn" and "Title screen" buttons that are way too close to each other, resulting in players sometimes unintentionally leaving the game when they actually want to respawn.  Now, this isn't something that happens all the time, but it happens occasionally and it's annoying.

So, in the first and only installment of the new (and old, by the time you read this) series "Weekly 1 Minute Minecraft Mods", we can fix the problem.

We will change this:

 

Before

into this:

 

After

(Texture pack is the beautiful Plast Pack.)

The new layout isn't pretty, but in the case of PvP I'll definitely take function over fashion (with the exception of gold pants).

Making the Mod

You need to download and install Minecraft Coder Pack (MCP).  There is a lot of information about how to do this online.

Once MCP is ready to go, find the file "GuiGameOver.java" in the minecraft/src subdirectory.  In this file, there are only two lines we need to modify:

1
2
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 72, I18n.getString("deathScreen.respawn")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 96, I18n.getString("deathScreen.titleScreen")));

These files add the "Respawn" and "Title screen" buttons.  The only thing we need to change is the third argument to the GuiButton constructor.  We can shift the buttons up and down by changing the values of 72 and 96, with larger values corresponding to a lower position on the screen.  The "after" photo shown above uses values of 70 and 120:

1
2
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 70, I18n.getString("deathScreen.respawn")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 120, I18n.getString("deathScreen.titleScreen")));

Once this is changed, save it and then proceed as you would with any other mod (recompile, reobfuscate, and drop the class in the appropriate Minecraft .jar file after backing everything up, etc.). Now you can crank up your mouse's sensitivity and fail to unintentionally disconnect from your favorite server with ease!

Note that this does involve changing core Minecraft files and so may result in issues if there is an overlap with another mod.  Also, it seems this won't be an issue when 1.7 comes out.