User:Rmyers/Molecules

From OLPC
Jump to navigation Jump to search

This is a simple activity that uses my physics base classes. It's purpose in large part is to give another application using the physics classes as a way of testing them.

It is a simulation of Newtonian 2D motion of a collection of particles. Some start 'hot' (fast) and others 'cold' (slow). Watch what happens. Is it what you expected?

Version as of 8/6/2008 factors out the physics classes to their own module 'rmphysics'.

Outstanding issues:

  • not perfect energy conservation -- energy oscillates
  • molecules can 'stick' to each other
  • add interface for setting initial conditions

I found out that high school physics is harder than I remembered.

Classes

  • class ColdestDisplay(rmphysics.TextDisplayObject):
  • class AverageDisplay(rmphysics.TextDisplayObject):
  • class HottestDisplay(rmphysics.TextDisplayObject): classes to display hottest average and coldest temperatures as color bars
  • class Molecule(rmphysics.PhysicsObject): class for the moving objects. These bounce from the walls rather than wrap.