This is an old revision of the document!
Head-On Collision
Activity Information
Learning Goals
*Students will be able to apply the principles of constant velocity motion *Students will be able to create and modify computational models to describe and show a given system
Prior Knowledge Required
- Units
- Dimensional analysis
- Constant velocity equation (kinematics)
- Vector and scalar quantities
Code Manipulation
- Copying/pasting code
- Creating/using while loops
- Converting mathematical equations into code
Activity
Handout
Head-On Collision You are part of a team that has been directed to film a head-on car crash for an action movie. You only have the funding for one take! So you must calculate where the crash will occur so that you can determine where to place the camera to get the shot. Look over the code (provided below) and determine:
- The initial positions of the vehicles
- The velocities of the vehicles
- Where and when the crash will occur
Once you have answered these questions, modify the code to test your answers.
Code
GlowScript 2.7 VPython #Background Screen Color and Size...***DO NOT CHANGE ANY OF THESE VALUES!! scene.range = 450 scene.center = vector(200,0,0) scene.width = 1000 scene.height = 400 scene.background = vector(0.7,0.7,0.6) #Definition of objects in the system...***DO NOT CHANGE ANY OF THESE VALUES!! ground = box(pos=vector(-120,-10,0),length=1200, height=20, width=20,color=color.blue) redcar = box(pos=vector(-350,10,0), length=40, height=20, width=20, color=color.red) greentruck = box(pos=vector(450,10,0), length=40, height=20, width=20, color=color.green) #Set the velocity for each vehicle greentruck.velocity = vector(0,0,0) redcar.velocity = vector(0,0,0) #Time and Time step t=0 tf=25 dt = 0.01 #Click Screen to Start scene.waitfor('click') #Calculation Loop while greentruck.pos.x > 0: rate (500) redcar.pos.x = redcar.pos.x + redcar.velocity.x * dt greentruck.pos.x = greentruck.pos.x + greentruck.velocity.x *dt t = t + dt #Text to be displayed on computer screen print ("Time = ",t) print ("Car Position x = ",redcar.pos.x) print ("Truck Position x = ",greentruck.pos.x)
Answer Key
Handout
Code
GlowScript 2.7 VPython scene.range = 450 scene.center = vector(200,0,0) scene.width = 1000 scene.height = 400 scene.background = vector(0.7,0.7,0.6) #define objects in system ground = box(pos=vector(-120,-10,0),length=1200, height=20, width=20,color=color.blue) redcar = box(pos=vector(-350,10,0), length=40, height=20, width=20, color=color.red) greentruck = box(pos=vector(450,10,0), length=40, height=20, width=20, color=color.green) #Set the velocity for each vehicle greentruck.velocity = vector(-40,0,0) redcar.velocity = vector(25,0,0) #Time and Time step t=0 tf=25 dt = 0.01 #Click Screen to Start scene.waitfor('click') #Calculation Loop while greentruck.pos.x > -42.32: rate (500) redcar.pos.x = redcar.pos.x + redcar.velocity.x * dt greentruck.pos.x = greentruck.pos.x + greentruck.velocity.x *dt t = t + dt #Text to be displayed on computer screen print ("Time = ",t) print ("Car Position x = ",redcar.pos.x) print ("Truck Position x = ",greentruck.pos.x)