# Kinetic theory of gases
<!-- MICROSIMGEN:BEGIN v1.7 — generated by g08_place_microsims.py; three.js first (§15); do not hand-edit inside -->
## Microsims — three.js
### Kinetic theory of gases (three.js)
<div class="microsim-player">
<iframe src="https://wikitube-3d-microsims.netlify.app/Kinetic_theory_of_gases.html" width="100%" height="620" frameborder="0" loading="lazy" sandbox="allow-scripts allow-same-origin" title="Kinetic theory of gases — three.js microsim"></iframe>
</div>
**Open it full-screen:** [Kinetic_theory_of_gases.html](https://wikitube-3d-microsims.netlify.app/Kinetic_theory_of_gases.html) · library `threejs` · route `microsim/threejs/`
## Microsims — p5.js
### Kinetic theory of gases (p5.js)
<div class="microsim-player">
<iframe src="https://editor.p5js.org/sciencenibber/full/7gb4l972L" width="100%" height="480" frameborder="0" loading="lazy" sandbox="allow-scripts allow-same-origin" title="Kinetic theory of gases — p5.js microsim"></iframe>
</div>
*Hard disks collide elastically in a piston chamber; slam the piston to heat the gas and watch the live speed histogram relax to Maxwell–Boltzmann.*
**Open in the editor:** [▶ fork this sketch](https://editor.p5js.org/sciencenibber/sketches/7gb4l972L) · library `p5js`
### Related microsims
Live sims on neighbouring articles — 1 of them inside this article's own Wikipedia link tree:
- [[Entropy]] *(in tree)*
- [[Binding_energy]]
- [[Second_law_of_thermodynamics]]
*Sim hosted off-article; the article owns the reference, not the runtime (WIKI_RULES §10.4). Placed by `g08_place_microsims.py`.*
<!-- MICROSIMGEN:END -->
## Microsim
**Editor URL:** `<paste editor URL after save>`
**Description (100 words):**
A piston chamber holds up to 320 hard disks with exact elastic collisions; color encodes speed. Three walls are thermal — they re-emit particles from the wall temperature's Boltzmann distribution — and the fourth is a draggable piston: slam it inward and the gas visibly heats, then re-equilibrates. The right panel accumulates the live speed [[Histogram|histogram]] against the exact 2-D Maxwell–Boltzmann curve, so the reader watches the distribution emerge from collisions. A mix toggle splits light and heavy species — same temperature, different curves: equipartition made visible. A gauge integrates piston impacts and reports PV/NkT ≈ 1.00, the ideal gas law emerging from mechanics.
### Parameters
| Parameter | Meaning | Control in microsim |
|---|---|---|
| *T wall* | Thermal-wall (thermostat) temperature | slider, 100 → 1000 K |
| *N* | Particle count | slider, 40 → 320 |
| piston | Volume; fast compression heats the gas | mouse drag on handle |
| mix | 25% heavy species (m = 4) on/off | button / `[2]` |
| reset hist | Clear the histogram EMA | button / `[r]` |
| run/pause | Freeze the simulation | `[space]` |
### Canonical source
- **Canonical source:** [`Microsims/Kinetic_theory_of_gases.js`](Microsims/Kinetic_theory_of_gases.js) — p5.js global mode, 720×520 canvas.
- **p5.js Web Editor:** save the sketch with the name `Kinetic_theory_of_gases`, then paste the resulting URL here — it is an opaque id, not slug-based.
```js
// =====================================================================
// Kinetic_theory_of_gases.js -- Wikitube microsim
// Article: Kinetic theory of gases
// en.wikitube.io/wiki/Kinetic_theory_of_gases
// Room: Chemistry (Engineering sub-room) Pattern: J (particle
// system) + H (histogram panel) + K (PV=NkT gauge)
// ---------------------------------------------------------------------
// Idea: statistical mechanics, emerging live.
//
// 1. A 2-D chamber holds up to 320 hard disks with elastic
// particle-particle collisions (exact impulse exchange along the
// contact normal, mass-weighted). Color encodes speed: cold blue
// -> hot orange -> white.
//
// 2. The left, top, and bottom walls are THERMAL WALLS at the
// temperature set by the T slider: a particle striking them is
// re-emitted with velocity sampled from the wall's Boltzmann
// distribution (Rayleigh normal component, Gaussian tangential).
// This is the physically correct thermostat -- no velocity
// rescaling tricks.
//
// 3. The right wall is a DRAGGABLE PISTON. Compress slowly and the
// density rises; slam it fast and particles rebound from the
// moving wall with v -> 2u - v, heating the gas adiabatically.
// The kinetic temperature readout rises, then relaxes back to
// the wall temperature as the thermal walls re-equilibrate it.
//
// 4. The right panel accumulates the live SPEED HISTOGRAM (per-bin
// exponential moving average) against the exact 2-D
// Maxwell-Boltzmann curve
//
// f(v) = (m / kT) * v * exp(-m v^2 / 2 k T)
//
// (a 2-D gas gives the Rayleigh form -- v^1 prefactor -- rather
// than the 3-D v^2 form; the panel is labeled honestly.)
// Watching the bars converge onto the curve IS the lesson:
// Maxwell-Boltzmann is not an assumption, it is what collisions
// do to any initial condition.
//
// 5. The [2] key / mix button splits the gas into a light species
// (m = 1) and a heavy species (m = 4, drawn larger). At thermal
// equilibrium both have the same temperature but different speed
// distributions -- two histograms, two curves, one T. That is
// equipartition, visible.
//
// 6. A pressure gauge integrates momentum transfer on the piston
// face. With V from the piston position and T from mean kinetic
// energy, the readout PV / NkT hovers around 1.00 -- the ideal
// gas law emerging from mechanics, with honest fluctuations.
//
// Canonical equations rendered in the bottom-right HUD:
//
// f(v) = (m/kT) v exp(-m v^2 / 2kT) (2-D Maxwell-Boltzmann)
// P V = N k T (k = 1 sim units)
//
// Visual layout (720 x 520 canvas):
// * top-left: HUD title + en.wikitube.io subtitle
// * top-right: control hints
// * left: chamber with piston (drag the handle)
// * right: speed histogram + theory curve, then readouts
// * bottom: sliders (wall T, N) + mix / reset-histogram
// * bottom HUD: parameter readout (left), equations (right)
//
// Conventions (Wikitube Betterfire Standard v0):
// * single ARTICLE constant, p5.disableFriendlyErrors = true
// * every text() string literal is ASCII; non-ASCII in comments only
// * Energy-room palette; sliders positioned and sized explicitly
// * controls read once at the top of draw() into named locals
// * no external assets, no audio, no eval, no storage
// =====================================================================
const ARTICLE = 'Kinetic_theory_of_gases';
const TITLE = ARTICLE.replace(/_/g, ' ');
const WIKITUBE_URL = 'en.wikitube.io/wiki/' + ARTICLE;
const EDITOR_NAME = ARTICLE; // save name in p5js editor
p5.disableFriendlyErrors = true;
// ----- Energy room palette ---------------------------------------------
const BG = 18;
const FG = 240;
const DIM = [240, 240, 240, 140];
const HOT = [220, 110, 60];
const COLD = [60, 130, 220];
const GAUGE = [120, 220, 140];
const ACCENT = [200, 100, 220];
const STRUCT = [120, 130, 150];
const TRAJ = [240, 220, 80];
const SCRATCH = [120, 120, 120, 90];
// ----- Chamber geometry -------------------------------------------------
const CH_X0 = 50, CH_Y0 = 100; // fixed walls
const CH_Y1 = 420;
const PISTON_MIN = 200, PISTON_MAX = 340; // piston x range
const HANDLE_W = 14;
// ----- Physics ----------------------------------------------------------
// k = 30 px^2 s^-2 K^-1 in sim units so T = 300 K gives thermal speeds
// around 130 px/s for m = 1. T readouts divide back by the same k.
const K_B = 30;
const M_LIGHT = 1, M_HEAVY = 4;
const R_LIGHT = 4, R_HEAVY = 6;
const HEAVY_FRACTION = 0.25; // when the mix is on
// ----- Histogram panel --------------------------------------------------
const HX = 390, HY = 100, HW = 305, HH = 230;
const NBINS = 24, V_MAX = 420; // px/s domain of the histogram
// ----- State ------------------------------------------------------------
let parts = []; // {x,y,vx,vy,m,r,heavy}
let pistonX = 320;
let pistonV = 0; // measured piston speed (px/s)
let dragPiston = false, lastPistonX = 320;
let histLight, histHeavy; // EMA bins
let pSmooth = 0; // smoothed pressure
let impulseAcc = 0; // piston momentum transfer this frame
let mixOn = false, paused = false;
let sliderT, sliderN, buttonMix, buttonHist;
// =====================================================================
// setup
// =====================================================================
function setup() {
createCanvas(720, 520);
pixelDensity(2);
textFont('system-ui');
histLight = new Array(NBINS).fill(0);
histHeavy = new Array(NBINS).fill(0);
// Wall temperature: 100 .. 1000 K.
sliderT = createSlider(100, 1000, 300, 10).position(70, 455).size(130);
// Particle count: 40 .. 320.
sliderN = createSlider(40, 320, 180, 10).position(240, 455).size(110);
buttonMix = createButton('mix: off').position(380, 455).size(80, 22);
buttonMix.mousePressed(toggleMix);
buttonHist = createButton('reset hist').position(470, 455).size(85, 22);
buttonHist.mousePressed(resetHist);
seedParticles(180);
}
function toggleMix() {
mixOn = !mixOn;
buttonMix.html(mixOn ? 'mix: on' : 'mix: off');
seedParticles(sliderN.value());
resetHist();
}
function resetHist() {
histLight.fill(0);
histHeavy.fill(0);
}
function seedParticles(n) {
parts = [];
const T = sliderT ? sliderT.value() : 300;
for (let i = 0; i < n; i++) {
const heavy = mixOn && i < n * HEAVY_FRACTION;
const m = heavy ? M_HEAVY : M_LIGHT;
const s = Math.sqrt(K_B * T / m);
parts.push({
x: random(CH_X0 + 10, pistonX - 10),
y: random(CH_Y0 + 10, CH_Y1 - 10),
vx: randomGaussian(0, s),
vy: randomGaussian(0, s),
m: m, r: heavy ? R_HEAVY : R_LIGHT, heavy: heavy
});
}
}
// =====================================================================
// draw
// =====================================================================
function draw() {
const T_wall = sliderT.value();
const N_want = sliderN.value();
if (parts.length !== N_want) seedParticles(N_want);
const dt = Math.min(deltaTime / 1000, 0.02);
if (!paused) {
// piston velocity estimate (for moving-wall reflection)
pistonV = (pistonX - lastPistonX) / Math.max(dt, 1e-4);
lastPistonX = pistonX;
impulseAcc = 0;
const SUB = 2;
for (let s = 0; s < SUB; s++) step(dt / SUB, T_wall);
// pressure on the piston face: force / length (2-D pressure)
const pInst = impulseAcc / Math.max(dt, 1e-4) / (CH_Y1 - CH_Y0);
pSmooth = lerp(pSmooth, pInst, 0.04);
accumulateHistogram();
}
background(BG);
drawChamber();
drawParticles();
drawHistPanel();
drawReadouts(T_wall);
drawSliderLabels(T_wall, N_want);
drawHUD();
drawHints();
drawBottomHUD(T_wall);
}
// =====================================================================
// step -- advance particles: walls, piston, pairwise collisions.
// =====================================================================
function step(dt, T_wall) {
for (const p of parts) {
p.x += p.vx * dt;
p.y += p.vy * dt;
// Thermal walls: left, top, bottom. Re-emit from the wall's
// Boltzmann distribution: normal component Rayleigh, tangential
// Gaussian, both with scale s = sqrt(kT/m).
const s = Math.sqrt(K_B * T_wall / p.m);
if (p.x - p.r < CH_X0) {
p.x = CH_X0 + p.r;
p.vx = rayleigh(s); // inward (+x)
p.vy = randomGaussian(0, s);
}
if (p.y - p.r < CH_Y0) {
p.y = CH_Y0 + p.r;
p.vy = rayleigh(s);
p.vx = randomGaussian(0, s);
}
if (p.y + p.r > CH_Y1) {
p.y = CH_Y1 - p.r;
p.vy = -rayleigh(s);
p.vx = randomGaussian(0, s);
}
// Piston: specular, moving-wall corrected. Records impulse.
if (p.x + p.r > pistonX) {
p.x = pistonX - p.r;
const vNew = 2 * pistonV - p.vx;
if (p.vx > pistonV) { // approaching the face
impulseAcc += p.m * Math.abs(p.vx - vNew);
p.vx = vNew;
}
}
}
// Pairwise elastic hard-disk collisions (brute force; N <= 320).
for (let i = 0; i < parts.length; i++) {
const a = parts[i];
for (let j = i + 1; j < parts.length; j++) {
const b = parts[j];
const dx = b.x - a.x, dy = b.y - a.y;
const rr = a.r + b.r;
const d2 = dx * dx + dy * dy;
if (d2 > rr * rr || d2 === 0) continue;
const d = Math.sqrt(d2);
const nx = dx / d, ny = dy / d;
// separate overlap
const overlap = rr - d;
const tot = a.m + b.m;
a.x -= nx * overlap * (b.m / tot);
a.y -= ny * overlap * (b.m / tot);
b.x += nx * overlap * (a.m / tot);
b.y += ny * overlap * (a.m / tot);
// elastic impulse along the normal
const rvn = (b.vx - a.vx) * nx + (b.vy - a.vy) * ny;
if (rvn < 0) {
const jimp = -2 * rvn / (1 / a.m + 1 / b.m);
a.vx -= jimp * nx / a.m; a.vy -= jimp * ny / a.m;
b.vx += jimp * nx / b.m; b.vy += jimp * ny / b.m;
}
}
}
}
// Rayleigh-distributed positive speed with scale s.
function rayleigh(s) {
return s * Math.sqrt(-2 * Math.log(Math.max(random(), 1e-9)));
}
// =====================================================================
// Histogram accumulation (per-species EMA).
// =====================================================================
function accumulateHistogram() {
const instL = new Array(NBINS).fill(0);
const instH = new Array(NBINS).fill(0);
let nL = 0, nH = 0;
for (const p of parts) {
const v = Math.hypot(p.vx, p.vy);
const b = Math.min(NBINS - 1, Math.floor(v / V_MAX * NBINS));
if (p.heavy) { instH[b]++; nH++; } else { instL[b]++; nL++; }
}
for (let i = 0; i < NBINS; i++) {
histLight[i] = lerp(histLight[i], nL ? instL[i] / nL : 0, 0.05);
histHeavy[i] = lerp(histHeavy[i], nH ? instH[i] / nH : 0, 0.05);
}
}
// Kinetic temperature from mean kinetic energy (2-D: <KE> = k T).
function kineticT() {
if (!parts.length) return 0;
let ke = 0;
for (const p of parts) ke += 0.5 * p.m * (p.vx * p.vx + p.vy * p.vy);
return ke / parts.length / K_B;
}
// =====================================================================
// drawing
// =====================================================================
function drawChamber() {
// chamber interior
noStroke(); fill(24, 28, 36);
rect(CH_X0, CH_Y0, pistonX - CH_X0, CH_Y1 - CH_Y0);
// fixed walls (thermal) tinted by wall temperature
const wt = map(sliderT.value(), 100, 1000, 0, 1);
const wr = lerp(COLD[0], HOT[0], wt);
const wg = lerp(COLD[1], HOT[1], wt);
const wb = lerp(COLD[2], HOT[2], wt);
noFill(); stroke(wr, wg, wb); strokeWeight(3);
line(CH_X0, CH_Y0, CH_X0, CH_Y1);
line(CH_X0, CH_Y0, pistonX, CH_Y0);
line(CH_X0, CH_Y1, pistonX, CH_Y1);
// piston face + handle
stroke(...STRUCT); strokeWeight(6);
line(pistonX, CH_Y0, pistonX, CH_Y1);
noStroke(); fill(...STRUCT);
rect(pistonX, (CH_Y0 + CH_Y1) / 2 - 26, HANDLE_W, 52, 3);
fill(BG);
rect(pistonX + 4, (CH_Y0 + CH_Y1) / 2 - 16, 2, 32);
rect(pistonX + 8, (CH_Y0 + CH_Y1) / 2 - 16, 2, 32);
noStroke(); fill(...DIM); textSize(9); textAlign(CENTER, TOP);
text('piston (drag)', pistonX + HANDLE_W / 2, (CH_Y0 + CH_Y1) / 2 + 30);
text('thermal walls at T', (CH_X0 + pistonX) / 2, CH_Y1 + 6);
}
function drawParticles() {
noStroke();
for (const p of parts) {
const v = Math.hypot(p.vx, p.vy);
const t = constrain(v / 320, 0, 1);
let r, g, b;
if (t < 0.5) {
const u = t * 2;
r = lerp(COLD[0], HOT[0], u); g = lerp(COLD[1], HOT[1], u); b = lerp(COLD[2], HOT[2], u);
} else {
const u = (t - 0.5) * 2;
r = lerp(HOT[0], 255, u); g = lerp(HOT[1], 240, u); b = lerp(HOT[2], 215, u);
}
fill(r, g, b);
circle(p.x, p.y, p.r * 2);
if (p.heavy) { // heavy species gets a ring
noFill(); stroke(ACCENT[0], ACCENT[1], ACCENT[2], 190); strokeWeight(1.2);
circle(p.x, p.y, p.r * 2 + 3);
noStroke();
}
}
}
// Exact 2-D Maxwell-Boltzmann density for mass m at temperature T.
function mb2d(v, m, T) {
const kT = K_B * Math.max(T, 1);
return (m / kT) * v * Math.exp(-m * v * v / (2 * kT));
}
function drawHistPanel() {
noFill(); stroke(...STRUCT); strokeWeight(1);
rect(HX, HY, HW, HH);
noStroke(); fill(FG); textSize(12); textAlign(LEFT, BOTTOM);
text('Speed distribution -- 2-D Maxwell-Boltzmann', HX, HY - 5);
// bars
const bw = HW / NBINS;
const T_kin = kineticT();
const yMaxDens = 1.35 * mb2d(Math.sqrt(K_B * Math.max(T_kin, 50) / M_LIGHT), M_LIGHT, Math.max(T_kin, 50));
const binDens = NBINS / V_MAX; // converts per-bin prob -> density
for (let i = 0; i < NBINS; i++) {
const hL = histLight[i] * binDens / yMaxDens * HH;
noStroke(); fill(TRAJ[0], TRAJ[1], TRAJ[2], 110);
rect(HX + i * bw + 1, HY + HH - hL, bw - 2, hL);
if (mixOn) {
const hH = histHeavy[i] * binDens / yMaxDens * HH;
fill(ACCENT[0], ACCENT[1], ACCENT[2], 110);
rect(HX + i * bw + 1 + bw * 0.25, HY + HH - hH, bw * 0.5, hH);
}
}
// theory curves at the measured kinetic temperature
drawTheoryCurve(M_LIGHT, T_kin, yMaxDens, GAUGE);
if (mixOn) drawTheoryCurve(M_HEAVY, T_kin, yMaxDens, ACCENT);
// axis labels
noStroke(); fill(...DIM); textSize(10); textAlign(CENTER, TOP);
text('speed v (px/s)', HX + HW / 2, HY + HH + 4);
textAlign(RIGHT, TOP);
text(V_MAX, HX + HW, HY + HH + 4);
textAlign(LEFT, TOP);
text('0', HX, HY + HH + 4);
// legend
textAlign(RIGHT, TOP); textSize(10);
fill(...GAUGE); text('theory f(v) at T_kin', HX + HW - 4, HY + 5);
fill(TRAJ[0], TRAJ[1], TRAJ[2], 200);
text(mixOn ? 'bars: light m=1 / heavy m=4' : 'bars: measured histogram', HX + HW - 4, HY + 18);
}
function drawTheoryCurve(m, T, yMaxDens, col) {
stroke(col[0], col[1], col[2]); strokeWeight(2); noFill();
beginShape();
for (let k = 0; k <= 100; k++) {
const v = k / 100 * V_MAX;
const y = HY + HH - mb2d(v, m, T) / yMaxDens * HH;
vertex(HX + k / 100 * HW, Math.max(HY, y));
}
endShape();
}
function drawReadouts(T_wall) {
const x = HX, y = HY + HH + 28;
const T_kin = kineticT();
const V_area = (pistonX - CH_X0) * (CH_Y1 - CH_Y0);
const ratio = pSmooth * V_area / Math.max(parts.length * K_B * T_kin, 1);
noStroke(); fill(FG); textSize(11); textAlign(LEFT, TOP);
text('T wall = ' + T_wall.toFixed(0) + ' K', x, y);
text('T kinetic = ' + T_kin.toFixed(0) + ' K', x + 110, y);
text('P = ' + pSmooth.toFixed(1) + ' (sim units)', x, y + 16);
text('V = ' + (V_area / 1000).toFixed(1) + 'e3 px^2', x + 110, y + 16);
// the money readout
fill(...GAUGE); textSize(13);
text('P V / N k T = ' + ratio.toFixed(2), x, y + 36);
fill(...DIM); textSize(10);
text('(ideal gas law, emerging -- expect ~1.00 with fluctuations)', x, y + 54);
if (paused) {
fill(...TRAJ); textSize(12);
text('paused -- [space] to run', x, y + 70);
}
}
function drawSliderLabels(T_wall, N_want) {
noStroke(); fill(FG); textSize(11); textAlign(LEFT, TOP);
text('T wall = ' + T_wall + ' K', 70, 438);
text('N = ' + N_want, 240, 438);
}
function drawHUD() {
noStroke();
fill(FG); textAlign(LEFT, TOP); textSize(22);
text(TITLE, 14, 14);
fill(...DIM); textSize(12);
text('Wikitube microsim . ' + WIKITUBE_URL, 14, 42);
}
function drawHints() {
const hints = [
'[drag] piston',
'[space] run / pause',
'[2] light/heavy mix',
'[r] reset histogram'
];
noStroke(); fill(...DIM); textSize(10); textAlign(RIGHT, TOP);
for (let i = 0; i < hints.length; i++) {
text(hints[i], width - 14, 14 + i * 12);
}
}
function drawBottomHUD(T_wall) {
noStroke();
fill(...DIM); textAlign(LEFT, BOTTOM); textSize(12);
text('T=' + T_wall + ' K N=' + parts.length +
' mix ' + (mixOn ? 'on (m=1, m=4)' : 'off'), 14, height - 8);
textAlign(RIGHT, BOTTOM); textSize(11);
text('P V = N k T (k = 1 sim units)', width - 14, height - 24);
fill(FG); textSize(13);
text('f(v) = (m/kT) v exp(-m v^2 / 2kT)', width - 14, height - 6);
}
// =====================================================================
// interaction
// =====================================================================
function mousePressed() {
if (mouseX > pistonX - 8 && mouseX < pistonX + HANDLE_W + 10 &&
mouseY > CH_Y0 && mouseY < CH_Y1) {
dragPiston = true;
}
}
function mouseDragged() {
if (dragPiston) {
pistonX = constrain(mouseX, PISTON_MIN, PISTON_MAX);
}
}
function mouseReleased() {
dragPiston = false;
}
function keyPressed() {
if (key === ' ') { paused = !paused; return false; }
if (key === '2') { toggleMix(); return false; }
if (key === 'r' || key === 'R') { resetHist(); return false; }
}
```
## Links (Wikipedia order)
<!-- injected from _registry/childlinks/Kinetic_theory_of_gases.json (2026-07-30T02:09:12Z) -->
`Advection` · `Albert_Einstein` · `Annals_of_Philosophy` · `Anyon` · `Aristotle` · `Arithmetic_mean` · `Atom` · `Atomic_radius` · `Atomism` · `August_Krönig` · `Average` · `Avogadro_constant` · `BBGKY_hierarchy` · `Bhatnagar–Gross–Krook_operator` · `Bohr_radius` · `Boltzmann_constant` · `Boltzmann_equation` · `Bose–Einstein_statistics` · `Braid_statistics` · `Brownian_motion` · `Canonical_ensemble` · `Catherine_the_Great` · `Chapman–Enskog_theory` · `Characteristic_length` · `Chemical_potential` · `Classical_mechanics` · `Collision_theory` · `Conservation_of_energy` · `Convection` · `Couette_flow` · `Cross_section_(physics)` · `Dalton's_law` · `Daniel_Bernoulli` · `David_Enskog` · `Debye_model` · `Degrees_of_freedom_(physics_and_chemistry)` · `Detailed_balance` · [[Diffusion]] · `Drag_(physics)` · `Drift_velocity` · `E._G._D._Cohen` · `Effusion` · `Einstein_relation_(kinetic_theory)` · `Einstein_solid` · `Elastic_collision` · `Enrico_Fermi` · `Enthalpy` · [[Entropy]] · `Epicureanism` · `Equipartition_theorem` · `Ernst_Ising` · `Extraction_(chemistry)` · `Fermi–Dirac_statistics` · `Fick's_laws_of_diffusion` · [[Force]] · `Francis_Bacon` · `Galileo_Galilei` · `Gas` · `Gas_laws` · `Gaseous_diffusion` · `Georges-Louis_Le_Sage` · `Gibbs_free_energy` · `Graham's_law` · `Grand_canonical_ensemble` · `Grand_potential` · `Harold_Grad` · `Heat` · `Heat_flux` · [[Heat_transfer]] · [[Helium]] · `Helmholtz_free_energy` · `Henry_M._Leicester` · `Hermann_von_Helmholtz` · `History_of_thermodynamics` · `Hydrodynamica` · `Ideal_gas` · `Ideal_gas_law` · `Indistinguishable_particles` · `Infrared_spectroscopy` · `Interatomic_potential` · `Internal_energy` · `Ising_model` · `Isoenthalpic–isobaric_ensemble` · `Isothermal–isobaric_ensemble` · `Isotope_separation` · `Isotropy` · `James_Clerk_Maxwell` · `John_Herapath` · `John_James_Waterston` · `John_Lighton_Synge` · `John_Locke` · [[John_von_Neumann]] · `Joseph_Black` · `Joseph_O._Hirschfelder` · [[Josiah_Willard_Gibbs]] · `Kinetic_diameter` · `Kinetic_energy` · `Lennard-Jones_potential` · `Lev_Landau` · `Logarithm` · `Lucretius` · `Ludwig_Boltzmann` · `Macroscopic_scale` · `Magnetohydrodynamics` · `Marian_Smoluchowski` · `Mass` · `Mass_diffusivity` · `Maxwell–Boltzmann_distribution` · `Maxwell–Boltzmann_statistics` · `Mean_free_path` · `Mechanical_explanations_of_gravitation` · `Microcanonical_ensemble` · `Micrographia` · `Microscopic_reversibility` · `Mikhail_Lomonosov` · `Mode_(statistics)` · `Molar_mass` · `Mole_(unit)` · `Molecular_vibration` · `Molecule` · `Momentum` · `Morse_potential` · `Number_density` · `Onsager_reciprocal_relations` · `Parastatistics` · `Particle_statistics` · `Paul_Dirac` · `Paul_Ehrenfest` · `Peter_Debye` · `Physicist` · `Potts_model` · `Pressure` · [[Probability]] · `Rarefied_gas_dynamics` · `Richard_C._Tolman` · `Richard_Liboff` · `Robert_Boyle` · `Robert_Byron_Bird` · `Robert_Hooke` · `Rotation` · [[Rudolf_Clausius]] · `Satyendra_Nath_Bose` · `Shear_stress` · `Solvation` · `Specific_heat_capacity` · `Speed_of_light` · `Spin–statistics_theorem` · `Standard_temperature_and_pressure` · `Statistical_mechanics` · `Steady_state` · `Sydney_Chapman_(mathematician)` · `Temperature` · `Terminal_velocity` · `The_Assayer` · `Thermal_reservoir` · `Thermodynamic_limit` · `Thermodynamic_potential` · `Thermodynamic_temperature` · [[Thermodynamics]] · `Thomas_Cowling` · `Time_reversibility` · `Translation_(geometry)` · `Transport_phenomena` · `Uncorrelatedness_(probability_theory)` · `Vicsek_model` · [[Viscosity]] · `Vlasov_equation` · `Volume` · `Water` · [[Wayback_Machine]]
## From the Real GENERATIVE library

*Kinetic theory of gases — placed from the Real G.E.N.E.R.A.T.I.V.E. course library (Energy room). Source: Wikimedia Commons (via Wikipedia article media). [Details & license](https://commons.wikimedia.org/wiki/File:M.V._Lomonosov_by_L._Miropolskiy_after_G.C._Prenner_%281787%29.jpg).*

*Animated: Kinetic theory of gases — placed from the Real G.E.N.E.R.A.T.I.V.E. course library (Energy room). Source: Wikimedia Commons (via Wikipedia article media). [Details & license](https://commons.wikimedia.org/wiki/File:Translational_motion.gif).*
> The kinetic theory of gases is a simple classical model of the thermodynamic behavior of gases. It treats a gas as composed of numerous particles, too small to see with a microscope, which are constantly in random motion. ([Wikipedia](https://en.wikipedia.org/wiki/Kinetic_theory_of_gases))
<!-- REAL-GENERATIVE-MEDIA:END -->
<!-- LOCAL-MEDIA-PASS:START -->
## From the vault media library
!Kinetic theory of gases thumb.png
*Kinetic Theory Of Gases — from the vault's own media holdings, placed 2026-07-09. MTN / Wikitube.io original · CC BY-SA 4.0.*
<!-- LOCAL-MEDIA-PASS:END -->
## Media (PD/CC)
<!-- MEDIA-DEPLOY:Kinetic_theory_of_gases/Translational_motion.gif -->
!Gif Library/Kinetic theory of gases/Translational motion.gif
*Translational_motion.gif · Public domain*
<!-- /MEDIA-DEPLOY -->
> **Room:** [[Chemistry]] · **Status:** ✅ validated — canonical sketch at [`Microsims/Kinetic_theory_of_gases.js`](Microsims/Kinetic_theory_of_gases.js). Save it in the p5.js Web Editor as **Kinetic_theory_of_gases**, then paste the resulting opaque URL into this page. ← back to [[Chemistry]] · [[Engineering]] · MAIN
## Overview
The kinetic theory of gases explains macroscopic gas behavior — pressure, temperature, the ideal gas law — as the statistical consequence of enormous numbers of molecules in ceaseless random motion. Its central claims: gas molecules are in constant motion with a distribution of speeds; pressure is the aggregate momentum flux of molecular impacts on the container walls; and absolute temperature is proportional to the mean translational kinetic [[Energy|energy]], ⟨KE⟩ = (d/2)kT for d degrees of freedom. Molecular collisions redistribute energy until the speed distribution relaxes to the Maxwell–Boltzmann form — in two dimensions f(v) = (m/kT)·v·exp(−mv²/2kT), in three the familiar v² version. From these assumptions the ideal gas law PV = NkT follows as a theorem rather than an empirical fit, mixtures obey equipartition (every species reaches the same temperature, so heavier molecules move more slowly), and rapid compression heats a gas because a moving piston returns molecules faster than they arrived — the microscopic mechanism of adiabatic heating. The theory, developed by Bernoulli, Clausius, Maxwell, and Boltzmann, is the bridge between Newtonian mechanics and [[Thermodynamics|thermodynamics]], and the conceptual gateway to statistical mechanics.
## Betterfire log
| Pass | Date | Change |
|---|---|---|
| v1 | 2026-06-10 | Authored from scratch to Betterfire Standard v0: thermal-wall thermostat, exact hard-disk collisions, live 2-D Maxwell–Boltzmann histogram vs theory, two-species equipartition mode, piston with adiabatic heating, PV/NkT gauge; 9/9 validator passes, node syntax clean |
## See also
- Room hub: [[Chemistry]] · parent room: [[Engineering]]
- p5.js Editor conventions: P5 JS EDITOR
- Wiki root: MAIN
<!-- REAL-GENERATIVE-MEDIA:START -->
<!-- CRAFT-LINK:START g12 -->
*Built to the [[WT!P5_js_Microsim_Master_Class|p5.js Master Class]].*
<!-- CRAFT-LINK:END -->
## Wikipedia : Wikitube
**Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/Kinetic_theory_of_gases) : [Wikitube](https://en.wikitube.io/wiki/Kinetic_theory_of_gases)
## Previous hub tags
Tree parent: [[Monte_Carlo_method]].
Legacy hubs: none.
---
*Sources: 1 legacy note. Minted wave 1, 2026-07-30 (v1.6 order).*