Explore how individual particle motion connects to the bulk properties of a gas. Predict first, change one condition, and compare readouts at matching calculation steps. Blue dots are particles, violet arrows show velocity, and amber marks outside the wall indicate collisions.
1. Reading position, velocity and speed
An arrow points in the direction of motion; its length is proportional to speed. Between wall hits, a particle covers equal distances in the same direction. Increasing calculation step k by one gives:
\vec r_{k+1}-\vec r_k=\vec v_k
Speed is the magnitude of velocity. A change of direction changes velocity even when speed stays constant. Vector scale multiplies the one-step displacement to draw the arrow. Dot size and vector scale change the drawing, not particle size in the model or its motion.
Try Set count to 10, distortion to 0, and both speed endpoints to 0.06. Choose a particle away from the wall and advance one step at a time. Compare the arrow direction with displacement and compare successive travel distances.
Check Changing playback from 0.5× to 2× looks faster, but position, average speed and wall hits at the same frame stay the same. Distinguish playback rate from particle speed.
2. Elastic reflection changes direction
At a stationary smooth wall, the normal velocity component reverses and the tangential component remains unchanged. Angles of incidence and reflection are measured from the local normal.
v'_n=-v_n,\qquad v'_t=v_t
|\vec v\,'|=|\vec v|
For constant mass, kinetic energy E_k=\frac{1}{2}mv^2 is conserved. Momentum is a vector, so changing direction changes momentum. Because the wall exerts a force, total momentum of the particles alone need not be conserved.
Try With the settings from section 1, pause when a particle approaches the wall and single-step through its collision. Compare arrow length and direction before and after. Include an oblique impact.
Numerical limit The code tests whether the next position lies outside the wall rather than solving the exact contact time. At high speeds or intricate walls, the apparent reflection location may differ from the true contact point.
3. Is average speed the same as temperature?
The readout adds the speeds v_i of all N particles and divides by count. Opposite directions still contribute positive speeds. This differs from mean velocity \langle\vec v\rangle, which includes direction.
\langle v\rangle=\frac{1}{N}\sum_{i=1}^{N}v_i
Kinetic energy depends on mean squared speed \langle v^2\rangle, generally different from the square of mean speed \langle v\rangle^2. Root-mean-square speed is v_\mathrm{rms}=\sqrt{\langle v^2\rangle}.
Two-particle example Speeds 0.05 and 0.15 have the same mean, 0.10, as two speeds of 0.10. Their mean squared speeds are 0.0125 and 0.0100, respectively. Equal masses therefore give different mean kinetic energies. These numbers use model units.
Connection to kinetic theory For a three-dimensional ideal gas of equal-mass particles in thermal equilibrium, translational motion relative to the bulk flow obeys:
\frac{1}{2}m\langle v^2\rangle=\frac{3}{2}k_\mathrm{B}T
Here k_\mathrm{B} is Boltzmann's constant and T is absolute temperature. The factor 3 comes from three spatial directions. This 2D model has no specified mass or SI time scale and does not create an equilibrium distribution, so its average-speed readout cannot be converted directly to temperature.
4. An experiment that doubles speed
Set up Use 50 particles, distortion 0, 6 wrinkles, seed 1 and 1000 total steps. Run A uses speed range 0.04–0.08; run B uses 0.08–0.16. Keep all other conditions and playback rate fixed.
Record In each run, note average speed and wall hits at frames 200, 400, 600, 800 and 1000. Average the five collision readouts. Changing a condition regenerates the recording and pauses at frame zero.
Predict and explain Keeping count, container and seed fixed while doubling both speed endpoints doubles each particle's initial speed. Mean speed is about twice as large; for equal masses, each particle's kinetic energy is four times as large. Reaching walls sooner also tends to increase the long-time collision frequency.
A particular 100-step window need not contain exactly twice as many hits. Arrival times, directions, finite particle count and the approximate wall calculation matter. Compare several intervals to judge the trend.
5. Particle count and statistical fluctuations
Set up Fix distortion at 0, wrinkles at 6, seed at 1 and both speed endpoints at 0.06. Compare counts of 50 and 100. Record wall hits at frames 200, 400, 600, 800 and 1000 in each run.
Predict Mean speed stays near 0.06 because every particle has that speed. More particles generally give more total wall hits. Hits do not occur at perfectly regular intervals, so successive 100-step counts need not be equal.
Compare Average the five collision readouts, then divide that average by particle count as well. The first quantity is the total hit frequency; the second is the mean hit frequency per particle. With the same container and speed, the per-particle values should be of similar size.
Read the window correctly Frame 200 counts hits from step 100 to 200; frame 400 counts steps 300 to 400. These windows do not overlap. Before step 100, the shorter available interval is normalized to 100 steps, so fluctuations can appear larger.
With random conditions, more particles or a longer observation generally reduce relative fluctuations. Do not infer a universal result from one short seeded recording: repeated paths in a circular container can also correlate observations across time.
6. Pressure comes from momentum transfer
When a particle reflects, it delivers an impulse to the wall. For mass m and incident normal speed |v_n|, the magnitude of normal momentum delivered by one elastic hit is:
\Delta p_n=2m|v_n|
At equal speed, a nearly head-on hit transfers more normal momentum than a grazing hit. Equal collision counts therefore do not imply equal pressures.
Connection to a 3D gas Add the normal momentum delivered to a wall patch of area A over time \Delta t to find its average pressure:
P=\frac{\sum\Delta p_n}{A\,\Delta t}
For an equilibrium ideal gas at fixed count and volume, doubling all speeds increases both hit frequency and momentum per hit, giving four times the pressure. This is a kinetic-theory prediction, not a pressure measurement made by this display.
Think What would you need beyond hit count to calculate pressure? Particle mass, normal velocity components, wall size and a physical time scale. The current readout measures collision frequency only.
7. Container shape, seed and reproducibility
Zero distortion gives a circle. Distortion and wrinkle count alter local wall normals and therefore reflected paths. Even at equal speed, distances to the next wall and collision times can change.
Try Use 10 particles, speed range 0.06–0.06, 6 wrinkles and seed 1. Compare distortions 0 and 0.20. Observe reflection directions, then restore the original conditions and check whether the layout at frame 300 repeats.
Control variables carefully A seed fixes the random-number sequence, but changing shape can change which candidate starting positions are accepted inside the container. Wrinkle count also affects random-number use. A shape comparison is therefore not guaranteed to start with identical particle positions. Restoring every condition reproduces the same recording.
Caution Distortion is not a volume-only control. Container area, perimeter and reflection directions can change together. This comparison alone does not verify Boyle's law.
8. What the model can and cannot establish
What you can examine Uniform straight-line motion between walls; changing velocity direction with conserved speed in elastic reflection; how count, speed and shape affect collision frequency; and how seeded random conditions reproduce an experiment.
Omitted processes No interparticle collisions or attraction, gravity, heat transfer or work by moving walls is calculated. Overlapping dots do not represent an interparticle collision. Initial speeds are uniform within the selected interval, and wall reflection nearly preserves each particle's speed. The system therefore does not spontaneously approach a Maxwell speed distribution or thermal equilibrium.
Extension To study equilibration, add momentum and energy exchange between particles. To study heating by compression, add a moving wall and its energy transfer. Complicated motion on screen does not establish that these processes are present.
Explain it yourself ① Why can velocity change at a wall while speed stays constant? ② Can equal mean speeds give different mean kinetic energies? ③ Why does hit count alone not determine pressure? ④ Which changes the calculated trajectories: playback rate, vector scale or particle speed?
Answer guide ① Only the normal component reverses sign. ② A mean and a mean square differ. ③ Impulse, wall size and time information are also needed. ④ Particle speed changes trajectories; playback rate and vector scale change their presentation.