## Saturday, August 1, 2009

### Results from modeling 1D collisions

We have a one-dimensional box with particles in it. They follow the rules for collisions we derived previously. If the masses are all the same, the particles simply exchange velocities, and that isn't very interesting. So our model has particles of two different masses (M/m = 2, 3 or 4 in the simulations I've run). The question is, what is the long-run distribution of velocities in the population of particles?

At the end of this post, I have listed the code I wrote. But I'm not going to go through it, for two reasons. First, I know you would be bored (me too). Second, it isn't very polished, and has a few issues. But the results give a picture of the distribution that I think must be correct. Maybe one of you can tell me if that's true or not.

We can run the simulation with the option to report lots of information as it runs. I always use the same names for common variables. I use v for "verbose", L for "list", D for "dictionary", and so on.

Here is some output from the code listing below with v=True. We show the particle positions in 40 bins, updating only when positions change, and print detailed info when something more interesting happens (reversal, collision). The particles are numbered and identified with the mass type 'm' or 'M'.

 62 .................4...1....2.....3.....5. 64 .................4...1....2....3......5. 65 .................4....1....2...3......5. 67 ..................4...1....2...3......5. 68 ..................4...1....2..3.......5. 70 ..................4....1....2.3.......5. 72 ...................4...1....2.3.......5. 73 ...................4...1....23........5. 74 ...................4...1....23.........5 75 ...................4....1....*.........5collide (i = 77){2M x = 29.3763 v = 0.2} {3M x = 29.0261 v = -0.2444}{2M x = 29.3763 v = -0.2444} {3M x = 29.0261 v = 0.2} 77 ....................4...1....*.........5 78 ....................4...1...23.........5 80 ....................4....1..23.........5 81 ....................4....1..2.3........5 82 .....................4...1.2..3........5 85 .....................4....12..3........5 86 .....................4....*....3.......5 87 ......................4...*....3.......5collide (i = 89){1m x = 26.792 v = 0.2} {2M x = 26.4429 v = -0.2444}{1m x = 26.792 v = -0.3926} {2M x = 26.4429 v = 0.0519} 91 ......................4..12.....3......5 92 .......................4.12.....3......5 93 .......................41.2.....3......5 96 .......................*..2......3.....5 41235 14235collide (i = 97){1m x = 23.6513 v = -0.3926} {4M x = 23.8064 v = 0.2}{1m x = 23.6513 v = 0.3975} {4M x = 23.8064 v = -0.1951} 97 .......................41.2......3.....5 14235 41235 99 .......................41..2.....3.....5 100 .......................4.1.2.....3.....5 101 ......................4..1.2......3....5

How do we test the code? This is a hard problem. To make a start, we can run a simulation with X (box size) and the number of particles very small, and look carefully whenever things change. Two other tests: in a 1D box, the order of particles should never change, and also the total kinetic energy should not change with time. The latter requirement is met by this code. However, the former invariant is occasionally broken. The code reports this when it occurs. In the line that starts "96" above, we see "41235 14235", which indicates that the order switched as shown. On the following cycle it switched back, but this doesn't always happen. It gets harder when there are 3 or more particles within the same small interval. I have not solved this problem, but these "quantum"-like events are rare, and I believe they don't invalidate the statistic we are going to measure. (I can't prove that, of course, but the numbers are quite small).

I've run the simulation with more particles and a slightly larger space to make the velocities change more frequently. For these tests, I assigned the same velocity to every particle. I want to show you statistics for these runs, with various mass ratios as mentioned above. Two things are of interest: the standard deviation of the distribution of velocities, and the histograms. Here are the results (in R) for the stdevs:

 #M = 2m> sd(m)[1] 0.2467407> sd(M)[1] 0.1719307#M = 3m> sd(m)[1] 0.2849638> sd(M)[1] 0.1620676#M = 4m> sd(m)[1] 0.3177323> sd(M)[1] 0.1573599

I will have to look up the values that statistical mechanics theory predicts. It seems like a good guess that the sd of the small particles goes like the sd of the large particles * √M/n. But, I would have to do some other tests to be sure. For example, we have a number of m and M particules that is random, but we did random.seed(157), so it is actually set to one specific value. Finally, notice that the distributions are all normal. I hope this does not come as a surprise.

And here are the plots.
M/m = 2

M/m = 3

M/m = 4