During most lessons about projectile motion, students inevitably ask, “What about air resistance?” The typical, albeit unsatisfying, response usually suggests that a lot of math is required. It’s a laborious process that few students are willing to work through by hand, but it’s a great task to hand off to a computer! Indeed, many instructors introduce computational physics to their students with the air resistance problem. Solving this problem usually involves incrementally stepping from one time stamp to the next, reworking the net force on the projectile with each iteration. With research science increasingly requiring automation, analysis of huge data sets, modeling, and computational thinking, students need greater exposure to coding. Numerous coding resources are now available that make computational solutions to physics investigations much easier.

VPython is a Python package that your students can use to write code that resembles physics equations. It simplifies visualizations of vectors, objects, and trajectories. With only a few commands, you can create colorful 3D-appearing arrows, boxes, and spheres. Plot the trajectory of a projectile, create a 3D magnetic field vector plot, or create a free body diagram—it’s straightforward in VPython.

When you combine VPython with our Go Direct Python library, you can bring real-world, real-time data into your computational physics activities. Students can use our Python library, published earlier this year, to connect to and read measurements from a Go Direct sensor within a Python program. Students can write Python programs to visualize Go Direct sensor data or to integrate that data into a larger Python project.

When you combine VPython with our Go Direct Python library, you can bring real-world, real-time data into your computational physics activities.

We used VPython and the Go Direct Python library to create a “live” free body diagram of a ring with three forces acting on it: a hanging mass and two supporting strings. One string is fixed to a ring stand and the other is attached to a Go Direct® Force and Acceleration Sensor. When the program runs, it collects force and acceleration data from the force sensor. It uses that information to draw a force vector that points in the same direction as the sensor. The force vector is proportional in length to the force on the ring from the sensor. The program draws a second vector to represent the force on the ring from the hanging mass, which has a constant magnitude and direction. Using the directions and magnitudes of these two forces, the program calculates and draws the third force vector, representing the force on the ring from the string. While the program is running, the free body diagram updates as you move the force sensor; the force vectors change length and direction to match the arrangement in real life.

Free body diagram for the ring showing the forces on the ring from the hanging mass (red), Go Direct Force and Acceleration sensor (green), and support string (yellow)

You can find the VPython package and documentation at www.vpython.org. Our Go Direct Python library and this live free body diagram program can be found on our Python projects page.

Do you already include computational physics activities in your physics courses? We’d love to hear about your successes and challenges! Email us at physics@vernier.com.