Advertisement
EstEsca

Untitled

Nov 12th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. import random
  2. import numpy as np
  3.  
  4. numbers = 10
  5. tRes = 100
  6. mass = 0.1
  7. tStep = 1/tRes
  8.  
  9. simTime = 10
  10.  
  11. px = []
  12. py = []
  13. pz = []
  14. vx = []
  15. vy = []
  16. vz = []
  17.  
  18. for i in range(numbers):
  19.     vx.append()
  20.  
  21. for t in range(simTime*100):
  22.  
  23.  
  24.     for i in range(numbers):
  25.         for j in range(numbers):
  26.             if(j > i):
  27.                 if(dist(px[i], py[i], pz[i], px[j], py[j], pz[j]) < 0.5):
  28.                     temp = px[i]
  29.                     px[i] = px[j]
  30.                     px[j] = temp
  31.                    
  32.                     temp = py[i]
  33.                     py[i] = py[j]
  34.                     py[j] = temp
  35.                    
  36.                     temp = py[i]
  37.                     py[i] = py[j]
  38.                     py[j] = temp
  39.                  
  40.                
  41.     for i in range(numbers):
  42.         px[i] = px[i] + vx[i]*tStep
  43.         py[i] = py[i] + vy[i]*tStep
  44.         pz[i] = pz[i] + vz[i]*tStep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement