To celebrate the completion of Physics 201 and 202 this summer, your lab group decides to celebrate by taking a road trip up to Grand Marais, a pretty Minnesota town on the North Shore of Lake Superior. After hitting Betty's Pies on the way up, doing a little Brook Trout fishing on the Temperance River, and landing a Kamloops at the harbor wall near Artist's point, you decide to hike some sections of the Superior Hiking Trail.
On the first hike, you decide to head to the summit of Mt. Trudee, which is located in Tettegouche State Park. The climb is long and tough, but the view at the top is well-worth the effort. While eating lunch at the top of the "mountain," you notice the topographic lines on the trail map and start wondering how high you are above the valley floor. Remembering the kinematics from the first week of 201, your lab partner suggests that the time required for a thrown rock to hit the valley floor could tell you your relative altitude. Your other lab partner says that the simple stopwatch method wouldn't work because of the effects of air resistance. Since the summit is nearly 600 ft above the valley, the rock would reach its terminal velocity before hitting the ground, and the time of flight would be longer that simple kinematics would predict.
Being good scientists, after checking that there are no trails below, you toss several rocks off the cliff and find an average time of flight to be ~7.5 seconds (this time starts at the moment your classmate lets go of the rock and stops when you hear the rock hitting the valley floor). Complicating things, the side of Mt. Trudee slopes away from the summit, and you had to throw the rocks horizontally so that they'd hit the valley floor, rather than the side of the mountain.
When you get back to campus, you write a VPython program which simulates the measurements you made while hiking. The specific question you're trying to answer is "How does air resistance affect the time it takes for an object to fall?â" In addition to this central question, you wonder how inaccurate your height measurement becomes as the height (or time of flight) increases.
# Author: Nathan Moore
# Date: 6 June 2007
# Purpose: This program will simulate someone tossing a rock
# off of a high mountain. The program is written for Lab 3, Physics 201
#
# This tells Python that we want to use the "visual" module
from visual import *
# This tells Python that we want to make some graphs
from visual.graph import *
# set up position graphs
x_display = gdisplay(x=0, y=0, width=300, height=200,
title='X position', xtitle='time', ytitle='x (meters)',
foreground=color.black, background=color.white)
x_graph = gcurve(gdisplay=x_display,color=color.cyan) # a connected curve object
y_display = gdisplay(x=0, y=0, width=300, height=200,
title='Y position', xtitle='time', ytitle='y (meters)',
foreground=color.black, background=color.white)
y_graph = gcurve(gdisplay=y_display,color=color.cyan) # a connected curve object
# set up velocity graphs
vx_display = gdisplay(x=0, y=0, width=300, height=200,
title='X velocity', xtitle='time', ytitle='Vx (m/s)',
foreground=color.black, background=color.white)
vx_graph = gcurve(gdisplay=vx_display,color=color.red) # a connected curve object
vy_display = gdisplay(x=0, y=0, width=300, height=200,
title='Y velocity', xtitle='time', ytitle='Vy (m/s)',
foreground=color.black, background=color.white)
vy_graph = gcurve(gdisplay=vy_display,color=color.red) # a connected curve object
# gravitational constant, g=9.81m/s^2
g=9.81
# initialize the objects in the simulation
floor_width = 200
initial_ball_height = 200
floor = box (pos=(0,0,0), length=floor_width, height=1, width=floor_width, color=color.blue)
building = box(pos=(0,initial_ball_height/2.0,0), length=5, height=initial_ball_height, width=5)
label(pos=(0,initial_ball_height*1.1,0), text='Mt Trudee',box=0,font="helvetica")
label(pos=(0,0,0.5*floor_width), text='valley floor',box=0)
# set up the ball
ball = sphere (pos=(0,initial_ball_height,3), radius=2, color=color.red)
ball.velocity=vector(5,20,10) # give the ball a 2-d initial kick
ball.acceleration=vector(0,-g,0) # the ball's acceleration is fixed
#add an arrow to the ball
bv = arrow(pos=ball.pos, axis=ball.velocity, color=color.yellow)
# add a trail to the ball
ball.trail = curve(color=ball.color)
# time interval, if the motion is to0 rough, make this number smaller
dt=.05
# start time
t=0
print "In this simulation, units are meter, second, vectors are listed in [x,y,z]"
print "Z is out of the page, y is up, and x is to the right"
print "The ball's acceleration is ",ball.acceleration
print "The ball's initial velocity is ",ball.velocity
print "The ball's initial position is ",ball.pos
go=1
while(go==1) :
# plot the ball's position
x_graph.plot(pos=(t, ball.pos.x))
y_graph.plot(pos=(t, ball.pos.y))
# plot ball's velocity
vx_graph.plot(pos=(t, ball.velocity.x))
vy_graph.plot(pos=(t, ball.velocity.y))
# the maximum number of simulation steps that can happen
# in one second (a smaller number makes the simulation go slower)
rate(5)
#increment the time and the position
t=t+dt
ball.pos = ball.pos + ball.velocity*dt
ball.velocity = ball.velocity + ball.acceleration*dt
# make the arrow travel with the ball
bv.pos = ball.pos
bv.axis = ball.velocity
# add a trail to the ball
ball.trail.append(pos=ball.pos)
# if the ball reaches the ground, stop the motion
# and print out the time
if ball.pos.y < (0.0+ball.radius) :
print "The ball took a time ",t," to fall to the ground"
print "The ball's final velocity is ",ball.velocity
print "The ball's final position is ",ball.pos
ball.velocity = vector(0,0,0)
ball.acceleration = vector(0,0,0)
go=0