+
Vectors and Kinematics in Web VPython
Specialized VPython material developed by Keith Zengel - Published July 5, 2024
DOI: 10.1119/PICUP.Exercise.KInematicsVPython
These VPython exercises introduce the concepts of vectors, position, velocity, and acceleration in one and two dimensions. The shorter problems work well as in-class activities, while the longer problems work well as homework or project problems.
| Subject Area | Mechanics |
|---|---|
| Levels | High School and First Year |
| Specialized Implementation | VPython |
| Learning Objectives |
* Draw simple objects in VPython at a specific position (Exercises 1 – 12)
* Draw tip-to-tail vector addition (Exercises 1 and 6)
* Use a while loop to update the position at different times (Exercise 3 – 10)
* Animate an object moving with constant velocity in 1D (Exercises 3, 4, 8, and 10)
* Animate an object moving with constant acceleration in 1D (Exercise 4, 8, and 10)
* Animate an object moving with constant velocity in 2D (Exercises 7)
* Animate an object moving with constant acceleration in 2D (Exercise 9 and 10)
|
#Exercise 1: Tip-to-tail
1. Draw a vector A with coordinates (5,0,0)
2. Draw a vector B with coordinates (3,4,0)
3. Change the position "pos" of arrow B so that is begins at the end of arrow A
4. Create a new vector C. Have C start at the tail of arrow A and end at the tip of arrow B.
#Exercise 2: Squaring the Circle and The Boxer
##Squaring the Circle:
1. Draw 4 spheres. Call them ball1, ball2, ball3, and ball4
2. Arrange the 4 spheres so they are at the corners of a square
3. BONUS: set the radii of the spheres at the corners of the square so that the spheres touch.
4. BONUS: Draw 4 more spheres such that the 8 spheres are located at the corners of a cube.
##The Boxer:
1. Draw a magenta box and a cyan box that touch but do not overlap. The faces that touch should have the same area.
2. Draw a yellow third box that touches both of your boxes but does not overlap. Make the surface area of this yellow box match exactly the sum of surface areas of the two boxes it touches.
#Exercise 3: Moving in a Line
1. Draw two spheres that have the same x-coordinate but different y-coordinates.
2. Create a while loop that iterates a time variable t by adding a small amount dt = 0.01 until a final time of 5 seconds
3. Update the position of the first sphere by moving it forward a small amount v*dt each time through the while loop, where v = 5 m/s
4. Update the position of the second sphere by using the equation x0 + v*t, where v = 5m/s and x0 = 0 m.
5. Compare the motion of the two spheres. Are they the same or different? Why?
#Exercise 4: Changing Velocity
Study the provided template for plotting the position and velocity of a ball moving with a constant velocity.
Now let's change the velocity of the ball. The simulation lasts for 10 seconds. Let's have the ball move with the following velocities
* v = 5 for the first 2.0 seconds, then
* v = 0 for 1.0 second, then
* v = -3 for 2.0 seconds, then
* v = 2 for 2.5 seconds, then
* v = -1 for 2.5 seconds
#Exercise 5: Free fall
1. Draw three spheres at x = 0m , x = 1 m, and x = 2 m, all with y = 8 m.
2. Create a while loop that iterates a time variable t by adding a small amount dt = 0.01 until a final time of 5 seconds
3. Use the constant acceleration equation x(t) = x0 + v0*t + 0.5*9.8*t**2 to update the position of each sphere. Give the three spheres initial velocities of v0 = 0, v0 = 5, and v0 = -5.
4. Which one takes the longest to reach the bottom of the screen? Why? Can you give a mathematical answer in addition to a qualitative explanation?
#Exercise 6: 3D Vector addition
1. Draw the x, y, and z axes as arrows. Have give each a length of 5.
2. Draw a vector r1 as an arrow with coordinates (1,2,4)
3. Draw another vector r2 as an arrow with coordinates (3,-3,-2)
4. Draw a vector delta_R with the coordinates r2-r1. Set the "pos" of delta_R at the tip of the r1 arrow.
#Exercise 7: 2D Constant velocity
1. Draw two spheres
2. Create a while loop that iterates a time variable t by adding a small amount dt = 0.01 until a final time of 5 seconds
3. Update the position of one sphere so it moves along the y-axis with a speed of 5 m/s
4. Update the position of the other the other move along the x-axis with a speed of 5 m/s.
5. Draw a third sphere and update its position so that moves with a velocity vector of (5,5,0)
6. Study your animation. Do the three spheres have the same speeds? (They do not!)
7. Draw a fourth sphere that moves along the same 45 degree angle as your third sphere, but with a speed of 5 m/s.
BONUS: Draw two more spheres that move along different angle trajectories with speeds of 5 m/s. What shape are your spheres tracing out as the move?
#Exercise 8: Tortoise and hare
In this problem we will animate the tortoise and the hare in their fabled race.
1. Draw a spherical hare. Have it move to the right at 3 m/s for 3 seconds, then stop for 3 seconds, then run 2 m/s for 3 seconds, then stop for 3 seconds, then run 1 m/s for 3 seconds.
2. Draw a “finish line” for the race. This should be the same location where the hare finishes its final run in (a).
3. Draw a spherical tortoise (in a different color from the hare) and have it start the race a 0 m/s. The tortoise should have a constant *acceleration* such that it reaches the finish line at the exact same instant as the hare.
#Exercise 9: Basketball Free Throw
Let’s animate a basketball free throw!
1. Draw a sphere (the basketball) with a radius of 0.12 meters and a position of 2.5 meters directly above the origin. Draw a rim that is 3.05 meters high and 4.34 meters away from the origin. Use the VPython ring function and give the rim a radius of 0.23 meters. Make sure the ring is in a horizontal plane. (https://www.glowscript.org/docs/VPythonDocs/ring.html)
2. Animate the ball moving in projectile motion from its original position upward and then down through the exact center of the rim. Give the ball an initial x-component of velocity m/s and an initial y-component of velocity such that the ball goes through the exact center of the ring. Make sure the ball accelerates downward at 9.8 m/s^2.
3. Print the angle between the horizontal and the initial velocity vector.
#Exercise 10: Football
1. Draw three spheres that start at the same positon. Call one "qb", one "ball", and the other "receiver".
2. Create a while loop that iterates a time variable t by adding a small amount dt = 0.01 until a final time of 10 seconds
3. Update the position of the "receiver" sphere so that it moves with a constant acceleration along the x-axis. Give it an initial velocity of v0 = 10 m/s and an acceleration of -1.5 m/s^2.
4. After 7 seconds, have the "ball" move with projectile motion so that it reaches the exact position of the receiver at a time t = 10 s. The x-position of the ball should follow the constant velocity equation x(t) = x0 + v0x*t. The y-position of the ball should follow the constant acceleration equation y(t) = y0 + v0y*t - 0.5*9.8*t**2
#Exercise 11: A Friendly Creature
Draw an animal, or a creature, or a character from your favorite video game, cartoon, etc. in VPython. Include at least 12 nontrivial identifiable features. (For example, a head, 2 eyes, 2 ears, a nose, 4 legs, a body, and a tail would be enough for a dog.)
#Exercise 12: A Cozy Space
Build yourself a room (in VPython).
1. Draw the floor, ceiling, and three walls. Don’t draw the fourth wall—we want to be able to see into the room as if it were on stage.
2. Hang a picture on the wall. This should be a box somewhere on one of the walls. You can draw a simple object on the box surface for a picture, or you can use the texture option to place an image on the surface (https://www.glowscript.org/docs/VPythonDocs/texture.html).
3. Draw a light hanging from the ceiling. This could be as simple as a sphere suspended by a string (cylinder).
4. Print the angle between the edge of the floor and the center of the light. Express this angle in units of degrees.
5. BONUS: Interior Decoration
Do any of the following (limit one per customer): Replace your light with a chandelier. Add a couch, a chair, or some other piece of fancy furniture. Draw a cat somewhere in the room. Discuss alternatives with me.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Keith Zengel, "Vectors and Kinematics in Web VPython," Published in the PICUP Collection, July 2024, https://doi.org/10.1119/PICUP.Exercise.KInematicsVPython.
DOI: 10.1119/PICUP.Exercise.KInematicsVPython
The instructor materials are ©2024 Keith Zengel.
The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license


