#Simulating falling (with air resistance)
t=0 #initial time in seconds
x=0 #initial depth in meters
v=0 #initial velocity in meters/second
dt=.1 #small time step
g=9.8 #m/s^2
b=.001
def acceleration(v):
return g - b * v**2
print 'simulated (t, x, v)'
print t, x, v
for i in range(30):
dv = acceleration(v) * dt #a = dv/dt (exact as limit dt-->0)
v = v + dv #dv is approximately delta v
#but when a is constant, it's exact
dx = v * dt #v = dx/dt (exact as limit dt-->0)
#v is not constant, so not exact
x = x + dx #dx is approximatly delta x
t = t + dt
print (round(t,4), round(x,4), round(v,4))