Ideal Gas Simulation and the Maxwell–Boltzmann Distribution

Kinetic Energy (Joules)

idk


idk

Temperature (Kelvin)

idk


Maxwell-Boltzmann Distribution for a microcanonical ensemble with no potential energy


Equation for 3d elastic collissions of spheres from here.


From the Boltzmann Distribution, when entropy is maximized, the probability of a particle being in any microstate is

P(x,p)=eH(x,p)kBTVeH(x,p)kBTdxdp=eH(x,p)kBTZ

If the Hamiltonian has no potential energy, then for a non-relativistic particle it would just be

H(x,p)=p22m=pp2m=px2+py2+pz22m

So since x doesn't matter

P(p)=epx2+py2+pz22mkBTZ

And to calculate the partition function

Z=epx2+py2+pz22mkBTdpxdpydpz

And this is just a 3D gaussan so

=(τmkBT)3/2

then substituting gives

P(p)=(τmkBT)3/2epx2+py2+pz22mkBT=(τmkBT)3/2ep22mkBT

and switching to p=mv while preserving the probability density

P(v)=P(p(v))(dpxdvxdpydvydpzdvz)=m3P(p(v))
P(v)=(mτkBT)3/2emv22kBT

Now if we want to find the speed we can create a bijection into polar coordinates

s=vx2+vy2+vz2,θ,ψ

we get a Jacobian of

s2sin(θ)

So we can write

P(s,θ,ψ)=P(rsin(θ)cos(ψ),rsin(θ)sin(ψ),rcos(θ))s2sin(θ)

then to find the probability of a speed

P(s)=0τ0τ/2P(rsin(θ)cos(ψ),rsin(θ)sin(ψ),rcos(θ))s2sin(θ)dθdψ

since each velocity coordinate is independent

0τ0τ/2P(vx=rsin(θ)cos(ψ))P(vy=rsin(θ)sin(ψ))P(vz=rcos(θ))s2sin(θ)dθdψ

And since it doesn't depend on angle

0τ0τ/2P(v2=s2)s2sin(θ)dθdψ

And thats just the surface area of a sphere

P(s)=2τs2P(v2=s2)
=2s21τ(mkBT)3/2emv22kBT

Finding temperature

To find the temperature of a microcanonical system (NVE ensemble) with no potential energy we start with the Hamiltonian equal to a constant E. Since there is only kinetic energy the position x doesn't matter.

H(x,p)=ipi22m=E

What we want to find the temperature defined by

1T=S(N,V,E)E

where the entropy S=kBiP(xi,pi)ln(P(xi,pi)=kBln(1W(E))=kBln(W(E)) when entropy is maximized (so all states are the same probability) and W(E) is the number of accessable states between E and E+ΔE.

Rearange to

ipi2=2mE

If we want to find W(E) then assuming all particles are indistunguishable for the factorial and using Plank's constant as a measure of the phase space then

W(E)=1h3NN!V𝟙(EH(x,p)E+ΔE)d3Npd3Nx

With no potential energy the position doesn't matter and can be factored out

=V3Nh3NN!𝟙(2mEipi22m(E+ΔE))d3Np
=V3Nh3NN!𝟙(ipi22m(E+ΔE))𝟏(ipi22mE)d3Np
=V3Nh3NN!(2m(E+ΔE)2m(E+ΔE)2m(E+ΔE)p122m(E+ΔE)p122m(E+ΔE)p12pn122m(E+ΔE)p12pn12d3Np
2mE2mE2mEp122mEp122mEp12pn122mEp12pn12d3Np)

And recognize these are just the equation for a 3N dimensional hypersphere of radius 2mE and 2m(E+δE).

=V3Nh3NN!((τ2)3N/2(2m(E+ΔE))3N/2Γ(3N2+1)(τ2)3N/2(2mE)3N/2Γ(3N2+1))
=V3N(τ2)3N/22m3Nh3NN!Γ(3N2+1)((E+ΔE)3N/2E3N/2)

And now

1T=kBln(W(E))E=kB1W(E)W(E)E

substitute

=kB1V3N(τ2)3N/22m3Nh3NN!Γ(3N2+1)((E+ΔE)3N/2E3N/2)V3N(τ2)3N/22m3Nh3NN!Γ(3N2+1)3N2((E+ΔE)(3N/2)1E(3N/2)1)

cancell

=kB3N2(E+ΔE)(3N/2)1E(3N/2)1(E+ΔE)3N/2E3N/2

If we take the limit then

limΔE0kB3N2(E+ΔE)(3N/2)1E(3N/2)1(E+ΔE)3N/2E3N/2
=kB3N23N213N2E

so

1T=kB3N21E

making

kBT=E3N21

This equation is consistent with the equipartition theorem as each of the 3N1 degrees of freedom contribute 32kBT to the total energy.