Developed by Deva O'Neil - Published July 20, 2017
DOI: 10.1119/PICUP.Exercise.CoM
Subject Area | Mechanics |
---|---|
Level | First Year |
Available Implementations | Glowscript and Spreadsheet |
Learning Objectives |
* Students use a while loop to implement a summation (**Exercises 1 and 2**)
* Students distinguish between variables that are updated (accumulators) and variables that are recalculated in each iteration of a loop (**Exercises 1 and 2**)
* Students calculate the center of mass of a system numerically, and check the output for plausibility. (**Exercise 2**)
|
Time to Complete | 50 min |
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
* Under what circumstances would the program behave differently?
* Explain the purpose behind putting the variable “massSum” on both sides of the equal sign.
*Important hint* In the next exercise, you’ll be prompted to add lines to an existing program. Pay attention to whether the purpose of a line is to “update” a variable or to (re)calculate it. I use the word “update” in situations where the old value of a variable is used to calculate a new value. For example, this line would update a variable called x: ```python x = x + v*t ``` * Which “x” is the old value? In contrast, this would be a recalculation of x, but I would not call it an update: ```python x= v*t ``` Note that it does not use the old value. * In your while loop, what variable is “updated?” #Exercise 2 Open the template for Exercise 1, creating a new program so that you don't overwrite your previous program. The goal of this program to calculate the center of mass position of the system when the user creates multiple balls. The center of mass position will be marked with a white X on the screen. Every time a new ball is added, the X will move. ![](images/CoM/CoM.png "") The vector that represents the position of the system’s center of mass will be called rcm (meaning $\vec{r}_{cm}$), calculated as follows: $\vec{r}_{cm}=\frac{\Sigma ~ m_i \vec{r}_i}{\Sigma ~m_i}$ * Besides the sum of the masses, what else are you going to need to calculate (and update every loop) to find $\vec{r}_{cm}$? Use the summation symbol to express your answer.
FIll in the blanks provided in the template. ``` rcmNumerator = _______________________ ``` *Use symbols, NOT numerical values.* ``` rcm = rcmNumerator/__________ ``` Inside the while loop, after the existing commands, do the following: 1. Update rcmNumerator 2. Recalculate rcm 3. Print "New center of mass = " with the vector rcm following the text. Make sure that the correct units for rcm are printed out also. __Analysis__ Test your program by placing one new ball. Record the position of this new ball: _____________ * Calculate (without using your computer program) where the center of mass should be:
* Does it match your program’s output? Place more balls and verify visually that the X moves around in a way that makes sense. If your program works for one additional ball but not two, check your calculation of the numerator in the while loop. Does it "update" the variable based on its old value? * Explain how the behavior of the program will change if the masses of the white balls are changed to be the same as the starter ball.
Test your prediction. * Explain, in your own words, the physical significance of the center of mass of a system.
Download Options
Share a Variation
Credits and Licensing
Deva O'Neil, "Center of Mass for Point Particles," Published in the PICUP Collection, July 2017, https://doi.org/10.1119/PICUP.Exercise.CoM.
DOI: 10.1119/PICUP.Exercise.CoM
The instructor materials are ©2017 Deva O'Neil.
The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license