- Maxwell Fazio

# VPython Glowscript

Updated: Jun 9

**Go Straight to The Teaching Resources**

Follow the link to go straight to my UbD unit "AP Physics: Modeling with Computer Simulations." It is published on Trinity University's Digital Commons. The unit has a general outline as well as supplementary materials and everything you need to know to start getting set up with Glowscript. Lots of sample programs are there as well. It is published under Creative Commons license, so feel free to use it and modify!

**What is VPython Glowscript?**

Vpython is a version of the Python programming language that makes it extremely easy to render and animate 3-D objects. Even if you have no coding experience, the syntax is intuitive and it's easy to get the hang of it by looking through the sample programs and playing around a bit. If your goal is to teach physics through coding (rather than teaching coding through physics), this is a perfect resource.

Glowscript** **the free site on which you can store, share, and run VPython programs. Think of it like google drive, but for storing and running your own code. Once you create a login, you can edit and run your code right in your web browser without having to download anything to your computer. This is really handy because it is easy to help students get setup. Another HUGE benefit is the program sharing. Once you've written some code, you can share it just by copying a link.

Take a look at my VPython Glowscript video tour below:

**What Are The Benefits of Computer Modeling?**

**(1) Computer modeling emphasizes the creation and evaluation of physical models over the application of those models to arbitrary scenarios. **

*A ball is launched on level ground with a speed of 25 m/s at a 30 degree angle above the horizontal. Neglecting air drag, (a) how far does it go, (b) how much time does it spend in the air, and (c) what maximum height does it achieve? *

This type of projectile-motion problem shows up in almost every introductory physics class. To solve it, students must apply vector mathematics, constant velocity kinematics, and constant acceleration kinematics. However, the problem itself is completely arbitrary. The numbers were randomly chosen and even if the question was given in terms of variables instead of numbers, there is very little emphasis placed on actually understanding the physical models that must be applied to solve it.

For many students, problems like this become about choosing the right equations and doing algebra until they get a right answer. They're not about really understanding why a particular combination of mathematical equations accurately models the system’s behavior. Giving problems like this can encourage students to seek out tricks/shortcuts that allow correct answers to be obtained, but completely bypass the skills and understandings we hope for them to develop.

If the goal is to create a working computer simulation, emphasis transfers to *understanding* a physical models rather than getting a right answer. After all, a computer program is really just one way of writing a mathematical model. Rather than students thinking “how do I solve this problem?” they should be thinking, “How do I model this type of system?” There's nothing wrong with solving problems, but once a simulation for a system is developed, solving a specific scenario, becomes as simple as changing a couple values in their code or adding a few lines.

**(2) Through time-iterative programming, even algebra-based physics allows students to model systems with non-constant force interactions. **

Without the application of calculus, students cannot build complete mathematical models of systems where objects undergo non-constant forces. This is extremely problematic from a pedagogical point of view because most intro physics classes include analysis of some non-constant force systems (like mass-spring oscillators and pendula). Introducing equations that model these systems is typically problematic for teachers because calculus is required to derive them from more basic equations.

Through computer simulations, we can take a system like this and “cheat” by assuming the force on objects IS constant, but over very small time intervals. Then we update the force value appropriately over each small interval. Essentially, time-iterative programming allows us to turn a non-constant force problem into many neighboring constant force problems. The same idea can be applied to other systems with non-constant force, like projectiles with air drag.

**(3) Physics modeling through computer programming provides students with an opportunity to develop basic coding skills. **

Need I say more?

*I tried to keep this blog post short because I have so much related material published in **my unit on the Trinity University Digital Commons site**. Make sure to check it out if you're interested.*