This is a project simulating an ideal gas in 2D space with a given number of particles (#particles). Choose the parameters and press the green flag to run it with the new values. You can control the number of particles, #particles (theoretically up to the clone limit of 300), and the absolute temperature. dv is the width of each velocity interval (e.g. dv = 0.5 will mean each bar represents the frequency of particles with velocity, v, 0<v<=0.5, 0.5<v<=1, 1<v<=1.5, etc.). This is used for plotting the graphs and "sampling" the velocities at a point in time. To be able to spot patterns, don't set dv too low or too high. Two frequency-velocity graphs are plotted: - the current distribution of velocities of the particles on screen - The average distribution of velocities of particles since the start of the project. As the simulation runs, it should get closer and closer to a smooth curve. The collisions are depicted to be 100% elastic, so that not only that total momentum in the system is conserved, but also total kinetic energy. All particles here have the same mass, so the equations are relatively simple. The idea is that given a large number of particles, the distribution of their velocities should approach the Maxwell-Boltzmann distribution. Since the average kinetic energy is directly proportional to the absolute temperature (you can also control this using the slider). (Note that the units are arbitrary. It is likely that velocity isn't in m/s, temperature isn't in kelvin, and energy is not in joules. This does not impact the simulation.)
Thanks to this post by @Zro716 https://scratch.mit.edu/discuss/post/1374822/ The number of particles is limited because of the small stage size and Scratch's clone limit. If you want to test it with more particles, run the project on TurboWarp, disabling the clone limit, changing the stage size, and changing the slider range: https://turbowarp.org/1108850105?hqpen&fps=60&clones=Infinity I could get a 1280x720 stage with 1000 particles... with a lot of lag though. Additional info: https://en.wikipedia.org/wiki/Ideal_gas https://en.wikipedia.org/wiki/Maxwell%E2%80%93Boltzmann_distribution Tags: