Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
repository:cat_toy [2020/04/02 00:56]
porcaro1 [Cat Toy]
repository:cat_toy [2021/04/07 22:37]
porcaro1
Line 2: Line 2:
 ====Cat Toy==== ====Cat Toy====
 ===Premise=== ===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 [[https://​www.glowscript.org/​ | GlowScript]].+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=== ===Minimally Working Program===
 +[https://​www.glowscript.org/#/​user/​porcaro1/​folder/​RepositoryPrograms/​program/​CatToy-Incomplete | Link]
 <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​ <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​
  
Line 50: Line 51:
   - Modify the code above to get your system to behave as an ideal simple harmonic oscillator. Ignore external forces such as gravity.   - Modify the code above to get your system to behave as an ideal simple harmonic oscillator. Ignore external forces such as gravity.
   - Plot the potential, kinetic, and total energy of the mass-spring system as they relate to time (hint: use the plot command in GlowScript).   - Plot the potential, kinetic, and total energy of the mass-spring system as they relate to time (hint: use the plot command in GlowScript).
-  - (Optional 1): Add a linear damping effect to your system with a damping coefficient ​(c).+  - (Optional 1): Add a linear damping effect to your system with a damping coefficient ​"c".
   - (Optional 2): Make your system into a vertical mass-spring system and include the force of gravity in your calculations.   - (Optional 2): Make your system into a vertical mass-spring system and include the force of gravity in your calculations.
 {{ :​repository:​cattoy.png?​nolink|}} {{ :​repository:​cattoy.png?​nolink|}}
  
 ===Working Code=== ===Working Code===
 +[https://​www.glowscript.org/#/​user/​porcaro1/​folder/​RepositoryPrograms/​program/​CatToy-Solution1 | Link]
 **Horizontal Spring (with Optional Linear Damping)** **Horizontal Spring (with Optional Linear Damping)**
 <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​ <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​
Line 121: Line 123:
     ​     ​
 **Vertical Spring with Gravity** **Vertical Spring with Gravity**
 +[https://​www.glowscript.org/#/​user/​porcaro1/​folder/​RepositoryPrograms/​program/​CatToy-Solution2 | Link]
 <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​ <code Python [enable_line_numbers="​true",​ highlight_lines_extra="​0"​]>​
 GlowScript 2.7 VPython GlowScript 2.7 VPython
  • repository/cat_toy.txt
  • Last modified: 2021/04/07 22:43
  • by porcaro1