Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. def A(t) : return 2
  2. def LO(t) : return 2,5
  3. def va(t) : return 3
  4. def vz(t) : return 2,5
  5. def ve(t) : return 2
  6. def vr(t) : return 1,5
  7. L = [[A,LO, va, 5],[A,LO,vz, 10],[A,LO, ve, 15],[A,LO,vr, 20]]
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10. import cos
  11.  
  12. pi = 4*np.arctan(1)
  13.  
  14. def impaire(x) :
  15. return int(x/2)*2 +1
  16.  
  17. def F(L,T) :
  18. x = []
  19. y = []
  20. for i in range (50000):
  21. x.append(i)
  22. y.append(0)
  23.  
  24. for i in range(len(L)) :
  25. L[i][3] = int(L[i][3] * 1000)
  26. t = 0
  27. while t < 10*T :
  28. z = y[;;]
  29. for i in range(len(L)) :
  30. if L[i][3] - (impaire(L[i][0](t/10))*1000-1)/2 < 0 :
  31. for dl in range(-L[i][3] + (impaire(L[i][0](t/10))*1000-1)/2,L[i][1]) :
  32. z[L[i][3] - (impaire(L[i][0](t/10))*1000-1)/2 + dl] += L[i][1](t/10) * 1000 * ((cos( (dl/(L[i][0](t/10)*1000))*2*pi -pi) + 1 ) / 2 )
  33. elif L[i][3] + (impaire(L[i][0](t/10))*1000-1)/2 > 50000 :
  34. for dl in range(-L[i][3] + 50000 + (impaire(L[i][0](t/10))*1000-1)/2) :
  35. z[L[i][3] - (impaire(L[i][0](t/10))*1000-1)/2 + dl] += L[i][1](t/10) * 1000 * ((cos( (dl/(L[i][0](t/10)*1000))*2*pi -pi) + 1 ) / 2 )
  36. else :
  37. for dl in range(L[i][0](t/10)*1000) :
  38. z[L[i][3] - (L[i][0]-1)/2 + dl] += L[i][1](t/10) * 1000 * ((cos( (dl/(L[i][0](t/10)*1000))*2*pi -pi) + 1 ) / 2 )
  39. L[i][3] += int( (L[i][2](t/10) / 10) * 1000 )
  40. t += 1
  41. plt.(x,z)
  42. plt.pause(0.5)
  43. F(L,30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement