This is an old revision of the document!
Title
Activity Information
Learning Goals
- Analyze data to support the claim that Newton's second law of motion describes the mathematical relationship among the net force on a macroscopic object, its mass, and its acceleration ( HS-PS2-1)
- Students will develop and use models to verify mathematical computations
- Use mathematics and computational thinking to quantify variables (velocity, acceleration, force, mass, gravity)
- Use mathematical representations to support the claim that the total momentum of a system of objects is conserved when there is no net force on the system ( HS-PS2-2)
- Developing an using models, communicating information, asking questions, defining problems and solutions
Prior Knowledge Required
- Kinematic formulae
- speed, velocity, acceleration
- Basic coding commands and coding logic
- Force of gravity (constant acceleration)
Code Manipulation
- Manipulating variables and code
- Generating code based on physics knowledge
- While loops
—-
Activity
Handout
Ball on a Ramp
Provided below is some code that is supposed to model the behavior of a ball rolling down an inclined plane. Run the code.
Exploration Instructions
Find the variables below and record their abbreviations. Change them, one at a time, to see how they impact the code performance. Discuss what changes and what remains consistent:
- Ramp length
- Ball speed
- Time interval
- Number of books in the stack
- Acceleration
Reset variables to the following:
- Ramp length = 100
- Time interval = 10
- Number of books in the stack = 1
- Acceleration = 0
Now run this code. Describe the motion of the ball. Does this represent real world physics? Why or why not? What would need to change?
Coding Instructions
- Make the ball follow the ramp instead of straight across the screen
- (Hint: see what code makes the ball move to the right to help determine how to make the ball move up or down)
- Add code to make the ball stop at the end of the ramp regardless of the angle or height of the ramp
- Use the data given to your group to calculate the acceleration for your ramp. Change the acceleration in the code to match this value
- (Note: different values may be provided to different students/groups, but for the sake of consistency, we will use the following values:)
- Ramp length = 100
- Ball speed = 1
- Time interval = 100
- Number of books in the stack = 8
- If necessary, change the code to make the motion of the ball to reflect the true motion of a ball held at the top of a ramp and let go from an initial velocity of zero
Evaluation Questions
- How did increasing the height of the ramp (by adding more books) change the final speed of the ball? Explain.
- How could increasing the length of the ramp (but keeping the height the same) impact the speed of the ball? Explain.
- Does your simulation truly represent the change in speed of a ball rolling down a ramp? Why or why not?
- What could be changed about the ramp itself (besides its height or length) in the real world to make the ball either have more or less speed at the bottom of the ramp? Explain.
- How could you change your code to reflect of of the changes listed in the previous question?
- What calculations did you need to do to determine the stop point for the ball?
- In the following code, “pos” tells us position. What does “axis” tell us?
- ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white)
Code
GlowScript 2.7 VPython # Window setup######################## scene.width = 800 #The width of your view window scene.height = 400 #The height of your view window ###################################### # Parameters and Initial Conditions### BaR = 10 #Radius of the ball BaS = 1 #Scalar to change ball speed Bh = 5 #Height of books in first stack of books Bw = 30 #Width of books in first stack of books Bs = -100 #X-value offset of the center of the first book stack Tt = 0 #reference point for drawing the books (not used in any real math) Bc = 1 #condition for beginning to draw books (checked against time) R1L = 100 #Length of first ramp nB = 5 #The number of books in the first stack A1 = 0 #Acceleration of ramp 1 ######################################### # Time and time step##################### t = 0 #start time (this command sets the counter to 0) tFinal = 200 #The end number on the counter to stop actions ######################################### #Ramp and speed calculations############# R1Y = Bh*nB #Starting Y-value coordinate for ramp (total Y value of ramp) R1X = sqrt(R1L**2 - R1Y**2) #Starting X-value coordinate for ramp (total X value of ramp) S1x = R1X/R1L*BaS #the horizontal vector of movement down first ramp S1y = R1Y/R1L*BaS #the vertical vector of movement down first ramp ######################################### #Drawing initial objects################# #draw tabletop Table= box(pos = vector(75,-6,0), size = vector(400, 10, 30), color = color.orange) #Stack of books Bc = Tt while t<nB: Bc = Tt + Bh*t +Bh/2 book = cylinder(pos = vector(Bs, Bc, 0), axis = vec(Bw, 0, 0), radius = Bh, color = color.yellow) t=t+1 ballstopx = Bs - Bw/2 - R1L/2 t=t+1 #Downward Ramp R1h = Tt + Bh*t +Bh/2 R1s = Bs + Bw ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white) #Ball BaX = R1s + BaR/2 BaY = R1h+Bh + BaR/2 ball = sphere(pos=vec(BaX,BaY,0), radius = BaR/2, color=color.red) ########################################## #MOVEMENT COMMANDS LOCATED BELOW############################################################################### #Command for ball rolling down first ramp################################################### scene.camera.follow(ball) #this makes the camera follow the ball t=0 #resets the time counter to 0 at the start of the loop theta = acos(R1X/R1L) #this calculates angle of the ramp A1x = sin(theta)*cos(theta) #calculates x-value of acceleration A1y = sin(theta)*sin(theta) #calculates y-value of acceleration while t<tFinal: #sets the condition for this command taking place rate(20) #how many times per cycle the action will take place ball.pos.x = ball.pos.x + S1x #updates the x position of the ball at rate listed above every sec t=t+1 #makes it so ever cycle it adds 1 to the time counter # if ???: #sets condition for when the ball should stop moving # t=tFinal #sets the timer to the final value, so the loop stops
Answer Key
Handout
Evaluation Questions
- Ordered List Item
Code
GlowScript 2.7 VPython # Window setup############################################################################ scene.width = 800 #how far the view extends along the X-axis initially scene.height = 600 #how tall the view extends on the Y-axis initially ########################################################################################## # Parameters and Initial Conditions####################################################### BaR = 10 #radius of the ball (balldia) BaS = 1 #Scalar of speed for ball (ballspeed) Bh = 5 #Y-value of individual books (bookheight) Bw = 30 #X-value of the individual books (bookwidth) Bs = -100 #X-value of the centerpoint of the stack of books (bookstack) Tt = 0 #refrence point for drawing the books (tabletop) Bc = 1 #condition for beginning to draw books (checked against time)(numberbooks) R1L = 100 #Length of down ramp (ramplength) R1T = 10 #height of the ramp (rampthickness) nB = 8 #The number of books in the initial stack (numberofbooks) A1 = .1 #acceleration for ramp 1 determined by students from data ########################################################################################### # Introduction of Objects################################################################# #books drawn one at a time in code #ramp drawn on top of books in code #ball drawn on top of ramp in code ########################################################################################## # Time and time step###################################################################### t = 0 #start time t2 = 0 #start line for second stack of books *** tFinal = 100 #First phase final time dt = 1 #rate of time change ########################################################################################## #MAIN CODE LOCATED BELOW #Ramp and speed calculations############################################################## R1Y = Bh*nB #Starting Y-value of top of ramp (rampy) R1X = sqrt(R1L**2 - R1Y**2) #distance of ramp from stack of books (x-value) (rampx) S1x = R1X/R1L*BaS #the horizontal vector of movement (speedx) S1y = R1Y/R1L*BaS #the vertical vector of movement (speedy) A1x = R1X/R1L*A1 # horizontal acceleration A1y = R1Y/R1L*A1 # vertical acceleration ########################################################################################## #Drawing initial objects################################################################## #draw tabletop Table= box(pos = vector(75,-6,0), size = vector(400, 10, 30), color = color.orange) #Stack of books Bc = Tt while t<nB: Bc = Tt + Bh*t +Bh/2 book = cylinder(pos = vector(Bs, Bc, 0), axis = vec(Bw, 0, 0), radius = Bh, color = color.yellow) t=t+1 t=t+1 #Downward Ramp R1h = Tt + Bh*t +Bh/2 R1s = Bs + Bw ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white) #Ball BaX = R1s + BaR/2 BaY = R1h+Bh + BaR/2 ball = sphere(pos=vec(BaX,BaY,0), radius = BaR/2, color=color.red) scene.camera.follow(ball) #this makes the camera follow the ball t=0 #reset counter to zero ########################################################################################### #Command for ball rolling down first ramp################################################## while t<tFinal: rate(20) #how many times per second the action will take place ball.pos.x = ball.pos.x + S1x ball.pos.y = ball.pos.y - S1y S1x = S1x + A1x S1y = S1y + A1y t=t+1 #Stopping ball motion at end of ramp #see if the ball is at the position of the ramp + rampx (total position on the screen is the two combined if ball.pos.x > R1s + R1X: t=tFinal