Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math as m
- from matplotlib import pyplot as plt
- th0 = float(raw_input())
- l=float(raw_input())
- g=9.807
- print l
- print th0
- def wi(wold,ths,dt) : return wold - (g/l)*m.sin(ths*(m.pi/180))*dt
- def thi(thold, wold, dt) : return thold + wold*dt
- print wi(0,th0,0.1)
- thetas=[]
- omegas=[]
- w=0
- th=th0
- for i in range(20):
- thetas.append(th)
- w=wi(w,th,0.1)
- th=(th,w,0.1)
- w = 0
- th = th0
- for i in range(20):
- omegas.append(w)
- w=wi(w,th,0.01)
- th=(th,w,0.01)
- print thetas
- print omegas
- 60
- 0.5
- Traceback (most recent call last):
- File "/Users/abcd/Desktop/odev2.py", line 23, in <module>
- w=wi(w,th,0.1)
- File "/Users/abcd/Desktop/odev2.py", line 12, in wi
- def wi(wold,ths,dt) : return wold - (g/l)*m.sin(ths*(m.pi/180))*dt
- 0.5
- 60.0
- TypeError: can't multiply sequence by non-int of type 'float'
- -1.69862222698
- Process finished with exit code 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement