Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import math as m
  2. from matplotlib import pyplot as plt
  3.  
  4. th0 = float(raw_input())
  5. l=float(raw_input())
  6.  
  7. g=9.807
  8. print l
  9. print th0
  10.  
  11.  
  12. def wi(wold,ths,dt) : wold - g/l*m.sin(ths*(m.pi/180))*dt
  13. def thi(thold, wold, dt) : thold + wold*dt
  14.  
  15. print wi(0,th0,0.1)
  16. thetas=[]
  17. omegas=[]
  18.  
  19. w=0
  20. th=th0
  21. for i in range(20):
  22.     thetas.append(th)
  23.     w=wi(w,th,0.1)
  24.     th=(th,w,0.1)
  25.  
  26. w = 0
  27. th = th0
  28. for i in range(20):
  29.     omegas.append(w)
  30.     w=wi(w,th,0.01)
  31.     th=(th,w,0.01)
  32.  
  33. print thetas
  34. print omegas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement