Professional Documents
Culture Documents
Phys172 F19 Lab02 Final
Phys172 F19 Lab02 Final
LAST NAME (ALL CAPS) TUVDEN FIRST NAME (ALL CAPS) ORGIL
PUID: 031645257 LAB GROUP NUMBER 28
CIRCLE/HIGHLIGHT DAY & TIME CIRLCE/HIGHLIGHT LAB ROOM
TUE 11:30 1:30 3:30
WED 9:30 11:30 1:30 3:30 PHYS PHYS
THU 9:30 11:30 1:30 Rm 8 Rm 18
Q02: Run the code. How many times does the code run? Does this match your prediction? If not, explain why?
The code runs 19 times, It did not match our prediction, because x was coded to be less than 20.
Re-comment Part 1 of the code by adding one # in front of each line. Uncomment Part 2.
Examine the code and read through the comments after each line to determine what the code is doing.
Q03: What is the conditional statement checking in Loop 2?
The loop is checking the difference while x is subtracted by y is less than x/2.
Q04: Run the code. How many times does the loop run? What is the value of y when the program stops?
The code runs 35 times. Until the y reaches 25 it doesn’t stop.
Q05: Identify at least one thing in the while loop (lines 30–33) that you could change to make the loop run fewer times.
Describe the change below.
We can increase the constant or the slope, instead of “y=y-1” we can program “y=y-2” to run fewer times.
2
Push Cart VPython Simulation
Now you will use loops to model motion using the position update formula: 𝑟⃗𝑓 = 𝑟⃗𝑖 + 𝑣⃗∆𝑡
Q06: Describe how you think we can use while loops to predict the motion of an object using position update?
We can use the while loop for the time interval, such like first identifying x as the time and give a time interval.
Then the program can calculate position and velocity.
Next we analyze a computational model of push cart that you will be use in the next section. In the simulation, the cart is
moving along the track for 1m at a constant velocity.
In your Public GlowScript folder, create a new program called “PushCartSimulation”
Copy the code from the link below into your new program.
http://www.glowscript.org/#/user/phys172.labs/folder/Lab2/
Take a careful look through PushCartSimulation code.
Q07: Add comments to the code to explain what each part does. Ignore the part of the code where you are NOT asked
to comment i.e. the part of the code that creates the visual display.
Q08: Which section of the code is used to calculate the motion of our push cart [Not the visual display, but the
calculation]? Explain why.
The final section of the code is calculated to find the motion, The pushCart.pos = pushcart.pos + velocity + deltaT,
Because this calculations give you position of update and you can find distance traveled.
Modify the code so that it provides a more accurate estimate of the time at 0.5m.
Q10: Describe below what changes you made to the code. Explain why.
We can change deltaT to .01 instead of .1 to get one more decimal place to get a closer and more accurate
estimate.
3
Q11: How does the rate at which we record (or generate) data influence our results? Explain why.
Once we change the deltaT to a smaller number we can a better and more precise result.
Now imagine that our simulation was tracking the motion of a proton that has been accelerated to constant
terminal velocity trough a linear particle accelerator.
Q12: If we wanted to accurately estimate the time at which the proton passes through a specific checkpoint in the
accelerator, what might need to differ from the push cart example above? Why?
Make deltaT smaller so that we get more accurate estimate.
4
Q13: Identify in the velocity graph an interval of time where the velocity of the cart was
approximately constant. [Hint: If your data is too irregular, you can use the “Smoothing” tool on the tool
bar in the Graph display to smooth the data of your experiment so that you can easily decide in which
period of time the path is closest to constant velocity] What interval of time is that? and What is the
value of that “constant” velocity? [HINT: You can find the mean of the velocity in the period that
you chose, using the tool to calculate statistics of the active data Click on the capital ”Sigma”
button in the Tools bar on the top of the Graph display. NOTE: to select a specific interval of data,
you need to use the tool Highlight range in the same bar of tools used in the last item.]
The path that was closest to constant velocity was during the time interval of [1,2], The “constant” velocity is .17 m/s.
EACH STUDENT MUST TAKE A SCREEN CAPTURE OF THE RELEVANT PORTION OF GRAPH & PASTE IT BELOW.
Q14: In the velocity graph, using the value of average (“constant”) velocity and the time interval in the velocity vs.
time graph, predict the change in position [HINT: Use ∆𝑟⃗ = 𝑣⃗𝑎𝑣𝑔 ∆𝑡]
The change in position is .17 meters.
In the position graph, select the same time interval that you chose in the velocity graph above.
Q15: Use the position graph to determine the change in position, during that time interval [i.e. ∆𝑟⃗ during time of the
period where you consider the cart is moving with constant velocity.]
5
The position at time 2 is .47m the position at time 1 is .30m
EACH STUDENT MUST TAKE A SCREEN CAPTURE OF THE RELEVANT PORTION OF GRAPH & PASTE IT BELOW.
Q16: How do the values of the change in position as measured using the two methods above (one using ∆𝑟⃗ = 𝑣⃗𝑎𝑣𝑔 ∆𝑡
from the velocity graph and the other using ∆𝑟⃗ directly from the position graph) compare with each other?
They both equal to each other by .17 meters.
6
The first graph (PushCartSimulation) starts at position 0 and the second graph (PushCartSimulation2) starts at .15m
because placed the cart 15cm away from the origin before we pushed it. The first graph has steeper slope because
of its constant velocity being higher .3m/s and second graph was less steep because of its slope or constant
velocity being .17m/s. Also we use the constant velocity without taking other forces into count on the Vpython
Model vs. the physical experiment so in the physical experiment velocity decreases and the cart will eventually
stop. But in the VPython model position graph w
Q18: What assumptions about the cart system does the computational model make? Are these valid assumptions?
The computational model assumes that there are no other outside forces slowing down the cart after initial push
because we used the avg velocity from a certain time interval as the constant force. These aren’t valid assumptions
because there are other forces acting on the cart in the simulation that computational model doesn’t’ take into a
count.
Q19: How do these assumptions affect the accuracy of our results? For the push cart simulation, are the errors in the
results due to these assumptions negligible? Why or why not?
These assumptions affect the accuracy of our results by not taking other outside forces acting on the cart into
count. Yes, because we used an average velocity as constant force throughout the whole interval.
To conclude today’s lab, EACH STUDENT MUST share the link to their finished programs.
Q20: To share your programs, navigate to your Public folder tab, copy the URL from the browser bar into the box below:
https://www.glowscript.org/#/user/Orgilt7/folder/MyPrograms/program/PushCartSimulation/edit
https://www.glowscript.org/#/user/Orgilt7/folder/MyPrograms/program/PushCartSimulation2/edit
7
Group Members’ Signatures Lab TA Signature BEFORE LEAVING, EACH PERSON IN GROUP MUST
(Make sure all sign off on work) (Either GTA or UTA) Get signatures of every group member and a TA in
Orgil Tuvden Haotian the boxes on the left. If you are using the Word
version have each person type in their name.
Tara Reddy If you have printed it off, take photos of each page,
and combine them into a single PDF.
Lillian Starkey Upload the completed file (Word of PDF) into
Blackboard by 11:59 PM SATURDAY