Is there any way I can simulate physics movement of multiple points in kind of closed room 3D environment, with that I also wanted to gather information for each point like it's speed, direction, distance from other points at every point of time so that I can store it.

Actually I need this simulation for my project, I think point movement can be done in Python but maintaining so much information about each point is quite a task.

Any suggestions for that will be really helpful.



To be able to do the point movement you inherently need to know every points position, (X,Y,Z), and Velocity (dx/dt, dy/dt, dz/dt), otherwise you can't plot the current frame with the position and update the positions for the next frame so don't worry about that.

Jupyter with the VPython Kernel has a demo of exactly what you are looking for under the Ideal Gas Modelling demo called HardSphereGas.ipynb. HardSphereGas.ipynb running


I would approach this problem by using random draws to get the initial position and velocity of the particles. The velocity can be determined from the temperature, and then do a gaussian draw for the temperature. This is probably the approach used by Steve Barnes excellent answer.

  • what about the velocity vector(it gives magnitude and direction of velocity) ? and distances from all other particles ?
    – Polish
    Oct 9 '17 at 20:58
  • if you randomly assign vx,vy, and vz your get a random distribution of velocities. Just make sure to normalize that vector and then multiply it by the desired speed. The distances can be calculated after all particles have been placed. Then update everything after that at an interval of like 0.1 sec. (just guessing there but seems reasonable).
    – Natsfan
    Oct 9 '17 at 21:06
  • how can i keep track of directions in that case ? it's quite painful to do that, isn't there any simple module for that ?
    – Polish
    Oct 9 '17 at 21:11
  • Not that I know of. The other answer may contain some hints. The direction will not change unless a particle hits wall or another particle. It sounds complicated but using for or do loops its relatively straight forward. you could start with 100 particles to get the code working. The distance calculation will take a while to calculate but its all done for you.
    – Natsfan
    Oct 9 '17 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.