JavaScript Simulations for Statistical and Thermal Physics

The following programs were written for the Statistical and Thermal Physics curriculum development project and are part of the Open Source Physics project. These Java programs were first released under the GNU General Public License. The source code is available for download from GitHub.

This Java code was converted from Java to JavaScript by Wolfgang Christian (Davidson College) and Robert Hanson (St. Olaf College) using the SwingJS system developed at St. Olaf College. Examples of converted STP programs are shown below.


The goal of STP simulations and calculations is to illustrate some of the fundamental concepts in statistical mechanics. They can be used as standalone programs, or in conjunction with a text such as Harvey Gould and Jan Tobochnik, Statistical and Thermal Physics: With Computer Applications, Princeton University Press (2010). This text is also available online as a pdf file.

  1. Approach to equilibrium. Explore some of the qualitative properties of macroscopic systems.
  2. An ideal thermometer. Why is an extra degree of freedom called the demon an ideal thermometer?

Additional STP programs are being converted.

STP Java programs were developed by Kipton Barros, Ranjit Chacko, Joshua Gould, Harvey Gould, Natali Gulbahce, Peter Sibley, Jan Tobochnik, and Hui Wang. The Open Source Physics Java code library used in these programs was developed by Wolfgang Christian and is described in, Open Source Physics: A User's Guide with Examples, © Addison-Wesley, 2007. A PDF of the User Guide is available in the AAPT-Compadre digital library at

JavaScript simulation update by W. Christian, 20 March 2020.