## Friday, July 31, 2009

### Massive collisions

I found this simulation of a two-dimensional gas very entertaining, and also relevant in light of Maxwell's use of the rotational symmetry argument in his derivation of the Maxwell-Boltzmann distribution. I thought it would be interesting to try to program this simulation in Python. And, if it turns out that we need to speed things up, it would provide an opportunity to explore those issues as well. I know this isn't Bioinformatics, but it is all part of a plan for me to improve my math skills. In fact, I think Bioinformatics would be better called Statistical Genetics. Unfortunately, some other folks have already appropriated the term.

To begin with, I needed to dig out Halliday & Resnick, and review the equations for collisions. There is a newer edition but I used my old book, which I re-purchased some years ago from Abebooks. I want to show the derivations of the equations for collisions between two particles in one and two dimensions. Here is a graphic to motivate us:

In the one dimensional case, of course, we do not have the angles θ and &phi. We just have masses M and m, and velocities before and after collision. These are usually designated v1i, etc. but I am going to use non-standard notation to reduce my confusion, and as a bonus, simplify the typing. We will label the velocities of the masses before collision as a (for M) and b (for m), while afterward they will be c (for M) and d (for m).

We use two of the great conservation principles of physics, for momentum and energy.

In one dimension (inelastic collision), we have:
 `(1) M a + m b = M c + m d(2) 1/2 M a2 + 1/2 m b2 = 1/2 M c2 + 1/2 m d2from (1): M a - M c = m d - m b(3) M (a - c) = m (d - b)from (2) M (a2 - c2) = m (d2 - b2)factor: M (a + c)(a - c) = m (d + b)(d - b)and divide by (3), assuming a ≠ c and b ≠ d: a + c = d + brearrange:(4) a - b = d - c `

Halliday & Resnick:
This tells us that in an elastic one-dimensional collision, the relative velocity of approach before collision is equal to the relative velocity of separation after collision.

 `(3) M (a - c) = m (d - b)Rearrange (4) to solve for d and substitute into 3: M (a - c) = m (a - b + c - b) M a - M c = m a - 2 m b + m cRearrange terms to group by velocity: (M - m) a + 2 m b = (M + m) c M - m 2mc = ----- a + ----- b M + m M + m`

We could also solve for d, but I will just assert that the following is true by symmetry:

 ` m - M 2Md = ----- b + ----- a M + m M + m`

(There is nothing special about m and M, so if we switch them as well as a and b, it should be OK).

Special cases of interest.

If the masses are equal, M = m and:
 `d = a and c = b`

The particles simply exchange velocities.

Another case is where M (say) is initially at rest, then a = 0 and

 ` 2m m - Mc = ----- b d = ----- b M + m M + m`

Now, for equal masses, then d = 0 and M simply acquires the velocity of m, while m stops abruptly.

However, if M is at rest and the masses are greatly unequal, (M >> m), then the velocity of M after the collision is still c ≈ 0, and d = -b, the small particle reverses its velocity. It just bounces off.

I'll do the 2D case in another post, and then move on to the simulation.