```
GASLAB: MAXWELL'S DEMON

WHAT IS IT?
-----------
This program illustrates a famous thought experiment which raised important
issues about the nature of entropy.  In 1871, James Clerk Maxwell imagined a
situation where a very small and nimble being could, by opening and closing a
valve between two gas-filled chambers, allow only faster molecules to go through
one way and only slower molecules to go through the other.  By doing this, the
being (later called a demon) could raise the temperature of one chamber and lower
the temperature of the other, without the expenditure of work.  This was a
violation of the Second Law of Thermodynamics, and he asserted that this could
not actually occur.  The implications of this puzzle have continued to be central
to thermodynamics, entropy, and information theory up to the present time.

The collision and bouncing rules for this model are the same as in the other
GasLab models.  The setup is the same as "Two-Gas".  What is added is a "valve".
It transports fast molecules from the upper to the lower chamber when they arrive
at the turquoise strip, and slow molecules from the lower to the upper chamber
when they arrive at the violet strip.

HOW TO USE IT
-------------

Set the total number of molecules (NUMBER), their initial speed (INITSPEED) and
mass (INITMASS), and the THRESHOLD sliders.  The threshold is how much faster or
slower than the average speed a molecule must be going to be transferred to the
other chamber by the "valve". Initialize the model by pressing SETUP, and press
GO to run it.

DEMON?:  If this equals 1, the valve is operating.  If it equals 0, the valve
does nothing.

CLOCK:  number of ticks that have run. AVG-SPEED:  average speed of all the
molecules. AVG-SPEED-TOP: average molecular speed in the upper chamber.
AVG-SPEED-BOTTOM: average molecular speed in the lower chamber.

GRAPHS: MOLECULE COUNT (1): the number of molecules in the upper (turquoise) and
lower (violet) chambers. AVG ENERGIES (2): the average energy of the molecules in
the upper and lower chambers.  This is calculated as the average of 1/2 mv^2. AVG
SPEEDS (3):  the average speeds of the molecules in the upper and the lower
chambers.

THINGS TO NOTICE
----------------

Watch the "valve" carefully. Can you see fast (red) molecules jump downward and
slow (blue) molecules jump upward when they run into the valve?

What happens to the average energies and speeds in the upper and lower chambers?
What about the molecule count?  Do the values settle down after a long time?

THINGS TO TRY
-------------

Change the valve threshold.  Does it change the rate of evolution of the model or
its eventual result?

EXTENDING THE MODEL
-------------------

What happens if there are molecules of different masses? (See Two Gas model.)

How would you calculate the pressure in each box?  (See Piston models.)  Do they
remain equal?

If such a valve were possible, could "free energy" be gotten from the two
chambers at different temperatures?

STARLOGOT FEATURES
-----------------
You can find specific values on the graphs by clicking the mouse on the point
whose value you would like.  The coordinates of that point are shown in blue.

Notice the 'constants' list, located near the top of the procedures window, which
defines the constants 'amplitude', 'tower-x' and 'tower-y'. StarLogoT constants
make it easy to set aside special keywords, similar to 'screen-size-x'. These
labels can represent values that you don't want procedurally redefined, but would
like to quickly change in-between runs of the model. Constants are usable by
anything: turtle, patch, or observer, and use less memory than normal global
variables. They are also slightly quicker to access than 'globals' reporters.

RELATED MODELS
---------------
Look at the other GasLab models.

```