Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def A(t) : return 2
- def LO(t) : return 2,5
- def va(t) : return 3
- def vz(t) : return 2,5
- def ve(t) : return 2
- def vr(t) : return 1,5
- L = [[A,LO, va, 5],[A,LO,vz, 10],[A,LO, ve, 15],[A,LO,vr, 20]]
- import numpy as np
- import matplotlib.pyplot as plt
- import cos
- pi = 4*np.arctan(1)
- def impaire(x) :
- return int(x/2)*2 +1
- def F(L,T) :
- x = []
- y = []
- for i in range (50000):
- x.append(i)
- y.append(0)
- for i in range(len(L)) :
- L[i][3] = int(L[i][3] * 1000)
- t = 0
- while t < 10*T :
- z = y[;;]
- for i in range(len(L)) :
- if L[i][3] - (impaire(L[i][0](t/10))*1000-1)/2 < 0 :
- for dl in range(-L[i][3] + (impaire(L[i][0](t/10))*1000-1)/2,L[i][1]) :
- 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 )
- elif L[i][3] + (impaire(L[i][0](t/10))*1000-1)/2 > 50000 :
- for dl in range(-L[i][3] + 50000 + (impaire(L[i][0](t/10))*1000-1)/2) :
- 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 )
- else :
- for dl in range(L[i][0](t/10)*1000) :
- 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 )
- L[i][3] += int( (L[i][2](t/10) / 10) * 1000 )
- t += 1
- plt.(x,z)
- plt.pause(0.5)
- F(L,30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement