Ideal Gas Simulation and Boltzmann's Law


Thermodynamics simulation from AP chem

When atoms or molecules bounce they are basically exchange velocity equivelent to an elastic collision


I got the equation for 3d elastic collissions of spheres from here, I don't really understand the proof other than the mass, momentum, and energy conservation equations but I implemented the vector math and it works. There is also a similar equation from this wikipedia page on 2d elastic collissions, but because they just use vectors as a whole and not their individual compnents, applying the same equation to 3d also works perfectly, intentional or not. I only use the first one because it's proof is based of thermodynamics and kinetic energy but they are probably the exact same equation just in different form.



The equation for the maxwell boltzman distribution is

f(v)=(m2πkT)3/24πv2emv22kTf(v) = {({m \over 2\pi kT})^{3/2}}4\pi v^2e^{-{{mv^2} \over {2kT}}}

where
f(v)f(v) is the probability
vv is the velocity
mm is the mass
kk is the boltzmann constant
TT is the temperature

the blue graph isn't actually exactly the correct equation for this system since the units didn't convert nicely when I did it.


the bar graph starts form a velocity of zero and each bucket is 1/700 distance units per 1/30th of a second since it does one physics tick per frame which is 1/30th of a second. The units of velocity are quite small since one unit of distance is one square on the cage, or see it as the floor is 4x4 units


basically just shows the maxwell botzman distribution as an emergent propery