Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
repository:angry_birds [2021/01/20 19:06] porcaro1 [Answer Key] |
repository:angry_birds [2021/02/18 19:40] porcaro1 [Answer Key] |
||
---|---|---|---|
Line 2: | Line 2: | ||
====Activity Information==== | ====Activity Information==== | ||
===Learning Goals=== | ===Learning Goals=== | ||
- | * | + | *Model a projectile ([[https://www.nextgenscience.org/pe/hs-ps2-1-motion-and-stability-forces-and-interactions | HS-PS2-1]]) |
+ | *Be able to determine launch angle and velocity given target location | ||
===Prior Knowledge Required=== | ===Prior Knowledge Required=== | ||
- | * | + | *Trigonometry |
+ | *Decomposing vectors | ||
+ | *Kinematics in 2-Dimensions | ||
===Code Manipulation=== | ===Code Manipulation=== | ||
- | * | + | *Modify existing code |
+ | *Translate physical quantities and equations into code | ||
---- | ---- | ||
====Activity==== | ====Activity==== | ||
===Handout=== | ===Handout=== | ||
+ | {{ :repository:angrybirds.png?nolink&600|}} | ||
** Angry Birds ** | ** Angry Birds ** | ||
+ | |||
You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation. | You have set up your Angry Bird catapult 250 m away from a pig encampment in order to destroy them. The encampment is here on Earth. You are to ignore the effects of air friction in your calculations and computer simulation. | ||
Line 22: | Line 28: | ||
- Adjust this code so that it fits the second scenario | - Adjust this code so that it fits the second scenario | ||
===Code=== | ===Code=== | ||
+ | [[https://www.glowscript.org/#/user/porcaro1/folder/RepositoryPrograms/program/AngryBirds-Incomplete | Link]] | ||
<code Python [enable_line_numbers="true"]> | <code Python [enable_line_numbers="true"]> | ||
+ | GlowScript 3.0 VPython | ||
floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue) | crate1 = box(pos=vector(-145,7,0), size=vector(10,10,3), color=color.blue) | ||
Line 33: | Line 41: | ||
crate1v=vector(25,5,0) | crate1v=vector(25,5,0) | ||
while crate2.pos.x-crate1.pos.x>20: | while crate2.pos.x-crate1.pos.x>20: | ||
- | rate(50) | + | rate(250) |
crate1.pos=crate1.pos+crate1v*dt | crate1.pos=crate1.pos+crate1v*dt | ||
t=t+dt | t=t+dt | ||
Line 44: | Line 52: | ||
- Now that we know the angle, we can find our horizontal and vertical components of velocity by simply plugging $\theta$ into the two substitutions above: $v_x=50\cos(39.3°)=38.7$ m/s and $v_y=50\sin(39.3°)=31.6$ m/s. | - Now that we know the angle, we can find our horizontal and vertical components of velocity by simply plugging $\theta$ into the two substitutions above: $v_x=50\cos(39.3°)=38.7$ m/s and $v_y=50\sin(39.3°)=31.6$ m/s. | ||
- The process for figuring out how to hit the second encampment 52 m above the first one is relatively similar, with two key differences. Firstly, we need to increase the sling-shot speed; at 50 m/s, no matter what angle you aim the bird, it will never reach the encampment. Increasing it to 75 m/s should be sufficient. Secondly, we need to adjust the $y$ in the system of equations from 0 to 52 to model the elevation difference between the two encampments. With these changes, we can follow the process detailed in part 1 & 2. We find that $\theta=25.4°$, $v_x=67.7$ m/s, and $v_y=32.2$ m/s. | - The process for figuring out how to hit the second encampment 52 m above the first one is relatively similar, with two key differences. Firstly, we need to increase the sling-shot speed; at 50 m/s, no matter what angle you aim the bird, it will never reach the encampment. Increasing it to 75 m/s should be sufficient. Secondly, we need to adjust the $y$ in the system of equations from 0 to 52 to model the elevation difference between the two encampments. With these changes, we can follow the process detailed in part 1 & 2. We find that $\theta=25.4°$, $v_x=67.7$ m/s, and $v_y=32.2$ m/s. | ||
+ | |||
+ | {{ :repository:angrybirdssolution.png?nolink&600 |}} | ||
+ | |||
+ | ==Post-Coding Solutions== | ||
+ | See highlighted code below: | ||
===Code=== | ===Code=== | ||
- | <code Python [enable_line_numbers="true", highlight_lines_extra=""]> | + | ==Scenario 1== |
- | </code> | + | [[https://www.glowscript.org/#/user/porcaro1/folder/RepositoryPrograms/program/AngryBirds-Solution1 | Link]] |
+ | <code Python [enable_line_numbers="true", highlight_lines_extra="3,4,10,11,13,16"]> | ||
+ | GlowScript 3.0 VPython | ||
+ | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
+ | crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) | ||
+ | crate2 = box(pos=vector(105,10,0), size=vector(20,20,5), color=color.red) | ||
+ | |||
+ | #Setting the time interval | ||
+ | t=0 | ||
+ | dt=0.01 | ||
+ | |||
+ | crate1v=vector(38.7,31.6,0) | ||
+ | crate1a=vector(0,-9.8,0) | ||
+ | |||
+ | while crate2.pos.x-crate1.pos.x>10: | ||
+ | rate(250) | ||
+ | crate1.pos=crate1.pos+crate1v*dt | ||
+ | crate1v=crate1v+crate1a*dt | ||
+ | t=t+dt </code> | ||
+ | ==Scenario 2== | ||
+ | <code Python [enable_line_numbers="true", highlight_lines_extra="3,4,10,11,13,16"]> | ||
+ | GlowScript 3.0 VPython | ||
+ | floor = box(pos=vector(0,0,0), size=vector(300,4,12), color=color.white) | ||
+ | crate1 = box(pos=vector(-145,10,0), size=vector(10,10,3), color=color.blue) | ||
+ | crate2 = box(pos=vector(105,62,0), size=vector(20,20,5), color=color.red) | ||
+ | |||
+ | #Setting the time interval | ||
+ | t=0 | ||
+ | dt=0.01 | ||
+ | |||
+ | crate1v=vector(67.7,32.2,0) | ||
+ | crate1a=vector(0,-9.8,0) | ||
+ | |||
+ | while crate2.pos.x-crate1.pos.x>10: | ||
+ | rate(200) | ||
+ | crate1.pos=crate1.pos+crate1v*dt | ||
+ | crate1v=crate1v+crate1a*dt | ||
+ | t=t+dt </code> | ||
---- | ---- | ||
====See Also==== | ====See Also==== | ||
- | * | + | *[[ball_launch | Ball Launch]] |
+ | *[[cirque_du_soleil_stunt | Cirque du Soleil Stunt]] |