Skip to content

jx124/maxwell-boltzmann-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

2D particle collision simulation

Description

A simulation of ideal gas particles undergoing elastic collisions within a box. A histogram plot of the speed of the particles shows that it averages to the Maxwell-Boltzmann distribution for 2 dimensions after equilibrium is reached.

The speed distribution is given by:

equation

Setup

pip install matplotlib numpy scipy

Example

In this example, the particles are initially positioned in a grid with an initial velocity towards the top right + some jitter. The particles appear to compress into the corner before expanding out to fill the whole space.

simulation

The accelerations of the particles are set to 0 in this simulation, but can be altered in other molecular dynamics simulations to simulate the effects of e.g. gravity, intermolecular interactions, potential fields etc.

This simulation is inspired by similar GIF on the Wikipedia page for the Maxwell-Boltzmann distribution

Version Info

  • Python 3.8.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages