This is an old revision of the document!


Modeling 1D Mass-Spring System and Energy

Cat Toy

Premise

After a long day of work, you return home to be greeted by your favorite feline companion, TicTac. Most days, you would usually play with TicTac by tossing his favorite toy (a bright, red block stuffed full of catnip) around the room and watching him chase it from one end to the other. Unfortunately, today you are just too tired to throw TicTac's block. Instead you decide to fix the block to a spring so that TicTac can get his exercise with as little effort as possible on your end. You attach the apparatus to a wall, giving the block a slight push, and it begins oscillating back and forth. TicTac is more excited than ever, as his block is now moving in a way that he never knew possible. Deciding that you are curious about this unique form of motion, you choose to computationally model the motion in GlowScript.

Minimally Working Program

  1. GlowScript 2.7 VPython
  2.  
  3. L0 = 5 #Spring length
  4. k = 1 #Spring constant
  5.  
  6. track = box(pos = vec(0,0,0), size = vec(10,0.1,2), color = color.gray(0.7))
  7. wall = box(pos = vec(-4.75,1,0), size = vec(0.5,2,2), color = color.gray(0.7))
  8. block = box(pos = vec(0,1,0), size = vec(2,2,2), color = color.red)
  9. spring = helix(pos = wall.pos, size = vec(mag(block.pos-wall.pos),0.75,0.75), axis = block.pos-
  10. wall.pos, color = color.red)
  11. spring.thickness = 0.1
  12.  
  13. L = block.pos - spring.pos
  14. Lhat = L/mag(L)
  15. s = mag(L) - L0
  16.  
  17. Fspring = vec(0,0,0)
  18. Fnet = vec(0,0,0)
  19.  
  20. block.mass = 0.3
  21. block.p = vec(1.05,0,0)
  22.  
  23. t = 0
  24. dt = 0.05
  25.  
  26. while t < 100:
  27. rate(100)
  28.  
  29. L = block.pos - spring.pos
  30. Lhat = L/mag(L)
  31. s = mag(L) - L0
  32.  
  33. block.p = block.p + Fnet*dt
  34. block.pos = block.pos + block.p/block.mass*dt
  35.  
  36. spring.axis = Lhat
  37. spring.size = vec(mag(L),0.75,0.75)
  38.  
  39. t = t + dt

Tasks

  1. Modify the code above to get your system to behave as an ideal simple harmonic oscillator. Ignore external forces such as gravity.
  2. Plot the potential, kinetic, and total energy of the mass-spring system as they relate to time (hint: use the plot command in GlowScript).
  3. (Optional 1): Add a linear damping effect to your system with a damping coefficient ©.
  4. (Optional 2): Make your system into a vertical mass-spring system and include the force of gravity in your calculations.

Working Code

Debrief Questions

  1. What challenges do you anticipate facing when teaching a problem like this? What challenges do you anticipate your students facing when working on a problem like this?
  2. What would be some strategies for overcoming these challenges in your classroom?
  3. What computational practices are used in this problem? What expectations do you have for your students with respect to these practices? How would you communicate these practices to your students?
  4. Which physics concepts would you want your students to learn from this problem?
  5. How is the minimally working program designed so that students are forced to engage with the physics concepts? As a teacher, how can you emphasize physics concepts while avoiding teaching strictly coding?

Other Follow-up Questions

  1. If you had to specify one or several learning objectives for this assignment, what would they be?
  2. In an assignment such as this one, what pedagogical affordances does computation offer over other forms teaching? What limitations does computation provide?
  3. Can you think of any ways to make this problem more relevant to your students/classroom?
  4. What types of questions would you ask your students to add depth to this problem?
  5. How can your program be made more or less accurate to model a true physical system? What might be some sources of error or discrepancy?
  • repository/cat_toy.1585785816.txt.gz
  • Last modified: 2020/04/02 00:03
  • by porcaro1