I am simulating a free fall with a function that needs to calculate the time it takes for a particular object to reach the surface, I got this program working without accounting for air resistance.. the force of air resistance(drag) is: 0.24 * v^2
Im not sure what I'm doing wrong or how I can make it work, any help would be appreciated
def jump(): t = 0 dt = 0.01 v = 0 x = 728 #starting height a = 9.8 while x > 0: x = x - v*dt t = t + dt a = 9.8 - 0.24*(v**2)*dt #drag coefficient and calculation v = v + a*dt return round(t, 1) result = jump() print(result)
Output: 15.9 seconds, but it needs to be 17.2. Maybe its going wrong with the velocity updating after the acceleration?