#use kinematics equation d=rt since there is no acceleration in this situation
deltaY=-100
initialVelocityY=-10
time = (deltaY)/(initialVelocityY)
print(time)
#we find that time = 10 seconds
Run to view results
#import numpy package
import numpy as np
#define initial conditions
#individual positions
x0 = 0 #meters
##### Begin Editing #####
y0 = 100 # meters
##### End Editing #####
z0 = 0 #meters
#position vector
r0 = np.array([x0,y0,z0])
#indivitual velocities
vx0 = 0 #m/s
##### Begin Editing #####
vy0 = -10 #m/s
##### End Editing #####
vz0 = 0 #m/s
#velocity vector
v0 = np.array([vx0,vy0,vz0])
Run to view results
t = 0
r = r0
y = r[1]
deltat = 1
while t <= 11:
#position update
r = r + v0 * deltat
#update time and position for conditional
t += deltat
y = r[1]
if y <= 0: break
print('Particle reached y={} after t={} seconds.'.format(y,t))
Run to view results
t = 0
r = r0
v = v0
y = r[1]
g = 9.81
a = np.array([0,-g,0])
##### Begin Editing #####
tc = np.sqrt(y0/g)
##### End Editing #####
Ncycles = 10000
deltat = tc/Ncycles
while t < 1.2 * tc:
#position update
r = r + v * deltat
##### Begin Editing #####
#Edit what's below to include the velocity update equation
#velocity update
v = v + (a)*deltat
##### End Editing #####
#update time and position for conditional
t += deltat
y = r[1]
if y <= 0: break
print('Particle reached y={} after t={} seconds.'.format(y,t))
Run to view results