Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pylab
- m = float(input("Mass of object: ")) #Input Variable
- g = 9.81 #Constant
- v = float(input("Desired Terminal Speed: ")) #Input Variable
- A=(((g-0)*m)/(0.1*v**2))+1 #Finding A using the input variables and constant
- k = 0.1*A #Set a value of k using A
- Start = float(input("Starting speed of object: ")) #Input Variable
- d = 300000
- t = 15
- dt = t/d #Big step in relation to time, to avoid problems of the tangent being to steep and becoming negative.
- print("Parachute must be",A,"meters squared to get the desired terminal speed for that object.")
- speed = pylab.zeros(d)
- time = pylab.zeros(d)
- speed[0] = Start
- for i in range(d-1): #Goes through all the steps we set
- speed[i+1] = speed[i] + dt*(g-(k*(speed[i]**2))/m) #Takes speed at point i adds the differntial (Which is negative)
- time[i+1] = time[i]+dt #Adds time
- pylab.plot(time,speed) #Plots a time/speed graph for us to look at
- pylab.xlabel("time[seconds]")
- pylab.ylabel("speed[m/s]")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement