## CSW's Ideal Gas

 LA home Computing MML  Glossary  Notes  Entropy   Gas   Gas

The physics of this two-dimensional gas (below) are reversible. Time can be run forwards and backwards. Energy is perfectly conserved.

T= pause=ms Entropy=
 (this version 29/6/2017, 7/2/2018)
'T' is the current time of the simulation, its clock.
'fwd', that is 'forward', makes 'T' increase.
'rev', that is 'reverse', makes 'T' decrease.
'pause' is the delay, in milliseconds, between time-steps.
'faster' and 'slower' decrease and increase 'pause' (within reasonable limits).
'Entropy' is the entropy of the velocity distribution of the particles,
that is the average amount of information (in nits, natural bits) required to state the velocity, (v, w), of one particle.
'reinit' reinitialises the simulation.
While the simulation is halted (only), it is possible to 'get' the state of a particular particle '#' and to 'set' (change) its state:
# ; (x, y); (v, w);
Run the simulation to T=0 and note the state of the gas. Now run the simulation to T=-40 or T=70, and 'stop'. Change the position (x, y) or velocity (v, w) of one particle by one unit (don't forget to 'set' it). What do you get at T=0 now?

### Origins

Chris Wallace showed that this artificial gas obeys many of the properties of real gases – see the Feathers on the Arrow of Time chapter in his book about MML.

### Entropy

The entropy that is displayed is the entropy of the velocity distribution. It can be seen that from a randomly selected state, the entropy is equally likely to be higher or lower in the next (or previous) state. However, if the gas is observed to be in a low entropy (ordered) state at time t, it will almost certainly be in a higher entropy state at time t+1, and the time-reversibility implies that it was almost certainly in a higher entropy state at time t-1.

### Determinism: 1-1 State Transitions

The physics of the gas are deterministic. Therefore the states will cycle  - over  a  v e r y  l o n g  period, N. So from this point of view the entropy of every state is the same, log(N).

### Calculations

Time and space are both quantized – positions and velocities have integer horizontal and vertical components and all calculations are done using integers. This is so that there are no rounding errors that would otherwise accumulate (there are no quantum theory effects). If exactly two gas particles – two molecules – arrive at the same location at the same time they interact. The interaction is such that momentum and energy are conserved. The former corresponds to their centre of gravity continuing at the same velocity after the interaction. The latter to their approach and departure velocities having the same magnitude and, as velocities have integer components, they must be solutions to Pythagorean triangles with the same hypotenuse.

© C.S.Wallace & L.Allison, 2007, 2017, 2018.

(The figures that illustrate the gas in CSW's book were generated by a C program which cannot be run via the web.)

www:
 The C++ Cookbook mastering the language
 ↑ © L. Allison, www.allisons.org/ll/   (or as otherwise indicated). Created with "vi (Linux)",  charset=iso-8859-1,   fetched Saturday, 18-Jan-2020 21:45:48 EST. Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off.