Activity Information

Learning Goals

- Understand the relationship between acceleration and velocity
- Compare analytical solutions with computational models
- Model a projectile (HS-PS2-1)

Prior Knowledge Required

- Vectors
- Kinematic Equations
- Kinetic energy and near-Earth gravitational potential energy

Code Manipulation

- Edit existing code
- Copy/Paste code
- Create new code from mathematical equations

Activity

Handout – Freefall modeling

1. Captain America (mass of 100 kg) leaps off a 150 m tall building using a pencil dive (which reduces air resistance, we’ll say it eliminates it in this case). If the only significant force acting on him is gravity, approximately how many seconds will he be in the air? 5? 10? 15? 20? How do you know?

2. Approximately what will his velocity be when he gets to the ground if he never changes anything about his fall? How do you know?

3. Sketch an Energy time graph for the Captain’s kinetic, gravitational and total mechanical energy (all on the same graph).

**Computational Model Activity:**

4. Read through the code and predict what will happen during the simulation.

5. Run the program, observe and describe what happened and how it differed from your prediction.

6. How long does the simulation run for? How do you know?

7. When will the simulation stop? Identify the two pieces of codes that can tell the program to stop

8. What does the following line of code mean in physics terms?

` redball.pos = redball.pos + redballvelocity*dt`

9. What action does the following line of code do?

`redballvelocity = redballvelocity + g*dt`

10. What does redball.p represent?

11. Enter the appropriate values such that you can verify the work you did to solve the Captain America problem. (Check the block below your running screen for printed values.) Once you have succeeded, pat yourself on the back, and move on.

12. Add a gravitational energy formula and graph. What line of code did you add?

13. Add a total energy formula and graph. What line of code did you add?

14. Does the energy graph look how you predicted?

Code

```
GlowScript 2.7 VPython
#Window setup
scene.center = vector(0,100,0)
scene.range=256
scene.width =640
scene.height = 500
scene.background = vector(0.8,0.8,0.8)
#objects
initialheight=315
redball=sphere(pos=vector(0,initialheight,0),color=vector(1,0,0),radius=2.5,make_trail=True,trail_type="points",trail_radius=2.5,interval=100,retain=1000)
redball.mass = 2
#building
building=box(pos=vector(-50,150,0),color=vector(0,0,0),size=vector(50,300,1))
#ground
v1=vector(100,0,0)
v2=vector(-100,0,0)
ground=curve(pos=[v1,v2],color=vector(0,0,0))
#time and time step
t=0
tf=50
dt = 0.01
#initial conditions
g=vector(0,0,0)
redballvelocity=vector(0,10,0)
redball.p=redball.mass * redballvelocity
#click to start
cts = label(pos=vector(-180,0,0), text='Click to Start', space=30, height=16, border=5, font='sans', box=False)
clicktostart = scene.waitfor('click')
#graph set up
gd2 = graph(width=600, height=150, title='Energy of a Falling Mass', xtitle='Time(s)', ytitle='Energy (J)')
graph1= gcurve (color= color.red)
graph2= gcurve (color= color.blue)
graph3= gcurve (color= color.green)
#calculation loop
while t < tf:
rate(500)
redball.pos = redball.pos + redballvelocity*dt
redballvelocity = redballvelocity + g*dt
Ek = 0.5*redball.mass*(mag(redballvelocity))**2
graph1.plot (t, Ek)
if (redball.pos.y<=0):
break
t = t + dt
print('final velocity = ' ,redballvelocity.y)
#print('Eg final = ' ,Eg)
print('Ek final = ' ,Ek)
#print('ME = ' ,ME)
```

Answer Key

Handout

1. To find how long Captain America falls we can use the kinematic equation: d = (vi)t + 1/2at^2. Cap is starting from rest, so vi = 0 m/s. Now the equation can be solved for time:

d = 1/2at^2 => h = 1/2gt^2 => t = sqrt(2y/g)

Plugging in 150 m for y and 9.81 m/s^2 for g tells us that Cap should be in the air for about 5.53 s.

2. To find Cap’s speed when he hits to the ground, we can use the t value we just found in the kinematic equation vf = vi + at which simplifies to vf = gt because vi = 0. Plugging in 9.81 m/s^2 for g and 5.53 s, we get 54.25 m/s.

3. Answers will vary. Below is the graph given by the model, with gravitational potential energy in blue, kinetic energy in red, and total energy in green.

4. Without editing anything in the code, the sphere that represents cap will start to move upward with a constant velocity.

5. Cap moves upward at a constant velocity.

6. The simulation runs until t > 50, because that is the condition for the loop to run in line 48. Alternatively, a print statement that prints the time after the simulation stops can be added.

7. The simulation will stop when t > tf or the red ball’s position in the y direction is less than or equal to zero. The two lines of code that can tell the program to stop are:

`while t < tf:`

and

```
if (redball.pos.y<=0):
break
```

8. It means that the position of the red ball is being updated by multiplying the velocity of the red ball by a small time increment. This comes from the equation: d = vt

9. It means that the velocity of the red ball is being updated by multiplying the acceleration of the red ball by a small time increment. This comes from the equation v = vi + at

10. redball.p represents the momentum of the red ball because the momentum equation is p = mv

11. Cap’s mass needs to be changed to 100, and the height of the building needs to be reduced to 150 m. The building’s y position will need to be adjusted as well so it doesn’t appear to be floating. Cap’s starting height should be changed to 150 m as well. Finally, the value of g needs to be changed to: g=vector(0,-9.81,0)

12. Near-Earth Gravitational Potential energy is given by: GPE = mgh. In this model, the red ball’s y position is the same as h because we are treating y = h = 0 as the ground. This means that the formula in the code ends up looking like:

`Eg = -redball.mass*redball.pos.y*g.y`

The extra negative sign is added on the beginning of the formula to cancel with the negative sign in the value of g.

13. The total energy of the system is the sum of kinetic and potential energies which can be represented in the code with:

`ME = Ek + Eg`

14. Answers will vary.

Code

```
GlowScript 2.7 VPython
#Window setup
scene.center = vector(0,100,0)
scene.range=256
scene.width =640
scene.height = 500
scene.background = vector(0.8,0.8,0.8)
#objects
initialheight=150
redball=sphere(pos=vector(0,initialheight,0),color=vector(1,0,0),radius=2.5,make_trail=True,trail_type="points",trail_radius=2.5,interval=100,retain=1000)
redball.mass = 100
#building
building=box(pos=vector(-50,75,0),color=vector(0,0,0),size=vector(50,150,1))
#ground
v1=vector(100,0,0)
v2=vector(-100,0,0)
ground=curve(pos=[v1,v2],color=vector(0,0,0))
#time and time step
t=0
tf=50
dt = 0.01
#initial conditions
g=vector(0,-9.81,0)
redballvelocity=vector(0,0,0)
redball.p=redball.mass * redballvelocity
#click to start
cts = label(pos=vector(-180,0,0), text='Click to Start', space=30, height=16, border=5, font='sans', box=False)
clicktostart = scene.waitfor('click')
#graph set up
gd2 = graph(width=600, height=150, title='Energy of a Falling Mass', xtitle='Time(s)', ytitle='Energy (J)')
graph1= gcurve (color= color.red)
graph2= gcurve (color= color.blue)
graph3= gcurve (color= color.green)
#calculation loop
while t < tf:
rate(500)
redball.pos = redball.pos + redballvelocity*dt
redballvelocity = redballvelocity + g*dt
Ek = 0.5*redball.mass*(mag(redballvelocity))**2
Eg = -redball.mass*redball.pos.y*g.y
ME = Ek + Eg
graph1.plot (t, Ek)
graph2.plot (t,Eg)
graph3.plot (t, ME)
if (redball.pos.y<=0):
break
t = t + dt
print('final velocity = ' ,redballvelocity.y)
print('Eg final = ' ,Eg)
print('Ek final = ' ,Ek)
print('ME = ' ,ME)
print("t = ", t, "s")
```