Advertisement
Darkfantasio

[IPT] TP3 Part II

Jun 23rd, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import pi
  2. import matplotlib.pyplot as plt
  3.  
  4. #La bibliothèque
  5.  
  6.  
  7. mp = 237*1000
  8. m0 = 750*1000
  9. Dt = 130
  10. R = 2.7
  11. p_air = 1.3
  12. S = pi*(R**2)
  13. cz = 0.4
  14. g = 9.81
  15. F0 = 12 * (10**6)
  16. N = 500
  17. dt = Dt/N
  18.  
  19.  
  20. #Les fonctions
  21.  
  22. def masse(t):
  23.     return m0 - (mp/Dt)*t
  24.  
  25. def derive(ti,vi):
  26.     return -g + (1/masse(ti))*(F0 - 0.5*p_air*S*cz*(vi**2)+(mp/Dt)*vi)
  27.    
  28. def integre(dL,T):
  29.     total=[0]
  30.     a = 0
  31.     for i in range (1,len(T)):
  32.         a += dL[i]*(T[i]-T[i-1])
  33.         total+=[a]
  34.     return total
  35.    
  36. #Le main
  37.  
  38.  
  39. T=[0]
  40. V=[0]
  41. t=0
  42. v=0
  43. for i in range (N-1):
  44.     v= v + dt*(derive(t,v))
  45.     V.append(v)
  46.     t+= dt
  47.     T.append(t)
  48. plt.plot(T,V)
  49.  
  50. Z = integre(V,T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement