import numpy as np
import matplotlib.pyplot as plt
Run to view results
#Use this cell to calculate the velocity of a ball after falling 2 meters
initialHeight = 2 # meters
gravityAccMag = 9.81 #meters/s^2, magnitude of acceleration due to gravity
##### Begin Editing #####
finalVelocity = np.sqrt(2*gravityAccMag*initialHeight) # in meters/s. This should be a vector.
##### End Editing #####
velocityMagnitude = np.linalg.norm(finalVelocity) #numpy.linalg.norm takes the magnitude of an array
print('The final velocity of a ball after falling 2 meters has a magnitude of {} meters/second'.format(velocityMagnitude))
Run to view results
#Use this cell to calculate the magnitude of the drag force for a ball that has fallen 2 meters
vel = velocityMagnitude*np.array([1./np.sqrt(3),1./np.sqrt(6),1./np.sqrt(2)]) # meters/s
r = 0.025 # meters
##### Begin Editing #####
A = 3.14*(r**2) #m^2
C = 0.5 #unitless
rho = 1.204 #kg/m^3
dragForce = -0.5*C*A*rho*vel
##### End Editing #####
dragMagnitude = np.linalg.norm(dragForce)
print('The magnitude of the air drag force is {}'.format(dragMagnitude))
Run to view results
#Run this cell without editing
print(np.linalg.norm(vel)*vel)
print(vel*vel)
Run to view results
#Use this cell to calculate the ratio of the magnitude of the drag force to gravity
##### Begin Editing #####
mass = 0.075
acceleration = 9.8
gravityForce = mass*acceleration
##### End Editing #####
gravityMagnitude = np.linalg.norm(gravityForce)
ratio = dragMagnitude / gravityMagnitude
print('The ratio of the air drag force to gravity is {}'.format(ratio))
Run to view results