This is an old revision of the document!


Ball on a Ramp

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
  1. Make the ball follow the ramp instead of straight across the screen
    1. (Hint: see what code makes the ball move to the right to help determine how to make the ball move up or down)
  2. Add code to make the ball stop at the end of the ramp regardless of the angle or height of the ramp
  3. Use the data given to your group to calculate the acceleration for your ramp. Change the acceleration in the code to match this value
    1. (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
  4. 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
  1. How did increasing the height of the ramp (by adding more books) change the final speed of the ball? Explain.
  2. How could increasing the length of the ramp (but keeping the height the same) impact the speed of the ball? Explain.
  3. Does your simulation truly represent the change in speed of a ball rolling down a ramp? Why or why not?
  4. 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.
  5. How could you change your code to reflect of of the changes listed in the previous question?
  6. What calculations did you need to do to determine the stop point for the ball?
  7. In the following code, “pos” tells us position. What does “axis” tell us?
      1. ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white)

Code

Incomplete

Link

  1. GlowScript 2.7 VPython
  2.  
  3. # Window setup########################
  4. scene.width = 800 #The width of your view window
  5. scene.height = 400 #The height of your view window
  6.  
  7. ######################################
  8.  
  9. # Parameters and Initial Conditions###
  10. BaR = 10 #Radius of the ball
  11. BaS = 1 #Scalar to change ball speed
  12. Bh = 5 #Height of books in first stack of books
  13. Bw = 30 #Width of books in first stack of books
  14. Bs = -100 #X-value offset of the center of the first book stack
  15. Tt = 0 #reference point for drawing the books (not used in any real math)
  16. Bc = 1 #condition for beginning to draw books (checked against time)
  17. R1L = 100 #Length of first ramp
  18. nB = 5 #The number of books in the first stack
  19. A1 = 0 #Acceleration of ramp 1
  20. #########################################
  21.  
  22. # Time and time step#####################
  23. t = 0 #start time (this command sets the counter to 0)
  24. tFinal = 200 #The end number on the counter to stop actions
  25. #########################################
  26.  
  27. #Ramp and speed calculations#############
  28. R1Y = Bh*nB #Starting Y-value coordinate for ramp (total Y value of ramp)
  29. R1X = sqrt(R1L**2 - R1Y**2) #Starting X-value coordinate for ramp (total X value of ramp)
  30. S1x = R1X/R1L*BaS #the horizontal vector of movement down first ramp
  31. S1y = R1Y/R1L*BaS #the vertical vector of movement down first ramp
  32. #########################################
  33.  
  34. #Drawing initial objects#################
  35. #draw tabletop
  36. Table= box(pos = vector(75,-6,0), size = vector(400, 10, 30), color = color.orange)
  37.  
  38. #Stack of books
  39. Bc = Tt
  40. while t<nB:
  41. Bc = Tt + Bh*t +Bh/2
  42. book = cylinder(pos = vector(Bs, Bc, 0), axis = vec(Bw, 0, 0), radius = Bh, color = color.yellow)
  43. t=t+1
  44. ballstopx = Bs - Bw/2 - R1L/2
  45. t=t+1
  46.  
  47. #Downward Ramp
  48. R1h = Tt + Bh*t +Bh/2
  49. R1s = Bs + Bw
  50. ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white)
  51.  
  52. #Ball
  53. BaX = R1s + BaR/2
  54. BaY = R1h+Bh + BaR/2
  55. ball = sphere(pos=vec(BaX,BaY,0), radius = BaR/2, color=color.red)
  56. ##########################################
  57.  
  58. #MOVEMENT COMMANDS LOCATED BELOW###############################################################################
  59.  
  60.  
  61. #Command for ball rolling down first ramp###################################################
  62.  
  63. scene.camera.follow(ball) #this makes the camera follow the ball
  64. t=0 #resets the time counter to 0 at the start of the loop
  65.  
  66. theta = acos(R1X/R1L) #this calculates angle of the ramp
  67. A1x = sin(theta)*cos(theta) #calculates x-value of acceleration
  68. A1y = sin(theta)*sin(theta) #calculates y-value of acceleration
  69.  
  70. while t<tFinal: #sets the condition for this command taking place
  71. rate(20) #how many times per cycle the action will take place
  72. ball.pos.x = ball.pos.x + S1x #updates the x position of the ball at rate listed above every sec
  73.  
  74. t=t+1 #makes it so ever cycle it adds 1 to the time counter
  75.  
  76. # if ???: #sets condition for when the ball should stop moving
  77. # t=tFinal #sets the timer to the final value, so the loop stops
Partially Complete
  1. GlowScript 2.7 VPython
  2.  
  3. # Window setup############################################################################
  4. scene.width = 800 #how far the view extends along the X-axis initially
  5. scene.height = 600 #how tall the view extends on the Y-axis initially
  6.  
  7. ##########################################################################################
  8.  
  9.  
  10. # Parameters and Initial Conditions#######################################################
  11. BaR = 10 #radius of the ball (balldia)
  12. BaS = 1 #Scalar of speed for ball (ballspeed)
  13. Bh = 5 #Y-value of individual books (bookheight)
  14. Bw = 30 #X-value of the individual books (bookwidth)
  15. Bs = -100 #X-value of the centerpoint of the stack of books (bookstack)
  16. Tt = 0 #refrence point for drawing the books (tabletop)
  17. Bc = 1 #condition for beginning to draw books (checked against time)(numberbooks)
  18. R1L = 100 #Length of down ramp (ramplength)
  19. R1T = 10 #height of the ramp (rampthickness)
  20. nB = 8 #The number of books in the initial stack (numberofbooks)
  21. A1 = .1 #acceleration for ramp 1 determined by students from data
  22.  
  23. ###########################################################################################
  24.  
  25.  
  26. # Introduction of Objects#################################################################
  27. #books drawn one at a time in code
  28. #ramp drawn on top of books in code
  29. #ball drawn on top of ramp in code
  30.  
  31. ##########################################################################################
  32.  
  33.  
  34. # Time and time step######################################################################
  35. t = 0 #start time
  36. t2 = 0 #start line for second stack of books ***
  37. tFinal = 100 #First phase final time
  38. dt = 1 #rate of time change
  39. ##########################################################################################
  40.  
  41.  
  42. #MAIN CODE LOCATED BELOW
  43.  
  44. #Ramp and speed calculations##############################################################
  45. R1Y = Bh*nB #Starting Y-value of top of ramp (rampy)
  46. R1X = sqrt(R1L**2 - R1Y**2) #distance of ramp from stack of books (x-value) (rampx)
  47. S1x = R1X/R1L*BaS #the horizontal vector of movement (speedx)
  48. S1y = R1Y/R1L*BaS #the vertical vector of movement (speedy)
  49. A1x = R1X/R1L*A1 # horizontal acceleration
  50. A1y = R1Y/R1L*A1 # vertical acceleration
  51. ##########################################################################################
  52.  
  53.  
  54. #Drawing initial objects##################################################################
  55. #draw tabletop
  56. Table= box(pos = vector(75,-6,0), size = vector(400, 10, 30), color = color.orange)
  57.  
  58. #Stack of books
  59. Bc = Tt
  60. while t<nB:
  61. Bc = Tt + Bh*t +Bh/2
  62. book = cylinder(pos = vector(Bs, Bc, 0), axis = vec(Bw, 0, 0), radius = Bh, color = color.yellow)
  63. t=t+1
  64. t=t+1
  65.  
  66. #Downward Ramp
  67. R1h = Tt + Bh*t +Bh/2
  68. R1s = Bs + Bw
  69. ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white)
  70.  
  71. #Ball
  72. BaX = R1s + BaR/2
  73. BaY = R1h+Bh + BaR/2
  74. ball = sphere(pos=vec(BaX,BaY,0), radius = BaR/2, color=color.red)
  75.  
  76. scene.camera.follow(ball) #this makes the camera follow the ball
  77. t=0 #reset counter to zero
  78. ###########################################################################################
  79.  
  80. #Command for ball rolling down first ramp##################################################
  81. while t<tFinal:
  82. rate(20) #how many times per second the action will take place
  83. ball.pos.x = ball.pos.x + S1x
  84. ball.pos.y = ball.pos.y - S1y
  85. S1x = S1x + A1x
  86. S1y = S1y + A1y
  87. t=t+1
  88.  
  89. #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
  90.  
  91. if ball.pos.x > R1s + R1X:
  92. t=tFinal

Answer Key

Handout

Evaluation Questions
  1. Increasing the height of the ramp did not affect the final speed of the ball.
  2. Increasing the length of the ramp increased the final speed of the ball.
  3. The simulation is not realistic; When a ball rolls down a ramp, it is moved due to the force of gravity; however, it cannot fall straight down since it is restricted by the ramp. On a completely horizontal surface, gravity and the normal force perfectly balance each other out, and there is no acceleration. As the ramp becomes steeper, the less the force of gravity is resisted by the normal force. For a completely vertical surface, there will be no normal force and therefore the force of gravity pulls the ball towards the earth unimpeded. This means that increasing the ramp height should increase the speed of the ball. Additionally, changing the length of the ramp should not affect the final speed of the ball. Although a ball rolling down a steeper ramp will accelerate faster, the final speed of the ball at the end of the ramp will be the same, regardless of ramp length (ignoring frictional forces). This can be demonstrated by relating the potential and kinetic energy. We can set potential energy equation equal to the kinetic energy equation to find the speed of the ball is affected by the ramp: $$mgh=\dfrac{1}{2}mv^2$$ where $m$ is mass of the ball, $g$ is the acceleration of gravity, $h$ is the height of the ramp, and $v$ is the speed of the ball. Since the mass, force of gravity, and height of the ramp does not change when you lengthen the ramp, the velocity will be the same.
  4. Adding a coefficient of friction could reduce the speed of the ball. This is because frictional forces resist motion.
  5. See below

Code

Link

  1. GlowScript 2.7 VPython
  2.  
  3. # Window setup############################################################################
  4. scene.width = 800 #how far the view extends along the X-axis initially
  5. scene.height = 600 #how tall the view extends on the Y-axis initially
  6.  
  7. ##########################################################################################
  8.  
  9.  
  10. # Parameters and Initial Conditions#######################################################
  11. BaR = 10 #radius of the ball (balldia)
  12. BaS = 1 #Scalar of speed for ball (ballspeed)
  13. Bh = 5 #Y-value of individual books (bookheight)
  14. Bw = 30 #X-value of the individual books (bookwidth)
  15. Bs = -100 #X-value of the centerpoint of the stack of books (bookstack)
  16. Tt = 0 #refrence point for drawing the books (tabletop)
  17. Bc = 1 #condition for beginning to draw books (checked against time)(numberbooks)
  18. R1L = 100 #Length of down ramp (ramplength)
  19. R1T = 10 #height of the ramp (rampthickness)
  20. nB = 8 #The number of books in the initial stack (numberofbooks)
  21. A1 = .1 #acceleration for ramp 1 determined by students from data
  22.  
  23. ###########################################################################################
  24.  
  25.  
  26. # Introduction of Objects#################################################################
  27. #books drawn one at a time in code
  28. #ramp drawn on top of books in code
  29. #ball drawn on top of ramp in code
  30.  
  31. ##########################################################################################
  32.  
  33.  
  34. # Time and time step######################################################################
  35. t = 0 #start time
  36. t2 = 0 #start line for second stack of books ***
  37. tFinal = 100 #First phase final time
  38. dt = 1 #rate of time change
  39. ##########################################################################################
  40.  
  41.  
  42. #MAIN CODE LOCATED BELOW
  43.  
  44. #Ramp and speed calculations##############################################################
  45. R1Y = Bh*nB #Starting Y-value of top of ramp (rampy)
  46. R1X = sqrt(R1L**2 - R1Y**2) #distance of ramp from stack of books (x-value) (rampx)
  47. S1x = R1X/R1L*BaS #the horizontal vector of movement (speedx)
  48. S1y = R1Y/R1L*BaS #the vertical vector of movement (speedy)
  49. A1x = R1X/R1L*A1 # horizontal acceleration
  50. A1y = R1Y/R1L*A1 # vertical acceleration
  51. ##########################################################################################
  52.  
  53.  
  54. #Drawing initial objects##################################################################
  55. #draw tabletop
  56. Table= box(pos = vector(75,-6,0), size = vector(400, 10, 30), color = color.orange)
  57.  
  58. #Stack of books
  59. Bc = Tt
  60. while t<nB:
  61. Bc = Tt + Bh*t +Bh/2
  62. book = cylinder(pos = vector(Bs, Bc, 0), axis = vec(Bw, 0, 0), radius = Bh, color = color.yellow)
  63. t=t+1
  64. t=t+1
  65.  
  66. #Downward Ramp
  67. R1h = Tt + Bh*t +Bh/2
  68. R1s = Bs + Bw
  69. ramp1 = cylinder(pos = vector(R1s, R1h, 0), axis = vec(R1X, -R1Y, 0), radius = Bh, color = color.white)
  70.  
  71. #Ball
  72. BaX = R1s + BaR/2
  73. BaY = R1h+Bh + BaR/2
  74. ball = sphere(pos=vec(BaX,BaY,0), radius = BaR/2, color=color.red)
  75.  
  76. scene.camera.follow(ball) #this makes the camera follow the ball
  77. t=0 #reset counter to zero
  78. ###########################################################################################
  79.  
  80. #Command for ball rolling down first ramp##################################################
  81. while t<tFinal:
  82. rate(20) #how many times per second the action will take place
  83. ball.pos.x = ball.pos.x + S1x
  84. ball.pos.y = ball.pos.y - S1y
  85. S1x = S1x + A1x
  86. S1y = S1y + A1y
  87. t=t+1
  88.  
  89. #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
  90.  
  91. if ball.pos.x > R1s + R1X:
  92. t=tFinal

See Also

  • repository/ball_on_a_ramp.1616627172.txt.gz
  • Last modified: 2021/03/24 23:06
  • by porcaro1